systemes:web:https_letsencrypts

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
systemes:web:https_letsencrypts [2016/02/02 13:38]
pam [Configuration]
systemes:web:https_letsencrypts [2019/02/06 14:03] (Version actuelle)
Ligne 3: Ligne 3:
 <callout type="primary"> <callout type="primary">
 ===== Introduction ===== ===== Introduction =====
-Keepalived est un logiciel de routage. Le principal objectif de ce projet est de mettre en place du loadbalancing et/ou de la haute disponibilité pour les systèmes Linux et des infrastructures basées sur Linux. Le Loadbalancing repose sur Linux Virtual Server (IPVS) et la haute disponibilité fonctionne via le protocole VRRP.+Dès à présent les certificats ssl deviennent gratuits grâce à Let's Encrypt qui révolutionne vraiment ce domaine.
 </callout> </callout>
  
  
-===== Installation de keepalived =====+===== Installation d'un certificat =====
  
 ==== Récupération des sources ==== ==== Récupération des sources ====
  
 <code bash> <code bash>
-yum/apt-get install keepalived+git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt 
 +cd /opt/letsencrypt/
 </code> </code>
  
-==== Configuration ====+==== Génération du certificat ====
  
-Dans le cas d'une infra web avec deux proxys en amonten état master/slave, dont un actif, et l'autre en secours+<code bash> 
 +./letsencrypt-auto certonly --webroot -w /var/www/www.domaine.fr/ -domaine.fr -d www.domaine.fr 
 +</code> 
 +  * La racine du web doit être une partie accessible depuis le nom de domainecar la génération du certificat doit ce faire avec un échange de fichiers via ce répertoire.
  
-  * Serveur Proxy1 : 
-  * <file bash /etc/keepalived/keepalived.conf> 
-global_defs { 
-  notification_email 
-  { 
-    mail.a.prevenir@domaine.fr 
-  } 
  
-  notification_email_from proxy1@domaine.fr 
-  smtp_server xxx.xxx.xxx.xxx 
-  smtp_connect_timeout 30 
  
-}+==== Préparation du vhost ( apache2) ====
  
