Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
centos:mail_c7:dovecot_4 [25.07.2014 20:00. ] – [manuelle Erstellung unserer eigenen CA] djangocentos:mail_c7:dovecot_4 [22.07.2019 14:48. ] (aktuell) – [Links] django
Zeile 141: Zeile 141:
 </code> </code>
  
-==== Cipher-Suites und Diffie-Hellmann ====+==== Cipher-Suites und Diffie-Hellman ====
 Möchte man in Erfahrung bringen, welche Cipher-Suites((Sammlung von standardisierten kryptographischer Algorithmen)) unser installiertes OpenSSL-Paket mitbringt, können wir wie folgt abfragen((Ausgabe in formatierter Tabelle)). Möchte man in Erfahrung bringen, welche Cipher-Suites((Sammlung von standardisierten kryptographischer Algorithmen)) unser installiertes OpenSSL-Paket mitbringt, können wir wie folgt abfragen((Ausgabe in formatierter Tabelle)).
    # openssl ciphers -v    # openssl ciphers -v
Zeile 682: Zeile 682:
  
 <html><pre class="code"> <html><pre class="code">
-<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl rsa <cakey.pem >cakey_ohne_passphrase.pem</font>+<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl rsa &lt;cakey.pem &gt;cakey_ohne_passphrase.pem</font>
 </pre></html> </pre></html>
 <html><pre class="code"> <html><pre class="code">
Zeile 1072: Zeile 1072:
 Wie schon erwähnt, entfernen wir die Passphrase nun wieder, in dem wir bei der Frage **Enter pass phrase:** einfach die Taste **[ENTER]** drücken. Wie schon erwähnt, entfernen wir die Passphrase nun wieder, in dem wir bei der Frage **Enter pass phrase:** einfach die Taste **[ENTER]** drücken.
 <html><pre class="code"> <html><pre class="code">
-<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl rsa <serverkey.pem >serverkey_2.pem</font>+<font style="color: rgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl rsa -in serverkey.pem -out serverkey_2.pem</font>
 </pre></html> </pre></html>
 <html><pre class="code"> <html><pre class="code">
Zeile 1233: Zeile 1233:
  
 ==== eigene CA: CSR beabeiten - Zertifikat erstellen ==== ==== eigene CA: CSR beabeiten - Zertifikat erstellen ====
-Bevor wir nun unser eigenes Zertifikat mit Hilfe unserer eigenen **CA** signieren könnenpassen wir in der OpenSSL-Konfigurationsdatei die Laufzeit **default_days** an, da wir diese nicht auf der Komandozeile übergeben können. +Kommen wir zum krönenden Abschluss - wir signieren nun das Server-Zertifikat durch unsere CA, oder anders ausgedrückt, wir erstellen das benötigte **X.509**-Serverzertifikat
-   # vim /etc/pki/tls/openssl.cnf +
-<file bash /etc/pki/tls/openssl.cnf># +
-# OpenSSL example configuration file. +
-# This is mostly being used for generation of certificate requests. +
-#+
  
-# This definition stops the following lines choking if HOME isn'+Wie schon bereits bei den anderen Konfigurationsbeispielen, sind auch hier die Eingaben in der Farbe <html><font style="color: rgb(0, 0, 255)">blau</font></html> und die Rückmeldungen in der Farbe <html><font style="colorrgb(0, 255, 0)">grün</font></html> gekennzeichnet
-# defined. +
-HOME +
-RANDFILE $ENV::HOME/.rnd+
  
