Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision | ||
ssl-certs [2014/04/26 16:55] – [Android] brot | ssl-certs [2016/10/28 13:09] – rellig | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Informationen über die minad.de SSL-Zertifkikate ====== | ====== Informationen über die minad.de SSL-Zertifkikate ====== | ||
- | minad.de hat - wie jeder ordentliche Server SSL-Zertifikate um SSL-Gesicherten Datenaustausch zu ermöglichen. Zur Zeit verwenden wir selbstsignierte Zertifikate, | + | minad.de hat - wie jeder ordentliche Server SSL-Zertifikate um SSL-Gesicherten Datenaustausch zu ermöglichen. |
- | ===== Import des CA-Zertifikats | + | ===== Zertifikat Neuantrag |
- | Um den Warnungen über das " | + | Neue Zertifikate müssen nur einmal beantragt werden. Dafür hat sich folgender command etabliert: |
- | ==== Linux ==== | + | <file bash - > |
+ | certbot certonly --agree-tos --renew-by-default --email root@minad.de --webroot -w / | ||
+ | </ | ||
+ | |||
+ | Hinweis: Nachdem es ein Limit von 20 renews pro Domain pro Woche gibt (domain in dem fall minad.de oder grilldienstag.de ohne jeweilige sub), bietet es sich an Domains logisch zusammenzufassen. | ||
- | < | + | Deswegen [[ssl_cert_list|hier eine Liste unserer Zertifikate inkl. der Domains für die sie gelten]]. |
- | certutil -d sql:$HOME/.pki/nssdb -A -t " | + | |
- | </ | + | |
- | ==== Windows | + | ===== Zertifikate mit alternativen Namen ===== |
- | - Start -> Ausführen -> " | + | Ein Zertifikat mit alternativen Namen wird ähnlich ausgestellt wie ein Zertifikat für eine Domain. Weitere Domains werden einfach Komma-getrennt an die Option //-d// angehängt. |
- | - Datei -> Snap-In hinzufügen -> Hinzufügen... | + | |
- | | + | |
- | - Doppelklick auf Zertifikate -> Rechtsklick auf " | + | |
- | - Das " | + | |
- | Und schon sollte das Zertifikat importiert sein. Ein Kinderspiel, quasi! | + | <file bash - > |
+ | certbot certonly --agree-tos --renew-by-default --email root@minad.de --webroot -w / | ||
+ | </ | ||
- | ==== Android ==== | + | Die erste Domain bestimmt den Pfad unter dem das Zertifikat gespeichert wird und ist gleichzeitig im Feld " |
+ | Sollen nachträglich weitere alternative Namen eingefügt werden, so nimmt man die __exakt gleiche__ Liste wie beim ausstellen und fügt den neuen Namen ein. Der certbot sollte nun fragen, ob das bestehende Zertifikat erweitert werden soll. Am Besten mit // | ||
- | Android erwartet ein anderes Zertifikatsformat, | + | Zum Überblick [[ssl_cert_list|hier eine Liste unserer Zertifikate inkl. der Domains für die sie gelten]]. |
- | | + | ===== Automatisches Verlängern ===== |
- | Umwandeln könnte. Das wurde allerding schon erledigt | + | Das automatische renewal funktioniert über zwei Systemd-Units inkl. Timer, |
- | Danach - je nach Version - in den " | + | ==== certbot |
- | + | ||
- | ===== Verwendung der Zertifikate auf dem Server | + | |
- | Die Zertifikate liegen im Verzeichnis / | + | |
- | * minad.de-cert.pem | + | <file bash certbot-renew.service> |
- | * minad.de-key.pem | + | [Unit] |
- | * minad.de-chained-nopw.pem | + | Description=Call certbot to renew all certificates |
+ | After=network.target | ||
- | Das -cert ist das x509 Zertifikat. Das -key ist der Passwortverschlüsselte key. Unter Chained ist erst der nicht mit Passwort versehene Key, und dann das Zertifikat abgelegt. Letzeres ist die von den Serverdiensten verwendete Datei, da sonst bei jedem Neustart das Passwort eingegeben werden müsste. | + | [Service] |
- | + | User=root | |
- | + | Type=oneshot | |
- | ==== lighttpd ==== | + | ExecStart=/usr/bin/certbot renew |
- | + | ||
- | <file - / | + | |
- | $SERVER[" | + | |
- | ssl.engine | + | |
- | + | ||
- | | + | |
- | ssl.ca-file | + | |
- | + | ||
- | + | ||
- | | + | |
- | + | ||
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | } | + | |
</ | </ | ||
- | ==== Postfix/ | + | <file bash certbot-renew.timer> |
+ | [Unit] | ||
+ | Description=Timer for the sslscript - currently daily | ||
- | <file - / | + | [Timer] |
- | # we wannt secure connections | + | OnCalendar=Wed *-*-* 10:07:00 |
- | smtpd_tls_security_level | + | |
- | smtpd_tls_auth_only = yes | + | |
- | #new certs minad_selfsigned_v3 25.04 | + | [Install] |
- | smtpd_tls_cert_file | + | WantedBy=timer.target |
- | smtpd_tls_key_file = $smtpd_tls_cert_file | + | |
- | + | ||
- | + | ||
- | #we want high encryption | + | |
- | # | + | |
- | smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5 | + | |
- | smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3 | + | |
- | + | ||
- | #ecliptic curve crypto? we has it | + | |
- | smtpd_tls_dh1024_param_file = / | + | |
- | smtpd_tls_dh512_param_file = / | + | |
- | smtpd_tls_eecdh_grade = strong | + | |
- | + | ||
- | # outgoing mails shall also use tls | + | |
- | smtp_tls_security_level = may | + | |
- | smtp_tls_loglevel = 1 | + | |
</ | </ | ||
- | <file - / | + | ==== sslscript ==== |
- | ## | + | |
- | ## SSL settings | + | |
- | ## | + | |
- | # SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt> | + | Das Skript dass das für den lighty zusammenpastet und kopiert siehe [[https:// |
- | ssl = required | + | |
- | # PEM encoded X.509 SSL/TLS certificate and private key. They' | + | <file bash sslscript.service> |
- | # dropping root privileges, so keep the key file unreadable by anyone but | + | [Unit] |
- | # root. Included doc/ | + | Description=Check if there are renewed SSL-Certs and convert them for lighty |
- | # certificate, | + | After=network.target |
- | ssl_cert | + | [Service] |
- | ssl_key | + | User=root |
+ | Type=oneshot | ||
+ | ExecStart=/root/sslscript/sslscript.sh | ||
</ | </ | ||
- | ===== Erstellen der CA und der Zertifikate ===== | + | <file bash sslscript.timer> |
- | <file bash -> | + | [Unit] |
+ | Description=Timer for the sslscript | ||
- | minad minad_selfsigned_v3 # / | + | [Timer] |
- | CA certificate filename (or enter to create) | + | OnCalendar=Tue *-*-* 10:07:00 |
- | + | ||
- | Making CA certificate ... | + | |
- | Generating a 8192 bit RSA private key | + | |
- | .......................................................................................................................................................................++ | + | |
- | .......................................................................................................................................................................................................................++ | + | |
- | writing new private key to ' | + | |
- | Enter PEM pass phrase: | + | |
- | Verifying | + | |
- | ----- | + | |
- | You are about to be asked to enter information that will be incorporated | + | |
- | into your certificate request. | + | |
- | What you are about to enter is what is called a Distinguished Name or a DN. | + | |
- | There are quite a few fields but you can leave some blank | + | |
- | For some fields there will be a default value, | + | |
- | If you enter ' | + | |
- | ----- | + | |
- | Country Name (2 letter code) [DE]: | + | |
- | State or Province Name (full name) [Bavaria]: | + | |
- | Locality Name (eg, city) []: | + | |
- | Organization Name (eg, company) [minad]: | + | |
- | Organizational Unit Name (eg, section) []: | + | |
- | first Common Name (eg, YOUR name) [minad.de]: | + | |
- | Email Address [root@minad.de]: | + | |
- | Please enter the following ' | + | [Install] |
- | to be sent with your certificate request | + | WantedBy=timer.target |
- | A challenge password | + | |
- | An optional company name []: | + | |
- | Using configuration from / | + | |
- | Enter pass phrase for ./ | + | |
- | Check that the request matches the signature | + | |
- | Signature ok | + | |
- | Certificate Details: | + | |
- | Serial Number: 14186275591684022291 (0xc4dfc67d101ee013) | + | |
- | Validity | + | |
- | Not Before: Apr 25 09:10:49 2014 GMT | + | |
- | Not After : Apr 22 09:10:49 2024 GMT | + | |
- | Subject: | + | |
- | countryName | + | |
- | stateOrProvinceName | + | |
- | organizationName | + | |
- | commonName | + | |
- | emailAddress | + | |
- | X509v3 extensions: | + | |
- | X509v3 Subject Key Identifier: | + | |
- | 29: | + | |
- | X509v3 Authority Key Identifier: | + | |
- | keyid: | + | |
- | + | ||
- | X509v3 Basic Constraints: | + | |
- | CA:TRUE | + | |
- | Certificate is to be certified until Apr 22 09:10:49 2024 GMT (3650 days) | + | |
- | + | ||
- | Write out database with 1 new entries | + | |
- | Data Base Updated | + | |
- | minad minad_selfsigned_v3 # / | + | |
- | Generating a 8192 bit RSA private key | + | |
- | .................................++ | + | |
- | ...........................................................................................................................................................................................................................................................................................................++ | + | |
- | writing new private key to ' | + | |
- | Enter PEM pass phrase: | + | |
- | Verifying - Enter PEM pass phrase: | + | |
- | ----- | + | |
- | You are about to be asked to enter information that will be incorporated | + | |
- | into your certificate request. | + | |
- | What you are about to enter is what is called a Distinguished Name or a DN. | + | |
- | There are quite a few fields but you can leave some blank | + | |
- | For some fields there will be a default value, | + | |
- | If you enter ' | + | |
- | ----- | + | |
- | Country Name (2 letter code) [DE]: | + | |
- | State or Province Name (full name) [Bavaria]: | + | |
- | Locality Name (eg, city) []: | + | |
- | Organization Name (eg, company) [minad]: | + | |
- | Organizational Unit Name (eg, section) []: | + | |
- | first Common Name (eg, YOUR name) [minad.de]: | + | |
- | Email Address [root@minad.de]: | + | |
- | + | ||
- | Please enter the following ' | + | |
- | to be sent with your certificate request | + | |
- | A challenge password []: | + | |
- | An optional company name []: | + | |
- | Request is in newreq.pem, private key is in newkey.pem | + | |
- | minad minad_selfsigned_v3 # rm newreq.pem | + | |
- | minad minad_selfsigned_v3 # mv newkey.pem minad.de-key.pem | + | |
- | minad minad_selfsigned_v3 # mv newcert.pem minad.de-cert.pem | + | |
- | minad minad_selfsigned_v3 # openssl rsa -in minad.de-key.pem -out minad.de-chained-nopw.pem | + | |
- | Enter pass phrase for minad.de-key.pem: | + | |
- | writing RSA key | + | |
- | minad minad_selfsigned_v3 # openssl x509 -in minad.de-cert.pem >> minad.de-chained-nopw.pem | + | |
- | minad minad_selfsigned_v3 # ln -sv demoCA/ | + | |
</ | </ | ||
- | |||
- | |||
- | |||