ssl-certs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ssl-certs [2014/04/26 17:02] – [lighttpd] brotssl-certs [2016/10/28 13:12] (current) – [Zertifikate mit alternativen Namen] 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, d.h wir haben eine eigene CA, die die minad.de Zertifikate bestätigt.+minad.de hat - wie jeder ordentliche Server SSL-Zertifikate um SSL-Gesicherten Datenaustausch zu ermöglichen. <del>Zur Zeit verwenden wir selbstsignierte Zertifikate, d.h wir haben eine eigene CA, die die minad.de Zertifikate bestätigt.</del> Wie jeder vernünftige Mensch verwendet minad jetzt [[https://letsencrypt.org/|Let's Encrypt]].
  
-===== Import des CA-Zertifikats =====+===== Zertifikat Neuantrag =====
  
-Um den Warnungen über das "Unbekannte Zertifikat" aus dem Weg zu gehen, muss man dem CA-Zertifikat vertrauenDas macht man in dem man [[https://brot.minad.de/cacert.pem|Das CA-Zertifikat]] herunterläd (MD5: bbe87ea5d86c7b3764973a8c88583aa7) und im Betriebssystem importiert+Neue Zertifikate müssen nur einmal beantragt werdenDafür hat sich folgender command etabliert:
  
-==== Linux ==== +<file bash - > 
- +certbot certonly --agree-tos --renew-by-default --email root@minad.de --webroot -w /var/www/letsencrypt -d brot.minad.de
-<nowiki> +
-certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n minad -i cacert.pem +
-</nowiki+
- +
-==== Windows ==== +
-  Start -> Ausführen -> "mmc" +
-  Datei -> Snap-In hinzufügen -> Hinzufügen... +
-  Zertifikate in der Liste auswählen -> "Eigener Benutzer" -> Ok +
-  - Doppelklick auf Zertifikate -> Rechtsklick auf "Vertrauenswürdige Stammzertifikatstellen" -> Alle Aufgaben -> Importieren +
-  - Das "cacert.pem" auswählen -> Weiter... +
- +
-Und schon sollte das Zertifikat importiert sein. Ein Kinderspiel, quasi! +
- +
-==== Android ==== +
- +
-Android erwartet ein anderes Zertifikatsformat, das man mit +
- +
-   openssl x509 -inform PEM -outform DER -in cacert.pem -out minad_cacert.crt +
- +
-Umwandeln könnte. Das wurde allerding schon erledigt und kann [[http://brot.minad.de/minad_cacert.crt| hier komfortabel heruntergeladen werden.]]  ( MD5SUM: 60bda4d62ce8ec7238e154cb3485e193  minad_cacert.crt ) +
- +
-Danach je nach Version  in den "Einstellungen" über "Sicherheit" auf "Von Speicher installieren" wählen. +
-    +
-===== Verwendung der Zertifikate auf dem Server ===== +
-Die Zertifikate liegen im Verzeichnis /etc/ssl/minad_selfsigned_v4/. Darin gibt es: +
- +
-  * minad.de-cert.pem +
-  * minad.de-key.pem +
-  * minad.de-chained-nopw.pem +
- +
-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. +
- +
- +
-==== lighttpd ==== +
- +
-<file - /etc/lighttpd/lighttpd.conf> +
-$SERVER["socket"] == ":443"+
- ssl.engine    = "enable" +
- +
- ssl.pemfile = "/etc/ssl/minad_selfsigned_v4/minad.de-chained-nopw.pem" +
- ssl.ca-file = "/etc/ssl/minad_selfsigned_v4/cacert.pem" +
- +
- +
- ssl.cipher-list = "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-RC4-SHA:ECDHE-RSA-RC4-$ +
- +
- ssl.dh-file = "/etc/ssl/minad.de_selfsigned/dh2048.pem" +
- ssl.ec-curve = "secp384r1" +
- ssl.honor-cipher-order = "enable" +
- +
-}+
 </file> </file>
 +  
 +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.
  
-==== Postfix/dovecot ====+Deswegen [[ssl_cert_list|hier eine Liste unserer Zertifikate inkl. der Domains für die sie gelten]].
  
-<file - /etc/postfix/main.cf> +===== Zertifikate mit alternativen Namen ===== 
-# we wannt secure connections +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. Maximal 100 Domains können in einem Zertifikat gespeichert werden. Mit den 20 Domains pro Woche ergeben sich so 2000 geschützte Seiten.
-smtpd_tls_security_level = may +
-smtpd_tls_auth_only = yes+
  
-#new certs minad_selfsigned_v3 25.04 +<file bash - > 
-smtpd_tls_cert_file = /etc/ssl/minad_selfsigned_v3/minad.de-chained-nopw.pem +certbot certonly --agree-tos --renew-by-default --email root@minad.de --webroot -w /var/www/letsencrypt -d rellig.minad.de,wasser.minad.de,paste.minad.de
-smtpd_tls_key_file =  $smtpd_tls_cert_file +
- +
- +
-#we want high encryption +
-#smtpd_tls_mandatory_ciphers = high +
-smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5 +
-smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3 +
- +
-#ecliptic curve crypto? we has it +
-smtpd_tls_dh1024_param_file = /etc/postfix/dh_1024.pem +
-smtpd_tls_dh512_param_file = /etc/postfix/dh_512.pem +
-smtpd_tls_eecdh_grade = strong +
- +
-# outgoing mails shall also use tls +
-smtp_tls_security_level = may +
-smtp_tls_loglevel = 1+
 </file> </file>
  
-<file - /etc/dovecot/conf.d/10-ssl.conf> +Die erste Domain bestimmt den Pfad unter dem das Zertifikat gespeichert wird und ist gleichzeitig im Feld "Ausgestellt für" gespeichert.\\ 
-## +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 //--dry-run// testen.\\
-## SSL settings +
-##+
  
-# SSL/TLS support: yes, no, required<doc/wiki/SSL.txt> +Zum Überblick [[ssl_cert_list|hier eine Liste unserer Zertifikate inklder Domains für die sie gelten]].
-ssl = required+
  
-# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before +===== Automatisches Verlängern =====
-# dropping root privileges, so keep the key file unreadable by anyone but +
-# root. Included doc/mkcert.sh can be used to easily generate self-signed +
-# certificate, just make sure to update the domains in dovecot-openssl.cnf+
  
-ssl_cert = </etc/ssl/minad_selfsigned_v3/minad.de-chained-nopw.pem +Das automatische renewal funktioniert über zwei Systemd-Units inklTimer, und ein Skript dass die Zertifikate für lighty zusammenbaut.
-ssl_key = </etc/ssl/minad_selfsigned_v3/minad.de-chained-nopw.pem +
-</file>+
  
-===== Erstellen der CA und der Zertifikate =====+==== certbot ====
  
-==== Einstellungen der openssl.cnf ==== +<file bash certbot-renew.service> 
-Die Einstellungen betreffen primär die vorgegebenen Werte, sowie das erstellen von Zertifikaten mit SAN (subject alternate names). Möchte man ein Zertifikat für mehr als eine Domain ausstellen, so geht das mit der besagten Erweiterung.+[Unit] 
 +Description=Call certbot to renew all certificates 
 +After=network.target
  
-In der CA_default Sektion: +[Service
- +User=root 
-<file - /etc/ssl/openssl.cnf> +Type=oneshot 
-CA_default +ExecStart=/usr/bin/certbot renew
-(...) +
-# Extension copying option: use with caution. +
- copy_extensions copy +
-(...) +
-default_days    3650                  # how long to certify for +
-default_crl_days30                    # how long before next CRL +
-default_md      = default               # use public key default MD +
-preserve        = no                    # keep passed DN ordering+
 </file> </file>
  
-Und in der "request" Sektion +<file bash certbot-renew.timer
-<file - /etc/ssl/openssl.cnf+[Unit
-req +Description=Timer for the sslscript - currently daily
-default_bits            8192 +
-default_keyfile         = privkey.pem +
-distinguished_name      = req_distinguished_name +
-attributes              = req_attributes +
-x509_extensions = v3_ca # The extentions to add to the self signed cert+
  
-# brot - subject alternate name +[Timer] 
-req_extensions v3_req # The extensions to add to a certificate request+OnCalendar=Wed *-*-* 10:07:00
  
-(...) +[Install
- +WantedBy=timer.target
-req_distinguished_name +
-countryName                     Country Name (2 letter code) +
-countryName_default             = DE +
-countryName_min                 = 2 +
-countryName_max                 = 2 +
- +
-stateOrProvinceName             = State or Province Name (full name) +
-stateOrProvinceName_default     = Bavaria +
- +
-localityName                    = Locality Name (eg, city) +
- +
-0.organizationName              = Organization Name (eg, company) +
-0.organizationName_default      = minad +
- +
-# we can do this but it is not needed normally :-) +
-#1.organizationName             = Second Organization Name (eg, company) +
-#1.organizationName_default     = World Wide Web Pty Ltd +
- +
-organizationalUnitName          = Organizational Unit Name (eg, section) +
-#organizationalUnitName_default = +
- +
-0.commonName                    = first Common Name (eg, YOUR name) +
-0.commonName_max                = 64 +
-0.commonName_default            = minad.de +
- +
-emailAddress                    = Email Address +
-emailAddress_max                = 64 +
-emailAddress_default            = root@minad.de +
- +
-(...)+
 </file> </file>
  
-Und für die SANs an sich folgender Eintrag: +==== sslscript ====
-<file - /etc/ssl/openssl.cnf> +
-[ v3_req ]+
  
-# Extensions to add to a certificate request+Das Skript dass das für den lighty zusammenpastet und kopiert siehe [[https://gitlab.minad.de/brot/sslscript|das sslscript Gitlab repo]].
  
-basicConstraints CA:FALSE +<file bash sslscript.service> 
-keyUsage nonRepudiation, digitalSignature, keyEncipherment+[Unit] 
 +Description=Check if there are renewed SSL-Certs and convert them for lighty 
 +After=network.target
  
-# brot - subject alt name +[Service] 
-subjectAltName DNS:*.minad.de, DNS:echorulez.de, DNS:*.echorulez.de+User=root 
 +Type=oneshot 
 +ExecStart=/root/sslscript/sslscript.sh
 </file> </file>
  
 +<file bash sslscript.timer>
 +[Unit]
 +Description=Timer for the sslscript - currently daily
  
-<file bash ->+[Timer] 
 +OnCalendar=Tue *-*-* 10:07:00
  
-minad minad_selfsigned_v3 # /etc/ssl/misc/CA.pl -newca                                                                                                                                                                                                                          +[Install
-CA certificate filename (or enter to create)                                                                                                                                                                                                                                    +WantedBy=timer.target
-                                                                                                                                                                                                                                                                                +
-Making CA certificate ...                                                                                                                                                                                                                                                       +
-Generating a 8192 bit RSA private key                                                                                                                                                                                                                                           +
-.......................................................................................................................................................................++                                                                                                       +
-.......................................................................................................................................................................................................................++                                                       +
-writing new private key to './demoCA/private/cakey.pem'                                                                                                                                                                                                                         +
-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 '.', the field will be left blank. +
------ +
-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 'extra' attributes +
-to be sent with your certificate request +
-A challenge password []: +
-An optional company name []: +
-Using configuration from /etc/ssl/openssl.cnf +
-Enter pass phrase for ./demoCA/private/cakey.pem: +
-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               DE +
-            stateOrProvinceName       = Bavaria +
-            organizationName          = minad +
-            commonName                = minad.de +
-            emailAddress              = root@minad.de +
-        X509v3 extensions: +
-            X509v3 Subject Key Identifier:  +
-                29:9E:B7:29:CB:7F:2A:A6:5F:A7:B6:D4:12:89:37:2D:EA:23:73:B8 +
-            X509v3 Authority Key Identifier:  +
-                keyid:29:9E:B7:29:CB:7F:2A:A6:5F:A7:B6:D4:12:89:37:2D:EA:23:73:B8 +
- +
-            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 # /etc/ssl/misc/CA.pl -newreq +
-Generating a 8192 bit RSA private key +
-.................................++ +
-...........................................................................................................................................................................................................................................................................................................++ +
-writing new private key to 'newkey.pem' +
-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 '.', the field will be left blank. +
------ +
-Country Name (2 letter code) [DE]: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 'extra' attributes +
-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/cacert.pem ./+
 </file> </file>
- 
- 
- 
  
  • ssl-certs.1398531732.txt.gz
  • Last modified: 2014/04/26 17:02
  • by brot