-# Extra OBJECT IDENTIFIER info: +<html><pre class="code"> 
-#oid_file $ENV::HOME/.oid +<font style="colorrgb(0, 0, 0)"># </font><font style="color: rgb(0, 0, 255)">openssl ca -in csr.pem -notext -out servercert.pem</font
-oid_section = new_oids +</pre></html> 
- +<html><pre class="code"> 
-# To use this configuration file with the "-extfileoption of the +<font style="color: rgb(0, 255, 0)">Using configuration from /etc/pki/tls/openssl.cnf 
-# "openssl x509" utility, name here the section containing the +Enter pass phrase for /etc/pki/CA/private/cakey.pem: </font><font style="color: rgb(0, 0, 255)">des-woas-blos-I-und-sundst-koana</font> 
-# X.509v3 extensions to use: +<font style="color: rgb(0, 255, 0)">Check that the request matches the signature
-# extensions  +
-# (Alternatively, use a configuration file that has only +
-# X.509v3 extensions in its main [= default] section.) +
- +
-[ new_oids ] +
- +
-# We can add new OIDs in here for use by 'ca', 'req' and 'ts'+
-# Add a simple OID like this: +
-# testoid1=1.2.3.4 +
-# Or use config file substitution like this: +
-# testoid2=${testoid1}.5.6 +
- +
-# Policies used by the TSA examples. +
-tsa_policy1 = 1.2.3.4.1 +
-tsa_policy2 = 1.2.3.4.5.6 +
-tsa_policy3 = 1.2.3.4.5.7 +
- +
-#################################################################### +
-[ ca ] +
-default_ca = CA_default # The default ca section +
- +
-#################################################################### +
-[ CA_default ] +
- +
-dir = /etc/pki/CA # Where everything is kept +
-certs = $dir/certs # Where the issued certs are kept +
-crl_dir = $dir/crl # Where the issued crl are kept +
-database = $dir/index.txt # database index file. +
-#unique_subject = no # Set to 'no' to allow creation of +
- # several ctificates with same subject. +
-new_certs_dir = $dir/newcerts # default place for new certs. +
- +
-certificate = $dir/cacert.pem # The CA certificate +
-serial = $dir/serial # The current serial number +
-crlnumber = $dir/crlnumber # the current crl number +
- # must be commented out to leave a V1 CRL +
-crl = $dir/crl.pem # The current CRL +
-private_key = $dir/private/cakey.pem# The private key +
-RANDFILE = $dir/private/.rand # private random number file +
- +
-x509_extensions = usr_cert # The extentions to add to the cert +
- +
-# Comment out the following two lines for the "traditional" +
-# (and highly broken) format. +
-name_opt = ca_default # Subject Name options +
-cert_opt = ca_default # Certificate field options +
- +
-# Extension copying optionuse with caution. +
-# copy_extensions = copy +
- +
-# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs +
-# so this is commented out by default to leave a V1 CRL. +
-# crlnumber must also be commented out to leave a V1 CRL. +
-# crl_extensions = crl_ext +
- +
-# Django : 2014-07-23 +
-# default: default_days    = 365        # how long to certify for (one year) +
-default_days = 730 # how long to certify for (two years) +
-default_crl_days= 30 # how long before next CRL +
-default_md = sha256 # use SHA-256 by default +
-preserve = no # keep passed DN ordering +
- +
-# A few difference way of specifying how similar the request should look +
-# For type CAthe listed attributes must be the same, and the optional +
-# and supplied fields are just that :-) +
-policy = policy_match +
- +
-# For the CA policy +
-[ policy_match ] +
-countryName = match +
-stateOrProvinceName = match +
-organizationName = match +
-organizationalUnitName = optional +
-commonName = supplied +
-emailAddress = optional +
- +
-# For the 'anything' policy +
-# At this point in time, you must list all acceptable 'object' +
-# types. +
-[ policy_anything ] +
-countryName = optional +
-stateOrProvinceName = optional +
-localityName = optional +
-organizationName = optional +
-organizationalUnitName = optional +
-commonName = supplied +
-emailAddress = optional +
- +
-#################################################################### +
-[ req ] +
-default_bits = 2048 +
-default_md = sha256 +
-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 +
- +
-# Passwords for private keys if not present they will be prompted for +
-# input_password = secret +
-# output_password = secret +
- +
-# This sets a mask for permitted string types. There are several options.  +
-# default: PrintableString, T61String, BMPString. +
-# pkix : PrintableString, BMPString (PKIX recommendation before 2004) +
-# utf8only: only UTF8Strings (PKIX recommendation after 2004). +
-# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings). +
-# MASK:XXXX a literal mask value. +
-# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings. +
-string_mask = utf8only +
- +
-# req_extensions = v3_req # The extensions to add to a certificate request +
- +
-[ req_distinguished_name ] +
-countryName = Country Name (2 letter code) +
-countryName_default = XX +
-countryName_min = 2 +
-countryName_max = 2 +
- +
-stateOrProvinceName = State or Province Name (full name) +
-#stateOrProvinceName_default = Default Province +
- +
-localityName = Locality Name (eg, city) +
-localityName_default = Default City +
- +
-0.organizationName = Organization Name (egcompany) +
-0.organizationName_default = Default Company Ltd +
- +
-# 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 = +
- +
-commonName = Common Name (eg, your name or your server\'s hostname) +
-commonName_max = 64 +
- +
-emailAddress = Email Address +
-emailAddress_max = 64 +
- +
-# SET-ex3 = SET extension number 3 +
- +
-[ req_attributes ] +
-challengePassword = A challenge password +
-challengePassword_min = 4 +
-challengePassword_max = 20 +
- +
-unstructuredName = An optional company name +
- +
-[ usr_cert ] +
- +
-# These extensions are added when 'ca' signs a request. +
- +
-# This goes against PKIX guidelines but some CAs do it and some software +
-# requires this to avoid interpreting an end user certificate as a CA. +
- +
-basicConstraints=CA:FALSE +
- +
-# Here are some examples of the usage of nsCertType. If it is omitted +
-# the certificate can be used for anything *except* object signing. +
- +
-# This is OK for an SSL server. +
-# nsCertType = server +
- +
-# For an object signing certificate this would be used. +
-# nsCertType = objsign +
- +
-# For normal client use this is typical +
-# nsCertType = client, email +
- +
-# and for everything including object signing: +
-# nsCertType = client, email, objsign +
- +
-# This is typical in keyUsage for a client certificate. +
-# keyUsage = nonRepudiation, digitalSignature, keyEncipherment +
- +
-# This will be displayed in Netscape's comment listbox. +
-nsComment = "OpenSSL Generated Certificate" +
- +
-PKIX recommendations harmless if included in all certificates. +
-subjectKeyIdentifier=hash +
-authorityKeyIdentifier=keyid,issuer +
- +
-# This stuff is for subjectAltName and issuerAltname. +
-# Import the email address. +
-# subjectAltName=email:copy +
-# An alternative to produce certificates that aren'+
-# deprecated according to PKIX. +
-# subjectAltName=email:move +
- +
-# Copy subject details +
-# issuerAltName=issuer:copy +
- +
-#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem +
-#nsBaseUrl +
-#nsRevocationUrl +
-#nsRenewalUrl +
-#nsCaPolicyUrl +
-#nsSslServerName +
- +
-# This is required for TSA certificates. +
-# extendedKeyUsage = critical,timeStamping +
- +
-[ v3_req ] +
- +
-# Extensions to add to a certificate request +
- +
-basicConstraints = CA:FALSE +
-keyUsage = nonRepudiation, digitalSignature, keyEncipherment +
- +
-[ v3_ca ] +
- +
- +
-# Extensions for a typical CA +
- +
- +
-# PKIX recommendation. +
- +
-subjectKeyIdentifier=hash +
- +
-authorityKeyIdentifier=keyid:always,issuer +
- +
-# This is what PKIX recommends but some broken software chokes on critical +
-# extensions. +
-#basicConstraints = critical,CA:true +
-# So we do this instead. +
-basicConstraints = CA:true +
- +
-# Key usage: this is typical for a CA certificate. However since it will +
-# prevent it being used as an test self-signed certificate it is best +
-# left out by default. +
-# keyUsage = cRLSign, keyCertSign +
- +
-# Some might want this also +
-# nsCertType = sslCA, emailCA +
- +
-# Include email address in subject alt name: another PKIX recommendation +
-# subjectAltName=email:copy +
-# Copy issuer details +
-# issuerAltName=issuer:copy +
- +
-# DER hex encoding of an extension: beware experts only! +
-# obj=DER:02:03 +
-# Where 'obj' is a standard or added object +
-# You can even override a supported extension: +
-# basicConstraints= critical, DER:30:03:01:01:FF +
- +
-[ crl_ext ] +
- +
-# CRL extensions. +
-# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL. +
- +
-# issuerAltName=issuer:copy +
-authorityKeyIdentifier=keyid:always +
- +
-[ proxy_cert_ext ] +
-# These extensions should be added when creating a proxy certificate +
- +
-# This goes against PKIX guidelines but some CAs do it and some software +
-# requires this to avoid interpreting an end user certificate as a CA. +
- +
-basicConstraints=CA:FALSE +
- +
-# Here are some examples of the usage of nsCertType. If it is omitted +
-# the certificate can be used for anything *except* object signing. +
- +
-# This is OK for an SSL server. +
-# nsCertType = server +
- +
-# For an object signing certificate this would be used. +
-# nsCertType = objsign +
- +
-# For normal client use this is typical +
-# nsCertType = client, email +
- +
-# and for everything including object signing: +
-# nsCertType = client, email, objsign +
- +
-# This is typical in keyUsage for a client certificate. +
-# keyUsage = nonRepudiation, digitalSignature, keyEncipherment +
- +
-# This will be displayed in Netscape's comment listbox. +
-nsComment = "OpenSSL Generated Certificate" +
- +
-# PKIX recommendations harmless if included in all certificates. +
-subjectKeyIdentifier=hash +
-authorityKeyIdentifier=keyid,issuer +
- +
-# This stuff is for subjectAltName and issuerAltname. +
-# Import the email address. +
-# subjectAltName=email:copy +
-# An alternative to produce certificates that aren'+
-# deprecated according to PKIX. +
-# subjectAltName=email:move +
- +
-# Copy subject details +
-# issuerAltName=issuer:copy +
- +
-#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem +
-#nsBaseUrl +
-#nsRevocationUrl +
-#nsRenewalUrl +
-#nsCaPolicyUrl +
-#nsSslServerName +
- +
-# This really needs to be in place for it to be a proxy certificate. +
-proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo +
- +
-#################################################################### +
-[ tsa ] +
- +
-default_tsa = tsa_config1 # the default TSA section +
- +
-[ tsa_config1 ] +
- +
-# These are used by the TSA reply generation only. +
-dir = ./demoCA # TSA root directory +
-serial = $dir/tsaserial # The current serial number (mandatory) +
-crypto_device = builtin # OpenSSL engine to use for signing +
-signer_cert = $dir/tsacert.pem # The TSA signing certificate +
- # (optional) +
-certs = $dir/cacert.pem # Certificate chain to include in reply +
- # (optional) +
-signer_key = $dir/private/tsakey.pem # The TSA private key (optional) +
- +
-default_policy = tsa_policy1 # Policy if request did not specify it +
- # (optional) +
-other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional) +
-digests = sha1, sha256, sha384, sha512 # Acceptable message digests (mandatory) +
-accuracy = secs:1, millisecs:500, microsecs:100 # (optional) +
-clock_precision_digits  = 0 # number of digits after dot. (optional) +
-ordering = yes # Is ordering defined for timestamps? +
- # (optional, default: no) +
-tsa_name = yes # Must the TSA name be included in the reply? +
- # (optional, default: no) +
-ess_cert_id_chain = no # Must the ESS cert id chain be included? +
- # (optional, default: no) +
-</file> +
- +
-Außerdem verschieben wir den privaten Schlüssel unserer CA nach **/etc/pki/CA/private/**. +
-   # mv /etc/pki/CA/cakey.pem /etc/pki/CA/private/ +
- +
-Kommen wir zum krönenden Abschluss - wir signieren nun das Server-Zertifikat durch unsere CA.  +
- +
-Auch hier sind die Eingaben in der Farbe <html><font style="color: rgb(0, 0, 255)">blau</font></html> und die Rückmeldungen in der Farbe <html><font style="color: rgb(0, 255, 0)">grün</font></html> gekennzeichnet.  +
- +
-   # openssl ca -in csr.pem -notext -out servercert.pem +
-<code>Using configuration from /etc/pki/tls/openssl.cnf +
-Enter pass phrase for /etc/pki/CA/private/cakey.pem: des-woas-blos-I-und-sundst-koana +
-Check that the request matches the signature+
 Signature ok Signature ok
 Certificate Details: Certificate Details:
Zeile 1626: Zeile 1268:
  
 Certificate is to be certified until Jul 22 13:00:41 2016 GMT (730 days) Certificate is to be certified until Jul 22 13:00:41 2016 GMT (730 days)
-Sign the certificate? [y/n]:y+Sign the certificate? [y/n]:</font></font><font style="color: rgb(0, 0, 255)">y</font> 
 +<font style="color: rgb(0, 255, 0)">
  
 +1 out of 1 certificate requests certified, commit? [y/n]</font></font><font style="color: rgb(0, 0, 255)">y</font>
 +<font style="color: rgb(0, 255, 0)">Write out database with 1 new entries
 +Data Base Updated</font>
 +</pre></html>
  
-1 out of 1 certificate requests certified, commit? [y/n]y +===== Zertifikat- und Schlüsseldatei ===== 
-Write out database with 1 new entries +==== Speicherort ====
-Data Base Updated +
-</code> +
- +
-==== Schlüsseldateien ablegen ====+
 Bei der Dovecot-Installation wurde bereits der Unterordner für das Dovecot-Zertifikates und der zugehörigen Schlüssel-Datei unter **/etc/pki** angelegt. Bei der Dovecot-Installation wurde bereits der Unterordner für das Dovecot-Zertifikates und der zugehörigen Schlüssel-Datei unter **/etc/pki** angelegt.
 <code>/etc/pki/dovecot/ <code>/etc/pki/dovecot/