-# instance VRRP pour smtp +<code bash> 
-vrrp_instance VI1 {+vim /etc/apache2/sites-available/ssl-www.domaine.fr
  
-  interface ens192 +<VirtualHost *:443> 
-  state MASTER            # MASTER sur proxy1, SLAVE sur proxy2 + ServerAdmin contact@domaine.fr 
-  virtual_router_id 11 + ServerName domaine.fr 
-  priority 101            # 101 on master, 100 on backup+ ServerAlias www.domaine.fr 
 +
  
-  virtual_ipaddress { 
-    192.168.1.4/24 brd 192.168.1.255 dev ens192 label ens192:0 
-  } 
  
-  smtp_alert+ SSLEngine on
  
-  authentication +        # Regles SSL A+ sur ssllabs 
-  { +        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 
-    auth_type PASS +        SSLProtocol All -SSLv2 -SSLv3 -TLSv1 
-    auth_pass mdp8char +        SSLHonorCipherOrder     on 
-  }+        SSLCompression          off 
 +        Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
  
-+ SSLCompression          off
-</file>+
  
-  * Serveur Proxy2 : 
-  * <file bash /etc/keepalived/keepalived.conf> 
-global_defs { 
-  notification_email 
-  { 
-    mail.a.prevenir@domaine.fr 
-  } 
  
-  notification_email_from proxy2@domaine.fr 
-  smtp_server xxx.xxx.xxx.xxx 
-  smtp_connect_timeout 30 
  
-} 
  
-# instance VRRP pour smtp +        SSLCertificateFile /etc/letsencrypt/live/domaine.fr/cert.pem 
-vrrp_instance VI1 {+        SSLCertificateKeyFile /etc/letsencrypt/live/domaine.fr/privkey.pem 
 +        SSLCertificateChainFile /etc/letsencrypt/live/domaine.fr/fullchain.pem
  
-  interface ens192 
-  state SLAVE 
-  virtual_router_id 11 
-  priority 100            # 101 on master, 100 on backup 
  
-  virtual_ipaddress { + DocumentRoot /var/www/www.domaine.fr/ 
-    192.168.1.4/24 brd 192.168.1.255 dev ens192 label ens192:0 + <Directory /> 
-  }+ Options FollowSymLinks 
 + AllowOverride None 
 + </Directory> 
 + <Directory /var/www/www.domaine.fr> 
 + Options Indexes FollowSymLinks MultiViews 
 +                AllowOverride none 
 +                Order allow,deny 
 +                allow from all 
 + </Directory>
  
-  smtp_alert 
  
-  authentication + ErrorLog /var/log/apache2/error-www.domaine.fr-ssl.log 
-  { + 
-    auth_type PASS + # Possible values include: debug, info, notice, warn, error, crit, 
-    auth_pass mdp8char + # alert, emerg. 
-  }+ LogLevel warn 
 + 
 + CustomLog /var/log/apache2/access-www.domaine.fr-ssl.log combined 
 + 
 + 
 +</VirtualHost> 
 +</code> 
 + 
 + 
 +<code bash> 
 +a2enmod ssl 
 +a2ensite ssl-www.domaine.fr 
 +service apache2 reload 
 +</code> 
 + 
 + 
 + 
 + 
 + 
 + 
 +===== Tests de fonctionnement ===== 
 + 
 + 
 +https://www.sslshopper.com/ssl-checker.html#hostname=domaine.fr 
 + 
 + 
 + 
 +===== Renouvellement automatique ===== 
 + 
 +  * Let's Encrypt fournit des certificats valides durant 90 jours. Voici un petit script afin d'automatiser cette procédure de renouvellement. 
 + 
 +<code bash> 
 +mkdir /opt/scripts/ 
 +cd /opt/scripts/ 
 +</code> 
 + 
 + 
 +<code bash> 
 +vim /etc/letsencrypt/domaine.fr.cfg 
 + 
 +authenticator = webroot                                                                                                                                                                                         
 +webroot-path = /var/www/www.domaine.fr/ 
 +renew-by-default 
 +agree-tos 
 +email = meme_mail_que_demander_a_l_install@domaine.com 
 + 
 +</code> 
 + 
 +<code bash> 
 +vim renew_certs_letsencrypts.sh 
 + 
 +#!/bin/bash                                                                                                                                                                                                     
 + 
 +cd /opt/letsencrypt/ 
 +./letsencrypt-auto certonly --config /etc/letsencrypt/domaine.fr.cfg  -d domaine.fr -d www.domaine.fr 
 + 
 + 
 +if [ $? -ne 0 ] 
 + then 
 +        ERRORLOG=`tail /var/log/letsencrypt/letsencrypt.log` 
 +        echo -e "Bonjour,\nLe certificat https pour domaine.fr n'as PAS été renouvelé automatiquement \n \n" $ERRORLOG | mail -s "ERREUR renouvellement de certificats"  mailperso@domaine.com 
 + 
 + else 
 +        service apache2 reload 
 +        echo -e "Bonjour,\nLe certificat https pour domaine.fr renouvelé automatiquement" | mail -s "Renouvellement de certificats"  mailperso@domaine.com 
 + 
 +fi 
 + 
 + 
 +</code> 
 + 
 +<code bash> 
 +chmod +x renew_certs_letsencrypts.sh 
 +crontab -e 
 + 
 +@monthly /opt/scripts/renew_certs_letsencrypts.sh 
 + 
 +</code>
  
-} 
-</file> 
  
  
 +Source : letsencrypt.readthedocs.org
  
  
 [[systemes:start|Retour]] [[systemes:start|Retour]]
  • systemes/web/https_letsencrypts.1454416721.txt.gz
  • Dernière modification: 2019/02/06 14:02
  • (modification externe)