thanks to linuxconf.org for article.
Introduction
In case you haven't realized already, encryption is important. For the web, that means using SSL certificates to secure web traffic. Recently, Mozilla and Google have gone as far as to mark sites without SSL certificates as insecure in Firefox and Chrome.
In order to bring the Web up to speed with encryption, the Linux Foundation along with the Electronic Frontier Foundation and many others created LetsEncrypt. LetsEncrypt is a project designed to allow users access to free SSL certificates for their websites. To date, LetsEncrypt has issued millions of certificates and is a resounding success.
Making use of LetsEncrypt is easy on Debian, especially when using the Certbot utility from the EFF.Operating System
OS: Debian Linux
Version: 9 (Stretch)
Installing for Apache
Certbot has a specialized installer for the Apache server. Debian has this installer available in its repositories.# apt install python-certbot-apache
The package provides the certbot
command. The Apache plugin interfaces with the Apache server to discover information about your configurations and the domains that it is generating certificates for. As a result, generating your certificates requires only a short command.# certbot --apache
Certbot will generate your certificates and configure Apache to use them.
Auto-Renew with Cron
Whether you're using Apache or Nginx, you will need to renew your certificates. Remembering to do so can be a pain, and you definitely don't want them to lapse. The best way to handle renewing your certificates is to create a cron job that runs twice a day. Twice daily renewals are recommended because they guard against certificates lapsing due to revocation, which can happen from time to time. To be clear, though, they don't actually renew each time. The utility check if the certs are out of date or will be within thirty days. It will only renew them if they meet the criteria.
First, create a simple script that runs Certbot's renewal utility. It's probably a good idea to put it in your user's home directory or a scripts directory so it doesn't get served.#! /bin/bash certbot renew -q
Don't forget to make the script executable too.$ chmod +x renew-certs.sh
Now, you can add the script as a cron job. Open up your crontab and add the script.# crontab -e
* 3,15 * * * /home/user/renew-certs.sh
Once you exit, the script should run every day at 3 a.m. and 3 p.m. by the server's clock.Closing Thoughts
Encrypting your web server protects both your guests as well as yourself. Encryption will also continue to play a role in which sites are displayed in browsers, and it's not much of a stretch to assume that it will also play a role in SEO. Any way you look at it, encrypting your web server is a good idea, and LetsEncrypt is the easiest way to do it.