Zeile 1645: Zeile 1288:
  
 Anschließend legen wir dort die drei benötigten Dateien ab: Anschließend legen wir dort die drei benötigten Dateien ab:
-  - unseren //Serverzertifikat// : **servercert.pem** +  - unseren //Serverzertifikat// : **servercert.pem** <code> # mv /etc/pki/CA/servercert.pem /etc/pki/dovecot/certs/servercert_2014-08-14.pem</code> 
-  - unseren //Serverschlüssel// : **serverkey.pem** und +  - unseren //Serverschlüssel// : **serverkey.pem** <code> # mv /etc/pki/CA/serverkey.pem /etc/pki/dovecot/private/serverkey_2014-08-14.pem</code> 
-  - das //CA-Zertifikat// : **cacert.pem** +  - das //CA-Zertifikat// : **cacert.pem** <code> # cp /etc/pki/CA/cacert.pem /etc/pki/dovecot/certs/</code> 
-und schützen diese Dateien mit den Dateirechten **400**: +  - und schützen diese Dateien mit den Dateirechten **400**: <code> # chmod 400 /etc/pki/dovecot/private/*.pem 
-   # mv /etc/pki/CA/servercert.pem /etc/pki/dovecot/certs/servercert_2014-08-14.pem + # chmod 400 /etc/pki/dovecot/certs/*.pem</code>
-   # mv /etc/pki/CA/serverkey.pem /etc/pki/dovecot/private/serverkey_2014-08-14.pem +
-   # cp /etc/pki/CA/cacert.pem /etc/pki/dovecot/certs/ +
-   # chmod 400 /etc/pki/dovecot/certs/*.pem +
-   # chmod 400 /etc/pki/dovecot/private/*.pem+
  
 ==== Zertifikatsketten ==== ==== Zertifikatsketten ====
 Handelt es sich bei der CA um eine mehrstufige CA, so hat man nicht nur ein Zertifikatsfile der RootCA, sondern auch weitere, wie z.B. ein Zwischenzertifikat. Handelt es sich bei der CA um eine mehrstufige CA, so hat man nicht nur ein Zertifikatsfile der RootCA, sondern auch weitere, wie z.B. ein Zwischenzertifikat.
  
