CFanのBlog

A good day for snow-viewing

Free domain SSL certificates: trying out the Let’s Encrypt public beta

Translated from the Chinese original by Claude.

The Let’s Encrypt project aims to make getting SSL/TLS certificates quicker and easier, and free into the bargain. Let’s Encrypt is already trusted by IdenTrust, so it works on the vast majority of devices. The project went into public beta a couple of days ago, so let’s give it a try.

Let’s Encrypt’s website: https://letsencrypt.org

Here’s how my trial of Let’s Encrypt went

Tested 17 February 2016: DNSPod and Cloudxns both validate normally now.

Update, 11 December 2015: letsencrypt has changed its domain validation rules. If your domain uses a Chinese DNS provider such as DNSPod or Cloudxns, it can’t be validated, because they don’t answer CAA queries, and you get the error DNS query timed out. DNSPod is working on a fix.

Installing the Let’s Encrypt client

Let’s Encrypt provides an automatic install script that you can simply download and run

On RedHat/CentOS 6 you need to enable the EPEL repository before installing.

For other ways to install it, see the user guide.

Getting a free domain certificate with Let’s Encrypt

The Let’s Encrypt client supports a number of ‘plugins’ for obtaining or installing certificates.

PluginObtainInstallNotes
apacheYYAutomatically obtains and installs a certificate on Debian-based distributions running Apache 2.4 with libaugeas0 1.0+ installed.
standaloneYNObtains a certificate using a standalone web server of its own.
webrootYNObtains a certificate by writing to the webroot directory of an existing web server.
manualYNHelps you obtain a certificate by validating the domain yourself.
nginxYYStill experimental, and not included in letsencrypt-auto.

As I already had nginx installed, I chose the webroot plugin to get the certificate.

On the command line you need certonly and --webroot. You can also use --webroot-path or -w to give the web server’s root directory; --webroot-path /var/www/html and --webroot-path /usr/share/nginx/html, for example, are two common ones.

If you need a certificate for several domains at once, each domain uses the nearest --webroot-path before it, like this:

and a single certificate is issued for all of these domains.

Once the command runs, it asks whether you agree to the terms of service; just choose Agree.
letsencrypttos

If it succeeds, it tells you where the certificate is stored, when it expires and so on
QQ screenshot 20151205171027

The certificates are saved in /etc/letsencrypt/live/$domain, where you’ll find these files:

privkey.pem
The certificate’s private key

Warning:

this file must never be made public, at any time! Don’t give it to anyone, not even the Let’s Encrypt developers. Nor can you lock it away at the bottom of a drawer: the server still needs this file for SSL/TLS to work.

This is the file Apache wants as SSLCertificateKeyFile, and nginx as ssl_certificate_key.

cert.pem
The server certificate

This is Apache’s SSLCertificateFile.

chain.pem

All the certificates other than the server certificate, such as the root and intermediate certificates

This is Apache’s SSLCertificateChainFile.

fullchain.pem
All the certificates including the server certificate, i.e. cert.pem and chain.pem combined

This is nginx’s ssl_certificate.

Installing the certificate and turning on HTTPS

Edit the nginx configuration file of the domain the certificate was issued for and add configuration along these lines, and HTTPS will be used by default

nginx 1.9.5 and later support HTTP/2, which can give performance a nice boost

Save it and restart nginx, and that’s it.

The site over HTTPS

Renewing the certificate

Certificates issued by Let’s Encrypt are only valid for 90 days, so renew them at least every three months

Renewing a Let’s Encrypt certificate is easy: just run the same letsencrypt-auto command you used to get it, with the –renew option added.

To renew everything in one go, run the following command

Summary

A single simple command gets you a certificate. That’s partly because Let’s Encrypt issues domain-validated SSL certificates (DV), which only need proof that you own the domain; the free SSL certificates from startssl, comodo and, in China, WoSign were all domain certificates too.

Let’s Encrypt’s advantages over those earlier free certificates are pretty clear. For a start, it’s much simpler to use: with the bundled plugins you no longer have to generate the private key and the certificate signing request (CSR) by hand, and more plugins are planned to make things like installing the certificate automatic as well. The certificates are valid for a good deal less time than startssl’s one year, but because getting one is so easy, renewal can be automated. You can also choose your own key size, and so on.

All in all, getting a certificate validated is very easy, and it’s free and open source as well, so if you need one, why not give it a go.

11 responses to “Free domain SSL certificates: trying out the Let’s Encrypt public beta”

  1. 奶茶 Avatar

    赶紧来膜拜菊苣

    1. 电脑迷 Avatar

      膜奶茶~

      1. 奶茶 Avatar

        奇怪啊,我已经添加了Gravatar,为啥还是没有头像。。

        1. 电脑迷 Avatar

          可能是邮箱不一样?

  2. skelviper Avatar

    吓得我赶紧来膜拜了

  3. shanliang Avatar

    膜拜菊苣,照着菊苣的教程搞好了

    1. 电脑迷 Avatar

      闪亮菊苣好(`・ω・´)

      1. shanliang Avatar

        电脑迷菊苣啊,cdn和ssl是不是熊掌不可兼得的关系啊?

        1. 电脑迷 Avatar

          不是啊,大多cdn都支持自己上传ssl证书,不过基本都要付费套餐才提供这功能。

  4. 掩耳 Avatar

    文科生表示看不懂,不过我还想试试

Leave a comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.