Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dacec5f83c |
@@ -1,72 +1,28 @@
|
||||
# SSL
|
||||
|
||||
## LetsEncrypt
|
||||
## Prérequis
|
||||
|
||||
⚠️ l'accès à l'api Let's Encrypt étant limité en nombre de requète, on se contentera de générer des certificats de test.
|
||||
Rendre accessible le certificat et la clé de airline / formation
|
||||
|
||||
### Prérequis
|
||||
## Présenter le principe de TLS
|
||||
|
||||
La configuration dns doit permettre de résoure le nom de notre serveur ( liaX.formation.opendoor.fr )
|
||||
Ouvrir et commenter le fichier default-ssl.conf
|
||||
|
||||
### Installation du client
|
||||
## Utiliser mozilla
|
||||
|
||||
Installer le paquet _certbot_ (depuis les dépôts EPEL).
|
||||
```bash
|
||||
dnf install -y certbot
|
||||
```
|
||||
Utiliser [https://ssl-config.mozilla.org/](https://ssl-config.mozilla.org/) pour générer une configuration _intermediate_ compatible avec notre version d'apache.
|
||||
|
||||
### Procéder à la demande de certificat
|
||||
## Configuration
|
||||
|
||||
```bash
|
||||
certbot certonly --test-cert --webroot --webroot-path /var/www/html -d lia1.formation.opendoor.fr
|
||||
```
|
||||
Incorporer la configuration générée dans la définition du vhost _formation_ .
|
||||
|
||||
### Vérifier
|
||||
Ne pas oublier la redirection.
|
||||
|
||||
```bash
|
||||
certbot certificates
|
||||
...
|
||||
ls -l /etc/letsencrypt/live/
|
||||
```
|
||||
## Validation
|
||||
|
||||
### Utiliser les certificats
|
||||
Communiquer le n° de port associé au 443
|
||||
|
||||
Utiliser les directives apache SSLCertificateFile et SSLCertificateKeyFile
|
||||
```bash
|
||||
SSLEngine on
|
||||
SSLCertificateFile /etc/letsencrypt/live/lia1.formation.opendoor.fr/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/lia1.formation.opendoor.fr/privkey.pem
|
||||
SSLProtocol +TLSv1.2
|
||||
SSLCompression off
|
||||
SSLHonorCipherOrder on
|
||||
SSLCipherSuite TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDH
|
||||
Header always set Strict-Transport-Security "max-age=63072000;
|
||||
Header set Content-Security-Policy "default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'"
|
||||
Header set X-Content-Type-Options "nosniff"
|
||||
Header set X-Frame-Options "SAMEORIGIN"
|
||||
Header set X-XSS-Protection "1; mode=block"
|
||||
```
|
||||
Ouvrir la version TLS du site.
|
||||
|
||||
### Vérifier
|
||||
Afficher les détails de la page et du certificat
|
||||
|
||||
En allant sur https://liaX.formation.opendoor.fr/ on doit obtenir malgré tout un avertissement de sécurité.
|
||||
|
||||
Cependant en examinant le certificat, on constate qu'il provient de l'organisation _(STAGING) Let's Encrypt_
|
||||
|
||||
|
||||
### Configurer le renouvellement automatique du certificat
|
||||
|
||||
Créer une tâche planifiée permettant d'éxécuter une fois par semaine la commande _certbot renew_ en root
|
||||
```bash
|
||||
cat > /etc/cron.d/letsencrypt <<EOF
|
||||
00 01 * * 6 root /usr/bin/certbot renew
|
||||
EOF
|
||||
```
|
||||
|
||||
Créer le script /etc/letsencrypt/renewal-hooks/post/apache.sh avec le contenu suivant:
|
||||
```bash
|
||||
#! /bin/bash
|
||||
/bin/systemctl reload httpd
|
||||
```
|
||||
|
||||
Le rendre exécutable. Il sera lancé à chanque renouvellement de certificat, permettant une prise en compte immédiate par apache du nouveau certificat.
|
||||
|
||||
Reference in New Issue
Block a user