-Damit Dovecot mit solchen Zertifikaten umgehen kann, ist es notwendig, dass die einzelnen Inhalte der Zertifikats-Dateien in eine gemeinsame Datei kopiert werden. Folgende Reihenfolge ist dringend einzuhalten:+Damit Dovecot mit solchen Zertifikaten umgehen kann, ist es notwendig, dass die einzelnen Inhalte der Zertifikats-Dateien in eine gemeinsame Datei kopiert werden. Folgende Reihenfolge ist dabei **__dringend__** einzuhalten:
   - Dovecot's public certificate   - Dovecot's public certificate
   - TDC SSL Server CA   - TDC SSL Server CA
Zeile 1744: Zeile 1383:
    # vim /etc/dovecot/conf.d/10-ssl.conf    # vim /etc/dovecot/conf.d/10-ssl.conf
  
-<file bash /etc/dovecot/conf.d/10-ssl.conf>## +<file bash /etc/dovecot/conf.d/10-ssl.conf>##                                                                         
-## SSL settings +## SSL settings                                                            
-##+##                                                                        
  
 # SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt> # SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
 # disable plain pop3 and imap, allowed are only pop3+TLS, pop3s, imap+TLS and imaps # disable plain pop3 and imap, allowed are only pop3+TLS, pop3s, imap+TLS and imaps
