Let's encrypt on Arch Linux

First we need apache and let's encrypt client:
pacman -S certbot

As Apache is running on port 80, and we do not want any interruption to the service, we will use "webroot" plugin. Assuming our domain is www.bogus.com, the request will look like this:

certbot certonly --email p******t@gmail.com --webroot -w /srv/http/ -d www.secure.com


 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.

Note: you do not need to enter e-mail address again.

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/flex.prkp.eu/fullchain.pem. Your cert will
   expire on 2016-12-13. To obtain a new or tweaked version of this
   certificate in the future, simply run certbot again. To
   non-interactively renew *all* of your certificates, run "certbot
   renew"

For SSL, enable:
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
Include conf/extra/httpd-ssl.conf

And create self signed certificate to satisfy the "default" SSL virtual host. By using exactly the command below, you will ensure that you do not need to modify httpd-ssl.conf at all:
# cd /etc/httpd/conf
# openssl req -new -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt -days 1095
# chmod 400 server.key

Now define minimalistic Virtual host for your domain:
<VirtualHost www.secure.com:443>
    DocumentRoot "/srv/http"
    ServerName www.secure.com:443

    SSLEngine on
    SSLCertificateFile "/etc/letsencrypt/live/www.secure.com/fullchain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/www.secure.com/privkey.pem"
</VirtualHost>

And last, but not least. If you using multiple SSL vhosts ensure that the above lines from httpd.conf goes to the end (or after SSL configuration is loaded). In such case, the default SSL virtual host would be the one defined in SSL config rather the first one in vhost config:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Comments

Popular posts from this blog

Hardening OpenWRT - adding non-root user account

Dropbear SSH keys and autossh on OpenWRT

SSH Tunel with OpenWRT