Postfix | moderne Verschlüsselung
Vorraussetzungen
Vorbereitungen
Ihr solltet bereits ein RSA– und ECDSA-Schlüsselpärchen erzeugt haben, welches von einer CA beglaubigt wurde. Für diesen Zweck nutze ich das acme.sh Shell-Skript, um mir anschließend via Let’s Encrypt ein »gültiges« Zertifikat zu generieren. Ich reiße das im Folgenden kurz an.
RSA- und ECDSA-Schlüsselpärchen
Beantragen eines LE Zertifikats auf Basis von RSA
./acme.sh --issue -d mail.deine.tld --keylength 4096 --standaloneBeantragen eines LE Zertifikats auf Basis von ECDSA
./acme.sh --issue -d mail.deine.tld --keylength ec-384 --standaloneDiffie-Hellman-Schlüssel mit 4096 Bit
Postfix nutzt Forward Secrecy bereits ohne weitere Konfiguration. Allerdings werden für den Schlüsselaustausch via Forward Secrecy geeigneten Cipher-Suiten (EDH) bereits vorberechnete DH-Schlüssel mit 2048-Bit und 512-Bit verwendet. Da der 512-Bit DH-Schlüssel bei uns niemals verwendet wird – wir nutzen keine altmodischen EXPORT-Chipher – berechnen wir nur den DH-Schlüssel mit 4096-Bit neu:
openssl dhparam -out /etc/postfix/dh_4096.pem -2 4096Über den Parameter »smtpd_tls_dh1024_param_file« binden wir den DH-Schlüssel später in die Konfiguration ein und ersetzen damit den Standard DH-Schlüssel mit 2048 Bit.
Postfix einstellungen
Allgmeine TLS-Einstellungen
sudo nano /etc/postfix/main.cf[...]
# Path CAfile
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
# TLS RSA public / private keys
smtpd_tls_cert_file = /etc/ssl/certs/mail.deine.tld.cer
smtpd_tls_key_file = /etc/ssl/private/mail.deine.tld.key
# TLS ECDSA public / private keys
smtpd_tls_eccert_file = /etc/ssl/certs/mail.deine.tld_ecc.cer
smtpd_tls_eckey_file = /etc/ssl/private/mail.deine.tld_ecc.key
# TLS supported cipherlist
tls_high_cipherlist = !aNULL:!eNULL:!CAMELLIA:HIGH:@STRENGTH
# Prefer the servers order of ciphers over clients
tls_preempt_cipherlist = yes
# EDH-Parameter
smtpd_tls_dh1024_param_file = /etc/postfix/dh_4096.pem
# Server security grade for ephemeral elliptic-curve Diffie-Hellman (EECDH) key exchange
smtpd_tls_eecdh_grade = ultra
# No SSL compression
tls_ssl_options = NO_COMPRESSION
[...]Verschlüsselung beim Versenden
sudo nano /etc/postfix/main.cf[...]
# TLS protocols accepted by Postfix (Outgoing)
smtp_tls_protocols = !SSLv2, !SSLv3
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
# TLS supported ciphers (Outgoing)
smtp_tls_ciphers = high
smtp_tls_mandatory_ciphers = high
# Uses TLS if this is supported by the receiving SMTP server
smtp_tls_security_level = may
# Enable additional Postfix SMTP server logging of TLS activity
smtp_tls_loglevel = 1
[...]