Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung Nächste ÜberarbeitungBeide Seiten der Revision | ||
software:letsencrypt [2020/01/17 15:17] – st | software:letsencrypt [2022/02/08 10:55] – st | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== letsencrypt ====== | ||
+ | |||
+ | letsencrypt bietet die Möglichkeit kostenlos 3-Monate gültige SSL/ | ||
+ | |||
+ | |||
+ | Es existieren mehrere Clients, die unterschiedliche Methoden und Automatisierungsgrade unterstützen. | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | **offizieller Client (certbot)**: | ||
+ | |||
+ | Eine [[https:// | ||
+ | |||
+ | ===== Installation ===== | ||
+ | |||
+ | :!: Da letsencrypt hat die [[https:// | ||
+ | |||
+ | ==== Debian 10 + 11 ==== | ||
+ | |||
+ | <code bash>apt install certbot python3-certbot-apache python3-certbot-nginx</ | ||
+ | |||
+ | Der cronjob liegt in ''/ | ||
+ | |||
+ | ==== generische Methode ==== | ||
+ | |||
+ | Bei Debian sind in allen älteren stabilen Releases (**vor** Debian 9 / stretch) veraltete Versionen von certbot (bzw. als virtuelles Paket letsencrypt) in den Paketquellen enthalten. Daher ist die generische Methode via git zu verwenden. | ||
+ | |||
+ | <code bash> | ||
+ | apt install git | ||
+ | git clone https:// | ||
+ | cd letsencrypt | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Ubuntu / nginx ==== | ||
+ | |||
+ | <code bash> | ||
+ | apt-get update | ||
+ | apt-get install -y software-properties-common | ||
+ | add-apt-repository universe | ||
+ | add-apt-repository -y ppa: | ||
+ | apt-get update | ||
+ | apt-get install -y python-certbot-nginx | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Benutzung ===== | ||
+ | |||
+ | **letsencrypt aufrufen**: | ||
+ | |||
+ | **generisch**: | ||
+ | <code bash> | ||
+ | cerbot --rsa-key-size 3072 -d DOMAIN.tld -d www.DOMAIN.tld | ||
+ | </ | ||
+ | |||
+ | ==== Hooks ==== | ||
+ | |||
+ | Die wichtigsten hooks: | ||
+ | * pre-hook + post_hooks (Befehle die vorher bzw. nachher laufen) | ||
+ | * deploy_hooks (nach erfolgreicher Verlängerung z.B. zur Installation des Zertifikats) | ||
+ | |||
+ | Beispiel: bei standalone-Variante Webserver lighttpd (der keine Integration hat) stoppen ((allerdings wäre hier die Methode webroot sinnvoller)): | ||
+ | <code bash> | ||
+ | |||
+ | Es können auch mehrere Befehle (innerhalb eines hooks) angegeben werden: < | ||
+ | |||
+ | ==== Zertifikate verlinken ==== | ||
+ | |||
+ | **Zertifikate verlinken: | ||
+ | <code bash> | ||
+ | ln -s / | ||
+ | ln -s / | ||
+ | ln -s / | ||
+ | </ | ||
+ | |||
+ | **[[apache: | ||
+ | |||
+ | |||
+ | ===== wildcard-Domains ===== | ||
+ | |||
+ | Vorraussetzung ist ein v2 acme-Client ((das ist mittlerweile standard, ansonsten explizit angegeben <code bash> | ||
+ | |||
+ | <code bash> | ||
+ | aptitude install git | ||
+ | git clone https:// | ||
+ | </ | ||
+ | |||
+ | Client holt ein Zertifikat für *.DOMAIN.tld und DOMAIN.tld: | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | |||
+ | |||
+ | Zur Verifikation müssen **zwei** (!) **[[netzwerke: | ||
+ | für " | ||
+ | |||
+ | < | ||
+ | Please deploy a DNS TXT record under the name | ||
+ | _acme-challenge.DOMAIN.tld with the following value: | ||
+ | |||
+ | ApKINd5_XvyTvIqFXechXhbH7RebdR01hw5YhTxfQxd | ||
+ | |||
+ | Before continuing, verify the record is deployed. | ||
+ | ------------------------------------------------------------------------------- | ||
+ | Press Enter to Continue | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== automatische Verlängerung ===== | ||
+ | |||
+ | Die Verlängerung lässt sich auch skripten. Dazu gibt es mehrere Varianten: | ||
+ | |||
+ | Der Befehl/das Skript sollte in ''/ | ||
+ | |||
+ | < | ||
+ | [renewalparams] | ||
+ | ... | ||
+ | authenticator = standalone | ||
+ | post_hook = systemctl start apache2 | ||
+ | pre_hook = systemctl stop apache2 | ||
+ | </ | ||
+ | |||
+ | ===== Integrationen ===== | ||
+ | |||
+ | ==== Apache ==== | ||
+ | |||
+ | <code bash>apt install python3-certbot-apache</ | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | / | ||
+ | < | ||
+ | # [...] | ||
+ | authenticator = apache | ||
+ | deploy_hook = systemctl restart apache2 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== nginx ==== | ||
+ | |||
+ | <code bash>apt install python3-certbot-nginx</ | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | / | ||
+ | < | ||
+ | # [...] | ||
+ | authenticator = nginx | ||
+ | deploy_hook = systemctl restart nginx | ||
+ | </ | ||
+ | |||
+ | ==== webroot ==== | ||
+ | |||
+ | |||
+ | < | ||
+ | authenticator = webroot | ||
+ | [[webroot_map]] | ||
+ | $Domain = / | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== cronjob ==== | ||
+ | |||
+ | 1x pro Woche: | ||
+ | < | ||
+ | 12 4 * * 1 | ||
+ | </ | ||
+ | |||
+ | Variante mit zufälliger Wartezeit: ''/ | ||
+ | < | ||
+ | 0 */12 * * * root test -x / | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== deploy_hooks reparieren (mit ansible) ==== | ||
+ | |||
+ | Die Verlängerung der Zertifikate funktioniert aber der Service der sie benutzt wird oft nicht vor Ablauf des Zertifikats neu gestartet? | ||
+ | Dafür sind die hooks da, inbesondere der deploy_hook. | ||
+ | |||
+ | Falls diese fehlen korrigiert das folgende playbook die deploy_hook (und optional noch die pre_hook or post_hook): | ||
+ | |||
+ | [[https:// | ||
+ | < | ||