Stig Sandbeck Mathisen: Let's Encrypt with Hitch and Varnish
Let's Encrypt
Let's Encrypt is a
free, automated and open Certificate Authority (CA), run for the
public's benefit.
Varnish
Varnish is a HTTP
accelerator. I use it as a web server, and it serves content
from various backends.
Varnish is used on a lot of high-traffic web servers, and
supports simple and complex web site configurations.
Hitch
Hitch is a TLS proxy, by
Varnish Software. It terminates TLS connections, and forwards
them to a backend, unencrypted.
The TLS proxy is simple to configure, and handles many thousands
of requests per second on commodity hardware.
Hitch was originally called stud and was written by Jamie Turner
at Bump.com.
Varnish plugin for Let's Encrypt
Let's
Encrypt Varnish Plugin is needed for the Let's Encrypt
client to authenticate against their service, for getting the
certificates.
You can skip this if you have the option of temporarily
disabling your web service, when registering and renewing your
certificates.
Hitch TLS proxy
Hitch must be configured to listen on the https port (TCP/443),
with a list of strong ciphers.
To get Forward
Secrecy, we need ciphers with EECDH or EDH. To use these, we
need to generate a set of DH
Parameters.
In
/etc/hitch/hitch.conf:
# Listening
frontend = "[*]:443"
ciphers = "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"
Varnish as backend for Hitch
Hitch will forward traffic to Varnish on localhost:6082, using
the PROXY protocol. Here's a snippet for
/etc/hitch/hitch.conf to do this:
# Send traffic to the varnish backend
backend = "[::1]:6086"
write-proxy-v2 = on
For varnish, I've added a separate port for the "PROXY"
protocol, by adding an extra "-a" argument for port 6086. The
-a :80 handles the existing http traffic, while the
-a '[::1]:6086,PROXY' adds a listener on localhost,
which will be used by hitch.
/usr/sbin/varnishd -j unix,user=vcache -a :80 -a '[::1]:6086,PROXY' ...
Let's Encrypt
install letsencrypt
First, install the letsencrypt client. The beta program sends you a
mail with instructions. When it is generally available, I suspect
it'll be something like:
apt install letsencrypt
install varnish plugin
Then, get the let's
encrypt varnish plugin.
The plugin will extend the letsencrypt software to be able to
rewrite the VCL and reload Varnish to satisfy the authentication
challenge of the Let's Encrypt server.
cd /usr/local/src
git clone http://git.sesse.net/letsencrypt-varnish-plugin
. ~/.local/share/letsencrypt/bin/activate
pip install -e /usr/local/src/letsencrypt-varnish-plugin
get certificate
Get certificates. Let's Encrypt is still in beta, so I had to
add a few more command line arguments than the documentation
specifies:
~/.local/share/letsencrypt/bin/letsencrypt --agree-dev-preview \
--server https://acme-v01.api.letsencrypt.org/directory \
-a letsencrypt-varnish-plugin:varnish -d example.org certonly
Adding certificates to Hitch
Hitch requires one PEM file per domain we serve. Each .pem file
contains the private key, the signed certificate and any
required intermediates.
Create a file with DH parameters:
openssl dhparam -out /etc/hitch/dhparam.pem 2048
This file may take a long while to generate.
Combine the key, the signed certificate, and the dhparam file to
something hitch can use:
cat \
/etc/letsencrypt/live/example.org/privkey.pem \
/etc/letsencrypt/live/example.org/fullchain.pem \
/etc/hitch/dhparam.pem \
> /etc/hitch/example.org.pem
chmod 0600 /etc/hitch/example.org.pem
and configure hitch to use the file, by adding it to
/etc/hitch/hitch.conf:
# List of PEM files, each with key, certificates and dhparams
pem-file = "/etc/hitch/example.org.pem"
pem-file = "/etc/hitch/www.example.org.pem"
pem-file = "/etc/hitch/example.com.pem"
pem-file = "/etc/hitch/www.example.com.pem"
Debian LTS
October was the sixth month I contributed to
My main reason for being here was to join the Debconf video team sprint.
But hey, since I'm here anyway, why not join all of it, right?
Right.
Apart from the video team stuff that I've been involved in, I've been
spending the last few days improving 
This is the fifth -and last- part in a series of articles about SRE, based on the talk I gave in the
At the
The Washington Post published
Tomorrow the 
So the work on
Last week, Senator Omar Fayad presented one of the prime examples of a poorly redacted law that, if enacted, will make basically any way of computer use illegal. And yes, even if he
I have just released version 1.18 of Obnam, my backup program. See the
website at
Thanks to Mehdi Dogguy, here's a nice hook to generate a source
change file at build time (with pbuilder), so one can upload
source-only packages to the archive and have buildds rebuild for
all the architectures. Put it in .pbuilder/hooks/B10_source-build
so it gets called once the builds succeeds