-# plain imap and pop3 are still allowed for local connections +# plain imap and pop3 are still allowed for local connections                       
-ssl = required+ssl = required                                                                     
  
 # PEM encoded X.509 SSL/TLS certificate and private key. They're opened before # PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
-# dropping root privileges, so keep the key file unreadable by anyone but +# 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 +# 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 +# certificate, just make sure to update the domains in dovecot-openssl.cnf     
-# Django : 2014-04-09 +# Django : 2015-06-09                                                          
-# old    : ssl_cert = </etc/pki/dovecot/certs/dovecot.pem +# old    : ssl_cert = </etc/pki/dovecot/certs/dovecot.pem                      
-#          ssl_key = </etc/pki/dovecot/private/dovecot.pem +#          ssl_key = </etc/pki/dovecot/private/dovecot.pem                     
-ssl_cert = </etc/pki/dovecot/certs/servercert_2014-04-09.pem +ssl_cert = </etc/pki/dovecot/certs/imap.nausch.org.cert_bundle.2015-06-09.pem 
-ssl_key = </etc/pki/dovecot/private/serverkey_2014-04-09.pem+ssl_key = </etc/pki/dovecot/private/serverkey_2015-06-09.pem                 
  
 # If key file is password protected, give the password here. Alternatively # If key file is password protected, give the password here. Alternatively
 # give it when starting dovecot with -p parameter. Since this file is often # give it when starting dovecot with -p parameter. Since this file is often
 # world-readable, you may want to place this setting instead to a different # world-readable, you may want to place this setting instead to a different
-# root owned 0600 file by using ssl_key_password = <path. +# root owned 0600 file by using ssl_key_password = <path.                   
-#ssl_key_password =+#ssl_key_password =                                                        
  
 # PEM encoded trusted certificate authority. Set this only if you intend to use # PEM encoded trusted certificate authority. Set this only if you intend to use
 # ssl_verify_client_cert=yes. The file should contain the CA certificate(s) # ssl_verify_client_cert=yes. The file should contain the CA certificate(s)
 # followed by the matching CRL(s). (e.g. ssl_ca = </etc/pki/dovecot/certs/ca.pem) # followed by the matching CRL(s). (e.g. ssl_ca = </etc/pki/dovecot/certs/ca.pem)
-#ssl_ca = +#ssl_ca =
  
 # Require that CRL check succeeds for client certificates. # Require that CRL check succeeds for client certificates.
Zeile 1794: Zeile 1433:
  
 # DH parameters length to use. # DH parameters length to use.
-#ssl_dh_parameters_length = 1024+Django : 2015-05-21 
 +# default: ssl_dh_parameters_length = 1024 
 +ssl_dh_parameters_length=4096 
 + 
 +# Weekly regeneration of the ssl-parameters 
 +# Django : 2015-06-10 
 +# default: ssl_parameters_regenerate = 0 
 +#          ssl_parameters_regenerate = 2 hours 
 +#          Won't work since dovecot 2.2! 
 +#          Update ssl_dh_parameters_length with script dh-params 
 +#          https://dokuwiki.nausch.org/doku.php/centos:mail_c7:dovecot_4?&#diffie-hellman-verfahren_und_perfect_forward_secrecy
  
 # SSL protocols to use # SSL protocols to use
