Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
lpi2:postfix-tls [2014/07/23 06:57] ingo_wichmann |
lpi2:postfix-tls [2024/08/10 10:48] (aktuell) |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | Todo: Wie aktualisiert man ''/var/spool/postfix/etc/ssl/certs/ca-certificates.crt''? Wird das bei Debian genutzt? | + | Todo: |
+ | * Wie aktualisiert man ''/var/spool/postfix/etc/ssl/certs/ca-certificates.crt''? Wird das bei Debian genutzt? | ||
+ | * DH-Parameter einbinden ((''smtpd_tls_dh1024_param_file = ${config_directory}/dhparams.pem'' in /etc/postfix/main.cf)) | ||
====== Vorraussetzungen ====== | ====== Vorraussetzungen ====== | ||
- | * Einfache [[lpi2:postfix]] Installation | + | * Einfache [[postfix]] Installation |
- | * [[lpi2:ssl]] Zertifikat erzeugt | + | * [[ssl]] Zertifikat erzeugt |
- | * Korrektes [[lpi2:bind|DNS]] | + | * Korrektes [[bind|DNS]] |
* Korrekte [[lpi1:zeitserver|Uhrzeiten]] auf allen Rechnern | * Korrekte [[lpi1:zeitserver|Uhrzeiten]] auf allen Rechnern | ||
Zeile 23: | Zeile 25: | ||
gpasswd -a postfix ssl | gpasswd -a postfix ssl | ||
==== Postfix konfigurieren ==== | ==== Postfix konfigurieren ==== | ||
- | postconf -e "smtpd_use_tls = yes" | ||
postconf -e "smtpd_tls_cert_file = /etc/ssl/certs/servercert.pem" | postconf -e "smtpd_tls_cert_file = /etc/ssl/certs/servercert.pem" | ||
postconf -e "smtpd_tls_key_file = /etc/ssl/private/serverkey.pem" | postconf -e "smtpd_tls_key_file = /etc/ssl/private/serverkey.pem" | ||
postconf -e "smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem" | postconf -e "smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem" | ||
+ | postconf -e "smtpd_use_tls = yes" | ||
+ | |||
+ | oder besser wie von [[https://ssl-config.mozilla.org/#server=postfix&config=intermediate|Mozilla]] vorgeschlagen (( | ||
+ | <file txt main.cf> | ||
+ | # generated 2022-09-23, Mozilla Guideline v5.6, Postfix 3.5.13, OpenSSL 1.1.1n, intermediate configuration | ||
+ | # https://ssl-config.mozilla.org/#server=postfix&version=3.5.13&config=intermediate&openssl=1.1.1n&guideline=5.6 | ||
+ | smtpd_tls_security_level = may | ||
+ | smtpd_tls_auth_only = yes | ||
+ | smtpd_tls_cert_file = /path/to/signed_cert_plus_intermediates | ||
+ | smtpd_tls_key_file = /path/to/private_key | ||
+ | smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 | ||
+ | smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 | ||
+ | smtpd_tls_mandatory_ciphers = medium | ||
+ | |||
+ | # curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam | ||
+ | # not actually 1024 bits, this applies to all DHE >= 1024 bits | ||
+ | smtpd_tls_dh1024_param_file = /path/to/dhparam | ||
+ | |||
+ | tls_medium_cipherlist = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 | ||
+ | tls_preempt_cipherlist = no | ||
+ | </file> | ||
+ | )) | ||
==== testen === | ==== testen === | ||
+ | === netcat === | ||
netcat localhost smtp | netcat localhost smtp | ||
EHLO asdf | EHLO asdf | ||
Zeile 35: | Zeile 59: | ||
250-STARTTLS | 250-STARTTLS | ||
</file> | </file> | ||
- | openssl s_client -starttls smtp -CAfile /etc/ssl/certs/cacert.pem -connect localhost:25 | + | === openssl === |
+ | openssl s_client -starttls smtp -CApath /etc/ssl/certs -connect localhost:25 | ||
+ | |||
+ | === swaks === | ||
+ | swaks -f me.example.com -t you.example.com -tls -s 127.0.0.1 | ||
+ | |||
+ | ===== DANE ===== | ||
+ | DNS Resource Record erzeugen: | ||
+ | |||
+ | postfix tls output-server-tlsa | ||
+ | oder | ||
+ | postfix tls output-server-tlsa /var/lib/dehydrated/certs/example.com/privkey.pem | ||
+ | Den TLSA Resource Record muss man immer neu erzeugen, wenn der öffentliche Schlüssel des Zertifikats sich ändert. TODO: certbot oder dehydrated so aufrufen, dass der bisherige Schlüssel wieder verwendet wird. | ||
+ | ... und im DNS hinterlegen. | ||
====== Dokus & Links ====== | ====== Dokus & Links ====== | ||
* http://www.state-of-mind.de/vortraege/ | * http://www.state-of-mind.de/vortraege/ | ||
* http://www.postfix.org/TLS_README.html | * http://www.postfix.org/TLS_README.html | ||
* http://sys4.de/de/blog/2013/08/14/postfix-tls-forward-secrecy/ | * http://sys4.de/de/blog/2013/08/14/postfix-tls-forward-secrecy/ | ||
+ | * https://blog.tausys.de/2016/07/13/letsencrypt-zertifikate-fuer-dovecot-und-postfix/ | ||