Installer et utiliser Let’s Encrypt pour créer des certificats SSL pour le Web et Apache 2
Installer Certbot
apt -y install certbot
Générer un certificat sur le domaine
certbot certonly --webroot -w /var/www/html -d domain.tld
Créer ou modifier l’hôte virtuel apache (vhost)
<VirtualHost *:80> ServerName domain.tld ServerAlias www.domain.tld RewriteEngine on RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} </VirtualHost> <VirtualHost *:443> ServerName domain.tld ServerAlias www.domain.tld DocumentRoot /path/to/files/www.domain.tld <Directory /path/to/files> Options -Indexes AllowOverride all Order allow,deny allow from all </Directory> SSLEngine on SSLCertificateFile /etc/letsencrypt/live/domain.tld/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/domain.tld/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/domain.tld/chain.pem SSLProtocol all -SSLv2 -SSLv3 SSLHonorCipherOrder on SSLCompression off SSLOptions +StrictRequire SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" LogLevel warn ErrorLog ${APACHE_LOG_DIR}/www.domain.tld-error.log CustomLog ${APACHE_LOG_DIR}/www.domain.tld-access.log combined </VirtualHost>
Planifier la tâche de renouvellement de certificat avec Crontab (à 2h du matin)
crontab -e 0 2 * * * certbot renew
Source : https://www.server-world.info/en/note?os=Debian_10&p=ssl&f=2 / https://www.memoinfo.fr/tutoriels-linux/configurer-lets-encrypt-apache/