Let's Encrypt

From Leo's Notes
Revision as of 05:42, 4 December 2015 by Leo (talk | contribs) (archive and live directory)
This page was last edited on 4 December 2015, at 05:42.

Let's Encrypt is a service that provides free SSL certificates. It verifies a website's server by a series of challenges before signing any certificate requests.

Getting Certificates

Use the letsencrypt-auto script to interface with Let's Encrypt.

To generate a certificate, turn off any servers on port 80 and then run:

./letsencrypt-auto certonly

Running Without Root

You may try to use the letsencrypt-nosudo project at https://github.com/diafygi/letsencrypt-nosudo.

I was not able to get it working since the API kept on returning a 400 error:

{"type":"urn:acme:error:malformed","detail":"Unable to read/verify body :: JWS verification error","status":400}

This lead me to cheat. (see below)

Getting Certificates for cPanel

Because I do not want to run the letsencrypt-auto script as root on my cPanel account (and this applies to all shared hosting accounts too), I decided to run it inside a VM at home instead and then copy the certificate to the cPanel account. For this to work, I temporarily updated my DNS record to point to my home IP address before running letsencrypt-auto. Once the challenges passes and the certificate is signed, I reverted my DNS to point back to my cPanel server.

While this still exposes the private keys to their script, I was able to get around needing root access on the cPanel server.

Let's encrypt will then place the certificates at /etc/letsencrypt/archive/$DOMAIN$/, but should be referenced from the 'live' directory at /etc/letsencrypt/live/$DOMAIN$/. To get your certificate working with cPanel, log in to cPanel, click on 'Install an SSL Website', then fill the following fields with their respective file contents:

  1. Certificate: (CRT) -> privkey.pem
  2. Private Key (KEY) -> cert.pem
  3. Certificate Authority Bundle: (CABUNDLE) -> chain.pem

cPanel should take care of the rest once the SSL certificates are installed.

Renewing

Let's Encrypt's certificates are only valid for 90 days and requires constant renewal. Possible solutions to automate this are:

  1. Custom DNS zone for let's encrypt so they always see my domains from my home.
  2. ???