-#ssl_protocols = !SSLv2+# Django : 2014-10-16 
 +# default: #ssl_protocols = !SSLv2 
 +ssl_protocols = !SSLv2 !SSLv3
  
 # SSL ciphers to use # SSL ciphers to use
-#ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL+# Django : 2014-10-16 
 +# default: #ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL 
 +ssl_cipher_list = EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4
  
 # Prefer the server's order of ciphers over client's. # Prefer the server's order of ciphers over client's.
-#ssl_prefer_server_ciphers = no+# Django : 2015-05-20 
 +# default: #ssl_prefer_server_ciphers = no 
 +ssl_prefer_server_ciphers = yes
  
 # SSL crypto device to use, for valid values run "openssl engine" # SSL crypto device to use, for valid values run "openssl engine"
Zeile 1809: Zeile 1464:
 </file> </file>
  
 +Über den Paramter **ssl** kann man steuern, ob **SSL/TLS** nun verwendet werden kann, oder ob es verwendet werden muss, oder eben nicht. Wir lassen den Default-Wert //**required**// stehen, was bedeutet, dass den Clients **SSL/TLS** als **zwingend vorgeschrieben** ist. Ein //**yes**// setzt die Transportverschlüsselung als **optional** und ein //**no**//  **deaktiviert** die Transportverschlüsselung gar ganz, aber wer will das seinen Endkunden in Zeiten vob **NSA**, **BND** und **Tempora** noch guten Gewissens verkaufen? 
 +
 +=== Diffie-Hellman-Verfahren und Perfect Forward Secrecy  ===
 +Wie am Anfang des Artikels bereits angeschnitten, basiert Perfect Forward Secrecy (**PFS**) auf der Idee, dass Client und Server ihre Kommunikation über einen zusätzlichen temporären Schlüssel absichern, der wechselt. 
 +
 +Dovecot stellt das normale **[[http://de.wikipedia.org/wiki/Elliptic_Curve_Diffie-Hellman|DHE]]**-Verfahren bereits ab Version 2.1.x und das wesentlich bessere und performantere **[[http://de.wikipedia.org/wiki/Elliptic_Curve_Cryptography|ECDHE]]**-Verfahren ab 2.2.x zur Verfügung.
 +
 +<WRAP center round important 85%>
 +**Wichtig**:\\ \\
 +Die **Diffie-Hellman-Parameter** werden beim ersten Start des Dovecot-Daemon erzeugt und in der Datei **// /var/lib/dovecot/ssl-parameters.dat//** abgelegt.
 +
 +Entgegen den Angaben im Abschnitt **SSL security settings** im [[http://wiki2.dovecot.org/SSL/DovecotConfiguration|Dovecot WIKI]] wird die Parameterdatei __nicht__ wöchentlich erneuert! Diese Funktion wurde ab Dovecot-Version **2.2.7** nicht mehr bereitgestellt.
 +
 +Die Hintergründe und die Lösung zu diesem Problem, basieren auf den Hinweisen von **//[[https://andreasschulze.de/dovecot/ssl-params|Andreas Schulze]]//**, dem hier ein ausdrücklicher Dank gebührt!
 +</WRAP>
 +
 +Wir werden also das Wechseln der **Diffie-Hellman-Parameter** werden wir also selbst in die Hand nehmen. Dies erfolgt in zwei Schritten.
 +  - **Parameterdatei erstellen** und
 +  - **Dovecot die neuen Parameter bekanntgeben**
 +
 +Die Erzeugung der **DH-Parameter-Datei** erfolgt mit Hilfe des Programms **ssl-params** aus dem Verzeichnis //**/usr/libexec/dovecot/**//. Diesem Binary müssen wir angeben, welche Parameter-Länge **ssl_dh_parameters_length** verwendet werden und wo die Parameter-Datei **state_dir** gespeichert werden soll. Hierzu legen wir uns eine Konfigurationsdatei an.
 +   # vim /etc/dovecot/ssl-params.conf
 +
 +<file bash /etc/dovecot/ssl-params.conf># Django : 2015-06-09
 +#          Länge der Diffie-Hellman-Parameter, diese muss der Länge des privaten RSA-Schlüssels entsprechen
 +ssl_dh_parameters_length = 4096
 +#
 +#          Speicherort der Diffie-Hellman-Parameter-Datei ssl-parameters.dat
 +state_dir = /var/lib/dovecot/tmp
 +</file>
 +
 +Als nächstes erzeugen wir noch das temporäre Verzeichnis, in dem die Parameterdatei erzeugt werden kann.  
 +   # mkdir /var/lib/dovecot/tmp/
 +
 +Das Erzeugen erfolgt nun mit Hilfe des folgenden Aufrufs.
 +   # /usr/libexec/dovecot/ssl-params -c /etc/dovecot/ssl-params.conf
 +
 +Dovecot können wir nun leider nicht anweisen, direkt diese Parameterdatei zu laden. Wir werden daher unsere neu generierte Datei an Ort und Stelle verschieben, wo Dovecot diese erwartet. 
 +   # /usr/bin/mv /var/lib/dovecot/tmp/ssl-parameters.dat /var/lib/dovecot/ssl-parameters.dat
 +
 +Anschließend führen wir einen Reload des Dovecot-Daemon durch, damit dieser diese DH-Parameter neu einliest.
 +   # systemctl reload dovecot
 +
 +Da wir in regelmäßigen Abständen die Diffie-Hellman Parameter neu generieren wollen, verpacken wir die gerade gezeigten Schritte in ein Script verlagern. 
 +   # vim /etc/cron.weekly/dh-params
 +
 +<file bash /etc/cron.weekly/dh-params>#!/bin/sh
 +# Diffie-Hellman Parameter Datei erzeugen
 +/usr/libexec/dovecot/ssl-params -c /etc/dovecot/ssl-params.conf
 +
 +# Hostname und Datum holen
 +NAME=`hostname -s`
 +DATUM=`date +'%b %e %H:%M:%S'`
 +
 +# Parameterdatei für Dovecot bereitstellen
 +/usr/bin/mv /var/lib/dovecot/tmp/ssl-parameters.dat /var/lib/dovecot/ssl-parameters.dat
 +
 +# Informationen zur neuen Parameterdatei im Maillog vermerken
 +echo "$DATUM" "$NAME" "dovecot: ssl-params: renewed diffie-hellman parameters 4096bit" >> /var/log/maillog
 +
 +# Dovecot die neuen DH-Parameter bekannt geben
 +/usr/bin/systemctl reload dovecot
 +
 +# Temporäres Verzeichnis leeren
 +/usr/bin/rm /var/lib/dovecot/tmp/ssl-parameters.dat -f
 +</file>
 +
 +Damit das Script nun auch ausgeführt werden kann, versehen wir es noch  mit den **x**-Ausführungsrechten.
 +   # chmod +x /etc/cron.weekly/dh-params
 +
 +Das regelmäßige Erneuern der DH-Parameter erfolgt nun regelmäßig und wir im Maillog entsprechend dokumentiert.
 +
 +   # less /var/log/maillog
 +
 +  Jun  9 20:08:31 vml000077 dovecot: ssl-params(4526): renewed diffie-hellman parameters 4096bit
 +  Jun  9 20:08:31 vml000077 dovecot: master: Warning: SIGHUP received - reloading configuration
  
  
Zeile 1995: Zeile 1726:
  
 ===== Dovecot Verbindungstest ===== ===== Dovecot Verbindungstest =====
 +==== openssl ====
 Zum Testen der kompletten Konfigurationsänderungen greifen wir auf die Bibliothek **openssl** zurück. Im nachfolgendem Beispiel bauen wir eine Verbindung von einem entferneten Linux-Host im eigenen Netz auf. Somit haben wir auch gleich noch den Test, ob es ggf. nicht eine Firewall gibt, die unseren Verbindungsaufbauwunsch unter Umständen blockiert. Zum Testen der kompletten Konfigurationsänderungen greifen wir auf die Bibliothek **openssl** zurück. Im nachfolgendem Beispiel bauen wir eine Verbindung von einem entferneten Linux-Host im eigenen Netz auf. Somit haben wir auch gleich noch den Test, ob es ggf. nicht eine Firewall gibt, die unseren Verbindungsaufbauwunsch unter Umständen blockiert.
  
-Nach Herstellen der Verbindung loggen wir uns einfach wieder vom System ab, in dem wir die Zeichenfolge **42 logout** vwerwenden.+Nach Herstellen der Verbindung loggen wir uns einfach wieder vom System ab, in dem wir die Zeichenfolge **42 logout** verwenden. 
    $ openssl s_client -starttls imap -connect 10.0.0.70:143    $ openssl s_client -starttls imap -connect 10.0.0.70:143
 <code>CONNECTED(00000003) <code>CONNECTED(00000003)
Zeile 2123: Zeile 1856:
  
    Jul 23 16:39:08 vml000070 dovecot: imap-login: Aborted login (no auth attempts in 5 secs): user=<>, rip=10.0.0.20, TLS, TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits), session=<FCSBTd3+sQAKAAAU>    Jul 23 16:39:08 vml000070 dovecot: imap-login: Aborted login (no auth attempts in 5 secs): user=<>, rip=10.0.0.20, TLS, TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits), session=<FCSBTd3+sQAKAAAU>
 +
 +
 +Wollen wir unser Produktiv-System überprüfen, nutzen wir einen der folgenden Aufrufe:
 +  * **IMAP** und **START/TLS**: <code> $ openssl s_client -starttls imap -connect imap.nausch.org:143</code>
 +  * **IMAP** und **SSL**: <code> $ openssl s_client -connect imap.nausch.org:993</code>
 +  * **POP3** und **SSL**: <code> $ openssl s_client -connect imap.nausch.org:995</code>
 +
 +Finden wir in der Ausgabe eine der nachfolgenden Angaben, ist alles bestens, der IMAP-Server unterstützt **//Perfect Forward Secrecy//**
 +
 +  * **Protocol** : \\ TLSv1.2 \\ <html>&nbsp;</html>
 +  * **Cipher** : \\ ECDHE-RSA-AES256-GCM-SHA384 \\ DHE-RSA-AES256-GCM-SHA384
 +
 +<WRAP center round important>
 +**Wichtig:** \\ Nicht der Server definiert letztendlich, welcher **Cipher** bei der Absicherung der Übertragung verwendet wird, sondern der Mailclient! Und hier kann man durchaus sehr interessante Aha-Erlebnisse haben, wenn man mit den einschlägigen teuren Clientlösungen Verbindungen testet. m(
 +</WRAP>
 +
 +==== cipherscan ====
 +Zum Überprüfen welche Chiffren vom Server angeboten und unterstützt werden, greifen wir auf das Tool **[[https://github.com/jvehent/cipherscan|cipherscan]]** von [[julien@linuxwall.info|Julien Vehent]] und [[hkario@redhat.com|Hubert Kario]] zurück. Das Projekt basiert auf den openssl-Bibliotheken und wird auf [[https://github.com|GitHub]] zur Verfügung gestellt.
 +
 +Mit nachfolgendem Aufruf kann überprüft werden, welche Ciphers angeboten werden.
 +   # /usr/local/src/cipherscan-master/cipherscan -o /usr/local/src/cipherscan-master/openssl --curves -starttls imap imap.nausch.org:143
 +
 +<code>.....................................
 +Target: imap.nausch.org:143
 +
 +prio  ciphersuite                  protocols              pfs                 curves
 +1     ECDHE-RSA-AES256-GCM-SHA384  TLSv1.2                ECDH,P-256,256bits  prime256v1,secp384r1,secp521r1
 +2     ECDHE-RSA-AES128-GCM-SHA256  TLSv1.2                ECDH,P-256,256bits  prime256v1,secp384r1,secp521r1
 +3     ECDHE-RSA-AES256-SHA384      TLSv1.2                ECDH,P-256,256bits  prime256v1,secp384r1,secp521r1
 +4     ECDHE-RSA-AES128-SHA256      TLSv1.2                ECDH,P-256,256bits  prime256v1,secp384r1,secp521r1
 +5     ECDHE-RSA-AES256-SHA         TLSv1,TLSv1.1,TLSv1.2  ECDH,P-256,256bits  prime256v1,secp384r1,secp521r1
 +6     ECDHE-RSA-AES128-SHA         TLSv1,TLSv1.1,TLSv1.2  ECDH,P-256,256bits  prime256v1,secp384r1,secp521r1
 +7     DHE-RSA-AES256-GCM-SHA384    TLSv1.2                DH,4096bits         None
 +8     DHE-RSA-AES256-SHA256        TLSv1.2                DH,4096bits         None
 +9     DHE-RSA-AES256-SHA           TLSv1,TLSv1.1,TLSv1.2  DH,4096bits         None
 +10    DHE-RSA-CAMELLIA256-SHA      TLSv1,TLSv1.1,TLSv1.2  DH,4096bits         None
 +11    DHE-RSA-AES128-GCM-SHA256    TLSv1.2                DH,4096bits         None
 +12    DHE-RSA-AES128-SHA256        TLSv1.2                DH,4096bits         None
 +13    DHE-RSA-AES128-SHA           TLSv1,TLSv1.1,TLSv1.2  DH,4096bits         None
 +14    DHE-RSA-SEED-SHA             TLSv1,TLSv1.1,TLSv1.2  DH,4096bits         None
 +15    DHE-RSA-CAMELLIA128-SHA      TLSv1,TLSv1.1,TLSv1.2  DH,4096bits         None
 +
 +Certificate: trusted, 4096 bit, sha512WithRSAEncryption signature
 +TLS ticket lifetime hint: 300
 +OCSP stapling: not supported
 +Cipher ordering: server
 +Curves ordering: server
 +Curves fallback: False
 +</code>
 +
 +Die Bewertung der einzelnen Chiffren müssen wir hier immer noch selbst vornehmen; hilfreiche Informationen hierzu findet man z.B. im Buch **//[[https://www.feistyduck.com/books/bulletproof-ssl-and-tls/|BULLETPROOF SSL AND TLS]]//** von **[[http://blog.ivanristic.com/|Ivan Ristić]]**.
 +
 +
  
 ====== Links ====== ====== Links ======
Zeile 2128: Zeile 1914:
   * **[[wiki:start|Zurück zu >>Projekte und Themenkapitel<<]]**   * **[[wiki:start|Zurück zu >>Projekte und Themenkapitel<<]]**
   * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]**   * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]**
- 
-~~DISCUSSION~~ 
- 
  
  • centos/mail_c7/dovecot_4.1406318452.txt.gz
  • Zuletzt geändert: 25.07.2014 20:00.
  • von django