Outils pour utilisateurs

Outils du site


informatique:let_s_encrypt

Let's Encrypt

Let's Encrypt est un projet soutenu par Internet Security Research Group (ISRG). L'objectif est de permettre à tous et gratuitement de pouvoir mettre en place des certificats SSL pour sécuriser les connexions.

Configuration des certificats Let's Encrypt

Acme.sh

acme.sh (github) est un client pour Let's Encrypt écrit en bash, avec très peu de dépendances.

La première chose est d'installer acme.sh en suivant la procédure d'installation.

# apt install socat
# curl https://get.acme.sh | sh

Ensuite, il faut avoir un domaine déjà configuré en HTTP, avec un dossier accessible. Une fois que c'est fait, il n'y a plus qu'à suivre les exemples sur le github du projet :

# acme.sh --issue -d plouf.com -d www.plouf.com -w /var/www/plouf/

Bonus : L'installation d'acme.sh ajoute directement une ligne dans le cron :

4 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
Choisir une clé ECC et sa taille
# acme.sh --issue -d plouf.com -d www.plouf.com -w /var/www/plouf/ --keylength ec-384
Wildcard
$ acme.sh --issue -d artanux.be -d '*.artanux.be' --dns dns_ovh --keylength ec-384

Détails sur la page acme.sh.

Arrêter le renouvellement d'un certificat

Les explications sont sur la page github mais le plus simple est de supprimer le dossier correspondant :

# rm -r ~/.acme.sh/plouf.com

Certbot

Cette partie est un peu ancienne et plus forcément pertinente…

J'ai configuré les certificats pour plusieurs noms de domaines et voici la procédure suivie, pour le domaine fictif “plouf.com”.

On commence par activer les backports (sous Stretch) afin de bénéficier de la version de certbot la plus récente.

# vim /etc/apt/sources.list
  #(...ajouter à la fin du fichier :)
  # Backports repository
  deb http://ftp.debian.org/debian stretch-backports main

Dans mon cas, après installation sans les backports, certbot était en version 0.10 alors qu'avec les backports, on a la version 0.19.0.

# apt-get -t stretch-backports install python-certbot-apache
# certbot --version
certbot 0.19.0

Sur une installation plus récente, j'ai du passer par pip pour installer certbot 0.21. L'installation depuis les backports ne fonctionnait pas.

# certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
 
Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: plouf.com
2: chat.plouf.com
3: wiki.plouf.com
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for caliban.be
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/plouf.com-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate for caliban.be to VirtualHost /etc/apache2/sites-available/plouf.com-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/plouf.com-le-ssl.conf
 
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting vhost in /etc/apache2/sites-enabled/cplouf.com.conf to ssl vhost in /etc/apache2/sites-available/plouf.com-le-ssl.conf
 
-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://plouf.com
 
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=plouf.com
-------------------------------------------------------------------------------
 
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/plouf.com-0001/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/plouf.com-0001/privkey.pem
   Your cert will expire on 2018-04-10. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:
 
   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

On peut tester un renouvellement des certificats avec la commande suivante :

# certbot renew --dry-run

Actuellement, ça foire chez moi… Pas encore compris pourquoi.

Clés plus longues

# certbot certonly -a webroot --rsa-key-size 4096 --webroot-path=/var/www/plouf.com -d plouf.com -d www.plouf.com

Sources

informatique/let_s_encrypt.txt · Dernière modification : 2020/08/09 13:03 de 127.0.0.1