diff --git a/HowtoEvoACME.md b/HowtoEvoACME.md index 909f2411..18be43b9 100644 --- a/HowtoEvoACME.md +++ b/HowtoEvoACME.md @@ -1,30 +1,24 @@ +--- +categories: web security +title: Howto EvoACME +... + +* Code source : +* Rôle Ansible : + # Howto EvoACME +EvoACME est un ensemble de scripts qui facilite la création de certificats Let's Encrypt dans le contexte d'un serveur web Evolix (Apache + Evoadmin-web). + ## Installation +Il existe un rôle Ansible qui facilite l'installation. Il est aussi possible de l'installer manuellement. + ### certbot EvoAcme utilise Certbot, le client Let's Encrypt créé par l'EFF. -Pour Debian Stretch, il suffit d'installer le paquet. - -~~~ -# apt install certbot -~~~ - -Pour Debian Jessie, il faut l'installer à partir des backports. - -~~~ -# cat /etc/apt/sources.list.d/backports.list -deb http://mirror.evolix.org/debian jessie-backports main - -# cat /etc/apt/preferences.d/z-backports-certbot -Package: certbot python-certbot python-acme python-cryptography python-openssl python-setuptools python-ndg-httpsclient python-pyasn1 python-pkg-resources -Pin: release a=jessie-backports -Pin-Priority: 999 - -# apt update && apt install certbot -~~~ +Consultez notre [documentation de Let's Encrypt](/HowtoLetsEncrypt) pour l'installation de certbot. Certbot installe son propre script dans la crontab, mais nous allons le remplacer @@ -34,19 +28,9 @@ Certbot installe son propre script dans la crontab, mais nous allons le remplace ### evoacme -Nous créons un utilisateur `acme` à qui nous attribuons les dossiers : +Configuration pour evoacme (`/etc/default/evoacme`) : -~~~ -# adduser --home /var/lib/letsencrypt --quiet --system --no-create-home --group acme -# install -m 755 -o acme -g acme -d /etc/letsencrypt /var/lib/letsencrypt -# install -m 750 -o acme -g acme -d /var/log/letsencrypt /var/log/evoacme -# echo "acme: root" >> /etc/aliases && newaliases -~~~ - -Configuration pour evoacme : - -~~~ -# cat /etc/default/evoacme +~~~{.bash} SSL_KEY_DIR=/etc/ssl/private ACME_DIR=/var/lib/letsencrypt CSR_DIR=/etc/ssl/requests @@ -56,10 +40,9 @@ SSL_MINDAY=30 EMAIL=security@example.com ~~~ -Tâche quotidienne : +Tâche quotidienne (`/etc/cron.daily/evoacme`) : ~~~{.bash} -# cat /etc/cron.daily/evoacme #!/bin/sh # # Run evoacme script on every configured cert @@ -73,13 +56,26 @@ CRT_DIR="${CRT_DIR:-'/etc/letsencrypt'}" export QUIET=1 -find "${CRT_DIR}" -maxdepth 1 -mindepth 1 -type d ! -path "*accounts" ! -path "*hooks" -printf "%f\n" | xargs -n1 evoacme +find "${CRT_DIR}" \ + -maxdepth 1 \ + -mindepth 1 \ + -type d \ + ! -path "*accounts" \ + ! -path "*archive" \ + ! -path "*csr" \ + ! -path "*hooks" \ + ! -path "*keys" \ + ! -path "*live" \ + ! -path "*renewal" \ + -printf "%f\n" \ + | xargs --max-args=1 --no-run-if-empty evoacme ~~~ -### Configuration OpenSSL +### OpenSSL -~~~ -# cat /etc/letsencrypt/openssl.cnf +On crée une configuration personnalisée pour OpenSSL dans `/etc/letsencrypt/openssl.cnf` : + +~~~{.ini} [req] default_bits = 2048 encrypt_key = yes @@ -94,52 +90,9 @@ OU = Security emailAddress = security@example.com ~~~ -### Configuration web pour le challenge http +### Intégration au serveur web -Il faut ajouter un alias pour les challenge http du protocole ACME : - -Pour Apache : - -~~~ -# cat /etc/apache2/conf-available/letsencrypt.conf -Alias /.well-known/acme-challenge /var/lib/letsencrypt/.well-known/acme-challenge - - Options -Indexes - Allow from all - Require all granted - - -# a2enconf letsencrypt -# systemctl reload apache2 -~~~ - -Pour Nginx : - -~~~ -# cat /etc/nginx/snippets/letsencrypt.conf -location ~ /.well-known/acme-challenge { - alias /var/lib/letsencrypt/; - try_files $uri =404; - allow all; -} -~~~ - -Inclure ensuite ce fichier dans le VHost par défaut : - -~~~ -server { - […] - include /etc/nginx/snippets/letsencrypt.conf; - […] -} -~~~ - -Vérifier et recharger la configuration de Nginx : - -~~~ -# nginx -t -# systemctl reload nginx -~~~ +Cette phase là est à gérer avec l'installation de certbot. ## Scripts