|
|
(11 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) |
Zeile 66: |
Zeile 66: |
| ''' Per Auftrag an service@ muss um Aktivierung des neuen Zertifikats gebeten werden. ''' | | ''' Per Auftrag an service@ muss um Aktivierung des neuen Zertifikats gebeten werden. ''' |
|
| |
|
| === Kostenlose SSL-Zertifikate von StartSSL ===
| | == Kostenlose Let's Encrypt Zertifikate == |
|
| |
|
| Heise hat unter der URL
| | Es gibt kostenlose Zertifikate von Let's Encrypt. Davon handelt der eigene Artikel [[TLS mit Let's Encrypt Zertifikat]]. |
| http://www.heise.de/security/artikel/Die-Praxis-881280.html
| |
| den Vorgang dokumentiert, wie man ein Zertifikat erhält,
| |
| das von StartSSL ausgestellt wurde und somit im Browser auch keine Warnmeldung verursacht.
| |
| | |
| Mit den Zeilen
| |
| | |
| <pre><nowiki>
| |
| $> openssl genrsa -out example.com.key 2048
| |
| $> openssl req -new -key example.com.key -out example.com.csr
| |
| ...
| |
| </nowiki></pre>
| |
| | |
| erstellt man sich ein Certificate Signing Request (CSR).
| |
| | |
| Wenn man dann auf https://www.startssl.com/ die "Express Lane" benutzt (privates Zertifikat erzeugen, im Browser installieren, einloggen, Zertifikat anfragen -> "Skip" beim erzeugen -> CSR in Formular kopieren) bekommt man am Ende zwei Dateien:
| |
| | |
| <pre><nowiki>
| |
| sub.class1.server.ca.pem
| |
| ca.pem
| |
| </nowiki></pre>
| |
| | |
| sowie das Zertifikat zum Kopieren/Einfügen in eine Datei <b>ssl.crt</b>.
| |
| | |
| Dieses Zertifikat und der private Schlüssel müssen in einer Datei zusammengefasst werden;
| |
| gleichzeitig sollte der Erfolg der Aktion mit <b>openssl</b> überprüft werden:
| |
| | |
| <pre><nowiki>
| |
| $> cat example.com.key ssl.crt > ~/etc/https.pem
| |
| $> openssl s_server -cert https.pem -www
| |
| Using default temp DH parameters
| |
| Using default temp ECDH parameters
| |
| ACCEPT
| |
| ^C
| |
| $>
| |
| </nowiki></pre>
| |
| | |
| Außerdem muss die Datei '''sub.class1.server.ca.pem''' per SFTP nach ~/etc/ hochgeladen werden.
| |
| | |
| ''' Per Auftrag an service@ muss um Aktivierung des neuen Zertifikats example.com.crt, example.com.key und ggf die example.com.chain oder sub.class1.server.ca.pem gebeten werden. '''
| |
| | |
| Hier kann man das Zertifikat nach der Aktivierung testen:
| |
| | |
| <pre>
| |
| http://www.digicert.com/help/
| |
| </pre>
| |
| | |
| === Automatisierte SSL-Zertifikate von Let’s Encrypt ===
| |
| | |
| Auf Github findet man die Buildout-Konfiguration für den Certbot, einen Installer / Updater für Let's Encrypt Zertifikate "userland-certbot". Mithilfe dieses Projekts von Michael Hierweck und Veit Schiele lassen sich
| |
| tatsächlich automatisiert Let's encrypt Zertifikate automatisiert installieren und erneuern. Hier wird beschrieben, wie man diese Konfiguration in einer Hostsharing-Umgebung einsetzen kann.
| |
| Dazu wird im Home-Verzeichnis des Domain-Admin eine virtuelle Python-Umgebung mit virtualenv erzeugt. In der Umgebung wird Buildout installiert und mit buildout lässt sich der Certbot installieren.
| |
| <pre>
| |
| xyz00-doms@myhive:~$ virtualenv certbot
| |
| Running virtualenv with interpreter /usr/bin/python2
| |
| New python executable in certbot/bin/python2
| |
| Also creating executable in certbot/bin/python
| |
| Installing setuptools, pip...done.
| |
| | |
| xyz00-doms@myhive:~$ cd certbot/
| |
| xyz00-doms@myhive:~/certbot$ . bin/activate
| |
| (certbot)xyz00-doms@myhive:~/certbot$
| |
| (certbot)xyz00-doms@myhive:~/certbot$ pip install zc.buildout
| |
| Downloading/unpacking zc.buildout
| |
| Downloading zc.buildout-2.5.2-py2.py3-none-any.whl (262kB): 262kB downloaded
| |
| Downloading/unpacking setuptools>=8.0 (from zc.buildout)
| |
| Downloading setuptools-25.2.0-py2.py3-none-any.whl (442kB): 442kB downloaded
| |
| Installing collected packages: zc.buildout, setuptools
| |
| Found existing installation: setuptools 5.5.1
| |
| Uninstalling setuptools:
| |
| Successfully uninstalled setuptools
| |
| Successfully installed zc.buildout setuptools
| |
| Cleaning up...
| |
| | |
| (certbot)xyz00-doms@myhive:~/certbot$ git clone https://github.com/veit/userland-certbot.git
| |
| Cloning into 'userland-certbot'...
| |
| remote: Counting objects: 55, done.
| |
| remote: Total 55 (delta 0), reused 0 (delta 0), pack-reused 55
| |
| Unpacking objects: 100% (55/55), done.
| |
| Checking connectivity... done.
| |
| | |
| (certbot)xyz00-doms@myhive:~/certbot$ cd userland-certbot/
| |
| (certbot)xyz00-doms@myhive:~/certbot/userland-certbot$ buildout
| |
| Creating directory '/home/pacs/xyz00/users/doms/certbot/userland-certbot/bin'.
| |
| Creating directory '/home/pacs/xyz00/users/doms/certbot/userland-certbot/parts'.
| |
| Creating directory '/home/pacs/xyz00/users/doms/certbot/userland-certbot/develop-eggs'.
| |
| Installing certbot.
| |
| Generated script '/home/pacs/xyz00/users/doms/certbot/userland-certbot/bin/certbot'.
| |
| Installing certbot-directories.
| |
| certbot-directories: created path: /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot
| |
| certbot-directories: created path: /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot/bin
| |
| certbot-directories: created path: /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot/etc
| |
| certbot-directories: created path: /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot/lib
| |
| certbot-directories: created path: /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot/log
| |
| certbot-directories: created path: /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot/web
| |
| Installing certbot-runner.
| |
| Installing certbot-crontab.
| |
| </pre>
| |
| | |
| Als nächstes muss man sich bei Let's Encrypt registrieren. Eine Kontakt-Adresse wird erfragt und man muss den Nutzungsbedingungen zustimmen. Dabei wird ein Let's Encrypt Konto erzeugt, dass die angegebene Email-Adresse mit der Certbot-Installation in Relation setzt.
| |
| Die Kontoinformationen werden im Verzeichnis /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot/etc gespeichert und es wird empfohlen diese Daten zu sichern.
| |
| | |
| <pre>
| |
| (certbot)xyz00-doms@myhive:~/certbot/userland-certbot$ bin/certbot-register
| |
| Enter email address (used for urgent notices and lost key recovery) (Enter 'c'
| |
| to cancel):webmaster@example.org
| |
| | |
| -------------------------------------------------------------------------------
| |
| Please read the Terms of Service at
| |
| https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf. You must agree
| |
| in order to register with the ACME server at
| |
| https://acme-v01.api.letsencrypt.org/directory
| |
| -------------------------------------------------------------------------------
| |
| (A)gree/(C)ancel: A
| |
| | |
| IMPORTANT NOTES:
| |
| - If you lose your account credentials, you can recover through
| |
| e-mails sent to webmaster@example.org.
| |
| - Your account credentials have been saved in your Certbot
| |
| configuration directory at
| |
| /home/pacs/pxyz00/users/doms/certbot/userland-certbot/parts/certbot/etc.
| |
| You should make a secure backup of this folder now. This
| |
| configuration directory will also contain certificates and private
| |
| keys obtained by Certbot so making regular backups of this folder
| |
| is ideal.
| |
| </pre>
| |
| | |
| Der Certbot legt während der Zertifikatserstellung eine geheime Datei im Verzeichnis /home/pacs/xyz00/users/pronto/certbot/userland-certbot/parts/certbot/web/.well-known ab, die Let's Encrypt über den Webserver erreichen muss, um sicherzustellen,
| |
| dass der Domain-Admin die erforderlichen Berechtigungen hat. Im hier dokumentierten Fall wird das Standard-Setup bei Hostsharing, also der vorinstallierte Apache als Webserver genutzt.
| |
| Dazu wird ein Symlink zum obengenannten Verzeichnis im Apache Webverzeichnis angelegt. (Evtl. muss das Verzeichnis .well-known vorher angelegt werden.)
| |
| | |
| <pre>
| |
| (certbot)xyz00-doms@myhive:~/certbot/userland-certbot$ cd ~/doms/example.org/subs/www/
| |
| (certbot)xyz00-doms@myhive:~/doms/example.org/subs/www$ mkdir ~/certbot/userland-certbot/parts/certbot/web/.well-known
| |
| (certbot)xyz00-doms@myhive:~/doms/example.org/subs/www$ ln -s ~/certbot/userland-certbot/parts/certbot/web/.well-known .well-known
| |
| </pre>
| |
| | |
| Das Zertifikat wird folgendermaßen erzeugt. (Achtung: Hier sollten alle Domains des Domain-Admins angegeben werden, die evtl. abgesichert werden sollen. Und natürlich muss auch eine Verlinkung zu .wellknown im Apache Webverzeichnis einer jeden Domain angelegt werden. Also z. B. example.org und www.example.org. Sollte im Webverzeichnis eine RewriteRule o. ä. aktiv sein, so muss diese natürlich vorher deaktiviert werden.):
| |
| | |
| <pre>
| |
| (certbot)xyz00-doms@myhive:~/certbot/userland-certbot$ bin/certbot-runner certonly -d example.org -d www.example.org
| |
| 2016-08-16 14:12:19,526:WARNING:certbot.client:Non-standard path(s), might not work with crontab installed by your operating system package manager
| |
| | |
| IMPORTANT NOTES:
| |
| - Congratulations! Your certificate and chain have been saved at
| |
| /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot/etc/live/example.org/fullchain.pem.
| |
| Your cert will expire on 2016-11-14. To obtain a new or tweaked
| |
| version of this certificate in the future, simply run certbot
| |
| again. To non-interactively renew *all* of your certificates, run
| |
| "certbot renew"
| |
| - If you like Certbot, please consider supporting our work by:
| |
| | |
| Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
| |
| Donating to EFF: https://eff.org/donate-le
| |
| | |
| </pre>
| |
| | |
| Nun ist es so, dass Zertifikate bei Hostsharing durch eine E-Mail an service@hostsharing.net aktiviert werden. Dieser Vorgang muss zur Zeit noch "per Hand" initiert werden.
| |
| Außerdem wird von Hostsharing erwartet, einer gewisse Namenskonvention bei der Benennung der Zertifikate und Schlüssel zu folgen. Deshalb Kopiert man die Symlinks ins Verzeichnis "etc" der Domain und bennent die Endungen entsprechend um.
| |
| | |
| <pre>
| |
| cd ~/doms/example.org/etc
| |
| cp ~/certbot/userland-certbot/parts/certbot/etc/live/example.org/cert.pem example.org.crt
| |
| cp ~/certbot/userland-certbot/parts/certbot/etc/live/example.org/chain.pem example.org.chain
| |
| cp ~/certbot/userland-certbot/parts/certbot/etc/live/example.org/privkey.pem example.org.key
| |
| </pre>
| |
| | |
| und schickt eine Mail mit der Bitte um Aktivierung des Zertifikats unter Angabe des Verzeichnisses ~/doms/example.org/etc an service@hostsharing.net.
| |
| | |
| === Automatisierte Verlängerung der Let’s Encrypt Zertifikate ===
| |
| | |
| Let’s Encrypt Zertifikate haben eine Gültigkeit von 3 Monaten. Das ist nicht viel. Wenn die Verlängerungsprozedur automatisiert ist, dann muss man sich auf absehbare Zeit gar nicht mehr kümmern. Buildout ist so konfiguriert, dass ein Cronjob zur Zertifikatserneuerung angelegt wird, der täglich ausgeführt wird. Vor Ablauf des Zertifikats wird ein neues Zertifikat erstellt und ersetzt das alte. Außerdem wird eine Mail an die registrierte Adresse gesendet. Theoretisch sollte man diese Mail an service@hostsharing.net weiterleiten können, um das erneuerte Zertifikat ersetzen zu können. Eine Möglichkeit lässt sich mittels einer Cronjob gesteuerten E-Mail realisieren. Dazu legt man eine Textdatei (z.B. mail.txt) mit ähnlichem Inhalt z. B. im Verzeichnis ~/etc an.
| |
| | |
| <pre>
| |
| Hallo Hostsharing Service
| |
| | |
| Ich bitte um die Neuinstallation des Zertifikats für die Domain example.org.
| |
| | |
| Es liegt im Verzeichnis
| |
| /home/pacs/xyz00/users/doms/certbot/userland-certbot/parts/certbot/etc/live/example.org/
| |
| | |
| | |
| (automatisierte mail)
| |
| | |
| Gruß
| |
| Euer Cronjob
| |
| </pre>
| |
| | |
| Der Cronjob wird beispielsweise folgendermaßen im crontab eingetragen:
| |
| | |
| <pre>
| |
| # email to service@hostsharing.net for installing new cert of domain example.org
| |
| 17 7 8 1,4,7,10 * cat /home/pacs/xyz00/users/doms/etc/email.txt | mail -s"Erneuern von Zertifikat" service@hostsharing.net
| |
| </pre>
| |
| | |
| Der Cronjob soll viermal im Jahr laufen, und sinnvollerweise ca. 2 Wochen vor Ablauf des alten Zertifikats ausgeführt werden.
| |
| | |
| | |
| ----
| |
| [[Kategorie:HSDoku]]
| |
| [[Kategorie:WWW]]
| |
| [[Kategorie:Glossar]]
| |