Skip to content
/ le-bot Public
forked from plotly/le-bot

let's encrypt bot that returns certificates for a given domain

License

Notifications You must be signed in to change notification settings

plantly/le-bot

 
 

Repository files navigation


le-bot

Bot that creates/distributes/updates certificates for a supplied subdomain and a known domain. To be used on a Google Cloud machine and Let's Encrypt's bash client dehydrated.sh.

Requirements

Python 2.7 environment

Let's Encrypt shell client dehydrated

curl -sL https://github.com/lukas2511/dehydrated/archive/v0.4.0.tar.gz | tar xz

Assuming your domain is your-domain.com that is under your-zone zone in your Google Cloud DNS records,

  • You must be authenticated with gcloud, run gcloud auth login.

  • Set the correct Google Cloud project gcloud config set project $GCLOUD_PROJECT_NAME.

  • Your gcloud account must have access to modify DNS entries of the aforementioned Google Cloud zone of that project.

How to use

Setup

In a new directory

git clone https://github.com/alexandresobolevski/le-bot.git
cd le-bot
pip install -r requirements.txt
  • Duplicate the file credentials-example.sh as credentials.sh and modify the entries ZONE_NAME and DNS_DOMAIN to your Google Cloud DNS zone name and domain respectively i.e.
ZONE_NAME="your-zone"
DNS_DOMAIN="your-domain.com"

Run

  • Start the bot server:
python le-server.py 9090
  • Post a request to the server to obtain the certificate as shown in the screenshot below,

  • Write the response from the bot (as seen above) to files (cert.pem and key.pem) and save the received subdomain. Your certificates will work for a server hosted on subdomain.your-domain.com:${port}. Use created files (cert and key) when starting an HTTPS server.

Test

  • Duplicate (if not yet done) credentials-example.sh as credentials.sh and modify the entries ZONE_NAME and DNS_DOMAIN to your Google Cloud DNS zone name and domain respectively as well as the Plotly credentials (PLOTLY_API_KEY, PLOTLY_USERNAME and PLOTLY_ACCESS_KEY) i.e.

  • Run the tests.

source credentials.sh && python test.py

About

let's encrypt bot that returns certificates for a given domain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 72.2%
  • Shell 27.6%
  • HTML 0.2%