Différences
Ci-dessous, les différences entre deux révisions de la page.
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/01/29 16:24] pam [Introduction] |
systemes:web:https_letsencrypts [2019/02/06 14:03] (Version actuelle) |
||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
<callout type=" | <callout type=" | ||
===== 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 |
</ | </ | ||
- | ===== Installation | + | ===== Installation |
==== Récupération des sources ==== | ==== Récupération des sources ==== | ||
<code bash> | <code bash> | ||
- | yum/apt-get install keepalived | + | git clone https:// |
+ | cd / | ||
</ | </ | ||
- | ==== Configuration | + | ==== Génération du certificat |
- | Dans le cas d'une infra web avec deux proxys en amont, en état master/ | + | <code bash> |
+ | ./ | ||
+ | </ | ||
+ | * La racine du web doit être une partie accessible depuis le nom de domaine, car la génération du certificat doit ce faire avec un échange de fichiers via ce répertoire. | ||
- | * Serveur Proxy1 : | ||
- | * <file bash / | ||
- | 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 / |
- | interface ens192 | + | < |
- | state MASTER | + | ServerAdmin contact@domaine.fr |
- | | + | ServerName domaine.fr |
- | | + | ServerAlias www.domaine.fr |
+ | |||
- | virtual_ipaddress { | ||
- | 192.168.1.4/ | ||
- | } | ||
- | smtp_alert | + | SSLEngine on |
- | authentication | + | # Regles SSL A+ sur ssllabs |
- | { | + | |
- | | + | |
- | | + | |
- | } | + | |
+ | Header always set Strict-Transport-Security " | ||
- | } | + | SSLCompression |
- | </ | + | |
- | * Serveur Proxy2 : | ||
- | * <file bash / | ||
- | 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 / |
- | vrrp_instance VI1 { | + | |
+ | SSLCertificateChainFile / | ||
- | interface ens192 | ||
- | state SLAVE | ||
- | virtual_router_id 11 | ||
- | priority 100 # 101 on master, 100 on backup | ||
- | virtual_ipaddress { | + | DocumentRoot / |
- | 192.168.1.4/24 brd 192.168.1.255 dev ens192 label ens192:0 | + | < |
- | } | + | Options FollowSymLinks |
+ | AllowOverride None | ||
+ | </ | ||
+ | < | ||
+ | Options Indexes FollowSymLinks MultiViews | ||
+ | AllowOverride none | ||
+ | Order allow, | ||
+ | allow from all | ||
+ | </ | ||
- | smtp_alert | ||
- | authentication | + | ErrorLog / |
- | | + | |
- | | + | # Possible values include: debug, info, notice, warn, error, crit, |
- | | + | # alert, emerg. |
- | | + | LogLevel warn |
+ | |||
+ | CustomLog / | ||
+ | |||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | a2enmod ssl | ||
+ | a2ensite ssl-www.domaine.fr | ||
+ | service apache2 reload | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Tests de fonctionnement ===== | ||
+ | |||
+ | |||
+ | https:// | ||
+ | |||
+ | |||
+ | |||
+ | ===== Renouvellement automatique ===== | ||
+ | |||
+ | | ||
+ | |||
+ | <code bash> | ||
+ | mkdir / | ||
+ | cd / | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | vim / | ||
+ | |||
+ | authenticator = webroot | ||
+ | webroot-path = / | ||
+ | renew-by-default | ||
+ | agree-tos | ||
+ | email = meme_mail_que_demander_a_l_install@domaine.com | ||
+ | |||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | vim renew_certs_letsencrypts.sh | ||
+ | |||
+ | # | ||
+ | |||
+ | cd / | ||
+ | ./ | ||
+ | |||
+ | |||
+ | if [ $? -ne 0 ] | ||
+ | | ||
+ | ERRORLOG=`tail / | ||
+ | echo -e " | ||
+ | |||
+ | | ||
+ | service apache2 reload | ||
+ | echo -e " | ||
+ | |||
+ | fi | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | chmod +x renew_certs_letsencrypts.sh | ||
+ | crontab -e | ||
+ | |||
+ | @monthly / | ||
+ | |||
+ | </ | ||
- | } | ||
- | </ | ||
+ | Source : letsencrypt.readthedocs.org | ||
[[systemes: | [[systemes: |