Inhaltsverzeichnis
Postfix ArchLinux - Konfiguration: null client - smtps-Konfiguration
Postfix ist Wietse Venema's Mail-Server, welcher bei „IBM research“ als Alternative zum ehemals weit verbreiteten Programm Sendmail entwickelt wurde. Postfix erhebt den Anspruch ein schneller, einfach zu administrierender und sicherer Mail-Server zu sein.
Postfix wird von Wietse Venema entwickelt.
Beschreibung | Externer Link |
---|---|
Homepage | http://www.postfix.org |
Ankündigungen | http://www.postfix.org/announcements.html |
Dokumentation | http://www.postfix.org/documentation.html Postfix TLS Support Postfix Connection Cache TLS Forward Secrecy in Postfix |
Ab hier werden zur Ausführung nachfolgender Befehle root
-Rechte benötigt. Um der Benutzer root
zu werden, melden Sie sich bitte als root
-Benutzer am System an, oder wechseln mit nachfolgendem Befehl zum Benutzer root
:
$ su - Password:
Vorhaben
Es soll für die Kommunikation via E-Mail mit Postfix nachfolgendes Konstrukt, wie in der gezeigten Skizze zu sehen ist, zum Einsatz kommen:
┌──────────────────────┐ ┌───┐ │ Postfix- │ │ I │ │ null client │ │ N │ ├──────────────────────┤ │ T │ │ │ │ E │ │ Listen 'localhost' │ │ R │ │ Cert 'self-signed' │ │ N │ │ │ │ E │ │ Relay: main client │ │ T │ │ │ │ │ └────┬─────────────────┘ └─▲─┘ │ │ │ │ │ │ │ ┌───────────────────────────────────────────┐ │ │ │ Postfix- │ │ │ │ main server │ │ │ ├───────────────────────────────────────────┤ │ │ │ │ │ │ │ ┌───────────────────────────────────┐ │ │ │ │ │ IN Port: 25 OUT │ │ │ │ │ ├───────────────────────────────────┤ │ │ │ │ │ ✔ interne E-Mail │ │ │ │ │ │ ✘ externe E-Mail │ │ │ │ │ │ ✔ Verschlüsselungen: möglich │ │ │ │ │ │ ✘ Authentifizierung: KEINE │ │ │ │ │ └───────────────────────────────────┘ │ │ │ │ │ │ │ │ ┌───────────────────────────────────┐ │ │ └───────────┼───► IN Port: 465 OUT ►───┼─────────────┘ │ ├───────────────────────────────────┤ │ │ │ ✔ interne E-Mail │ │ │ │ ✔ externe E-Mail │ │ │ │ ✔ Verschlüsselungen: möglich │ │ │ │ ✔ Authentifizierung: Zertifikat │ │ │ └───────────────────────────────────┘ │ │ │ │ ┌───────────────────────────────────┐ │ │ │ IN Port: 587 OUT │ │ │ ├───────────────────────────────────┤ │ │ │ ✔ interne E-Mail │ │ │ │ ✔ externe E-Mail │ │ │ │ ✔ Verschlüsselungen: möglich │ │ │ │ ✔ Authentifizierung: SASL │ │ │ └───────────────────────────────────┘ │ │ │ │ 'mx1.tachtler.net' │ │ │ └─────────────────────┬─────────────────────┘ │ ┌───────────▼───────────┐ │ │ │ 'imap.tachtler.net' │ │ │ │ Port: 24 │ │ ✔ TLS-verschlüsselt │ │ ✔ LMTP(s)-Transport │ │ │ └───────────────────────┘
Die interne Kommunikation vom Postfix-null client zum Postfix-main client soll via TLS-Verschlüsselung mittels „secure“ und ausschliessliche über Port: 465
(smtps) und mit einer Authentifizierung über das Zertifikats des Postfix-null client erzwungen werden.
Voraussetzungen
Für die nachfolgende Installation wird vorausgesetzt,
- dass eine lauffähige Version von Postfix ab Version 3.9
vorhanden ist und die unter nachfolgenden Links beschriebenen Installationen und Konfigurationen von Postfix als Mindestvoraussetzung zwingend durchgeführt wurden:
Konfiguration: null client
ACHTUNG |
---|
Die nachfolgende Dokumentation für einen Postfix als „null client“ enthält zwei Varianten, bitte jeweils nur eine davon durchführen! |
Unter nachfolgendem externen Link, befindet sich die Definition für einen Postfix-Server, welcher als sogenannter „null client“ fungieren soll:
Definition laut Dokumentation: - Postfix Standard Configuration Examples - Postfix on a null client |
---|
Ein „null client“ ist ein Server, der nur E-Mails versenden kann. Er empfängt keine E-Mails und stellt „lokal“ auch keine E-Mails an Postfächer zu. |
Erklärung eines möglichen Einsatzzweckes |
---|
Der Sinn und Zweck eines „null client“ ist es, lokal auf dem Server selbst erzeugte E-Mails, welche z.B. von einem Skript oder einer Web-Anwendung die auf dem Server läuft, entgegen zu nehmen und diese dann an den sich im internen Netzwerk zuständigen „main server“ weiter zu leiten. Das ist immer dann sinnvoll, wenn z.B. das Skript oder die Web-Anwendung auf temporäre E-Mail-Ablehnungen (Code: 4xx) durch den „main server“ nicht reagieren kann. So bleiben die E-Mails in der Queue des „null client“, bis der „main server“ wieder erreichbar ist! |
HINWEIS - In nachfolgender Konfiguration wird davon ausgegangen, dass der Internet-Domänenname tachtler.net lautet und dass der Server („null client“) client.idmz.tachtler.net heisst. In der nachfolgenden Konfiguration werden nur Parameter gesetzt, die nicht auf den jeweiligen Standardeinstellungen belassen werden können bzw. sollen.
Die Hauptkonfigurationsdatei von Postfix ist die Konfigurationsdatei
/etc/postfix/main.cf
.
Der Inhalt der Konfigurationsdatei, sollte nur beim Editieren der Konfigurationsdatei relevant sein. Falls der Inhalt aufgelistet werden soll, sind nachfolgende Befehl anzuwenden, da diese die Konfiguration so wiedergeben, wie diese auch von Postfix interpretiert wird.
Nachfolgende Befehle sollten zum Einsatz kommen:
postconf -d
- Listet die default (Standard) Werte der aktuellen Postfix-Konfiguration aufpostconf -n
- Listet die neuen bzw. zur Standardkonfiguration aktuell abweichend konfigurierten Werte der Postfix-Konfiguration aufpostconf
- Listet alle aktuellen - inklusive der Standard - konfigurierten Werte der Postfix-Konfiguration auf
Nach dem Ausführen der Befehls
postconf -n
sollte eine Ausgabe, in etwa wie die nachfolgend gezeigte erscheinen:
# postconf -n alias_database = $alias_maps alias_maps = lmdb:${config_directory}/aliases compatibility_level = 3.9 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 inet_interfaces = loopback-only mydestination = myhostname = client.idmz.tachtler.net recipient_canonical_maps = lmdb:${config_directory}/recipient_canonical_maps relayhost = tachtler.net smtp_dns_support_level = dnssec smtp_tls_CApath = ${config_directory}/ssl/certs smtp_tls_block_early_mail_reply = yes smtp_tls_chain_files = ${config_directory}/ssl/certs/client-chain.pem smtp_tls_ciphers = high smtp_tls_connection_reuse = yes smtp_tls_exclude_ciphers = ECDHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA, DHE-RSA-AES256-GCM-SHA384, DHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA, ECDHE-RSA-CAMELLIA256-SHA384, DHE-RSA-CAMELLIA256-SHA256, DHE-RSA-CAMELLIA256-SHA, AES256-SHA256, AES256-SHA, CAMELLIA256-SHA256, CAMELLIA256-SHA, ECDHE-RSA-AES128-SHA256, ECDHE-RSA-AES128-SHA, DHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA, ECDHE-RSA-CAMELLIA128-SHA256, DHE-RSA-CAMELLIA128-SHA256, DHE-RSA-CAMELLIA128-SHA, AES128-SHA256, AES128-SHA, CAMELLIA128-SHA256, CAMELLIA128-SHA smtp_tls_loglevel = 1 smtp_tls_mandatory_ciphers = high smtp_tls_mandatory_exclude_ciphers = ECDHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA, DHE-RSA-AES256-GCM-SHA384, DHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA, ECDHE-RSA-CAMELLIA256-SHA384, DHE-RSA-CAMELLIA256-SHA256, DHE-RSA-CAMELLIA256-SHA, AES256-SHA256, AES256-SHA, CAMELLIA256-SHA256, CAMELLIA256-SHA, ECDHE-RSA-AES128-SHA256, ECDHE-RSA-AES128-SHA, DHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA, ECDHE-RSA-CAMELLIA128-SHA256, DHE-RSA-CAMELLIA128-SHA256, DHE-RSA-CAMELLIA128-SHA, AES128-SHA256, AES128-SHA, CAMELLIA128-SHA256, CAMELLIA128-SHA smtp_tls_mandatory_protocols = >=TLSv1.2, <=TLSv1.3 smtp_tls_protocols = >=TLSv1.2, <=TLSv1.3 smtp_tls_security_level = dane-only smtp_tls_session_cache_database = lmdb:${data_directory}/smtp_scache tls_append_default_CA = yes tls_random_bytes = 255 tlsproxy_tls_CApath = $smtp_tls_CApath tlsproxy_tls_ask_ccert = yes tlsproxy_tls_chain_files = $smtp_tls_chain_files tlsproxy_tls_ciphers = $smtp_tls_ciphers tlsproxy_tls_exclude_ciphers = $smtp_tls_exclude_ciphers tlsproxy_tls_loglevel = $smtp_tls_loglevel tlsproxy_tls_mandatory_ciphers = $smtp_tls_mandatory_ciphers tlsproxy_tls_mandatory_exclude_ciphers = $smtp_tls_mandatory_exclude_ciphers tlsproxy_tls_mandatory_protocols = $smtp_tls_mandatory_protocols tlsproxy_tls_protocols = $smtp_tls_protocols tlsproxy_tls_security_level = encrypt
relayhost
Information | Beschreibung | |
---|---|---|
Dokumentation | http://www.postfix.org/postconf.5.html#relayhost | |
Defaultwert | relayhost = |
|
Neuer Wert | Variante: original relayhost = $mydomain:465 | Variante: minimal relayhost = tachtler.net:465 |
Beschreibung | Der/die nächste(n) Zielort(e) für nicht-lokale E-Mails; hat Vorrang vor nicht-lokalen Domänen in Empfängeradressen. Diese Information wird nicht verwendet, wenn der Absender mit $sender_dependent_relayhost_maps übereinstimmt.In einer internen Zone (z.B. idmz) kann der Dmänennamen der Organisation angegeben werden. Wenn das internes DNS keine MX-Einträge verwendet, kann stattdessen der Namen des „main server“ oder dessen IP-Adresse(n) angegeben werden. Bei der SMTP-Zustellung sind ein oder mehrere Ziele in Form eines Domänennamens, Hostnamens, Hostname:Dienst, [Hostname]:Dienst, [Hostadresse] oder [Hostadresse]:Dienst anzugeben, getrennt durch Komma oder Leerzeichen. Die Form [hostname] schaltet MX- oder SRV-Record-Abfragen aus. Mehrere Ziele werden ab Postfix Version 3.5 unterstützt. Jedes Ziel wird in der angegebenen Reihenfolge ausprobiert. |
|
Siehe auch | Postfix ArchLinux - Konfiguration: null client - mydomain |
WICHTIG - Durch das setzen von einen relayhost auf
$mydomain:465
- wird eine DNS MX-Record-Abfrage durchgeführttachtler.net:465
- wird eine DNS MX-Record-Abfrage durchgeführt
Weitere Beispiele könnten wie folgt gesetzt werden:
server.idmz.tachtler.net:465, server.edmz.tachtler.net:587
- löst eine DNS MX-Record-Abfrage aus[server.idmz.tachtler.net]
- löst eine DNS A- oder AAAA-Record-Abfrage aus[an.ip.add.ress]
- verwendet ohne DNS direkt die angegebene IP-Adresse
WICHTIG - Es wird für die lokale E-Mail-Zustellung durch Postfix eine Weiterleitung an den Postfix „main Server“ durchgeführt!
smtps-Konfiguration: smtp
WICHTIG - Bei der smtps-Konfiguration: smtp handelt es sich um die verschlüsselte Kommunikation, bei der der Postfix (MTA) als client agiert! |
---|
Die interne Kommunikation vom Postfix-null client zum Postfix-main client soll via TLS-Verschlüsselung mittels „secure“ und ausschliessliche über Port: 465
(smtps) und mit einer Authentifizierung über das Zertifikats des Postfix-null client erzwungen werden.
Transport Layer Security (TLS, früher SSL genannt) bietet zertifikatsbasierte Authentifizierung und verschlüsselte Sitzungen. Eine verschlüsselte Sitzung schützt die Informationen, die mit SMTP-Mail oder mit SASL-Authentifizierung übertragen werden
smtp_tls_security_level
HINWEIS - Parameter: smtp_tls_security_level
- Da eine vollständige Konfiguration für
smtps
jetzt durchgeführt wurde, kann nun der Parameter final sogar aufsecure
abgeändert werden!
Der Postfix SMTP/LMTP-Client implementiert mehrere TLS-Sicherheitsstufen. Diese Stufen werden in den folgenden Abschnitten ausführlicher beschrieben
Stufe der Verschlüsselung | Beschreibung |
---|---|
none | Auf dieser Ebene werden keine zusätzlichen Attribute unterstützt. |
may | Die optionalen Attribute „ciphers “, „exclude “ und „protocols “ (verfügbar für opportunistisches TLS mit Postfix ≥ 2.6) und das Attribut „connection_reuse “ (Postfix ≥ 3.4) überschreiben die Konfigurationsparameter smtp_tls_ciphers , smtp_tls_exclude_ciphers , smtp_tls_protocols und smtp_tls_connection_reuse . Auf dieser Ebene und höher setzt das optionale Attribut „servername “ (verfügbar mit Postfix ≥ 3.4) den globalen Parameter smtp_tls_servername ausser Kraft und ermöglicht die Konfiguration der SNI-Erweiterung, die an den entfernten SMTP-Server gesendet wird, pro Ziel. Das optionale Attribut „enable_rpk “ (Postfix ≥ 3.9) übersteuert den Parameter main.cf smtp_tls_enable_rpk . Wenn opportunistische TLS-Handshakes fehlschlagen, versucht Postfix die Verbindung mit deaktiviertem TLS erneut. Dies ermöglicht die E-Mail-Zustellung an Standorte mit nicht interoperablen TLS-Implementierungen. https://www.postfix.org/postconf.5.html#smtp_tls_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_exclude_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_protocols https://www.postfix.org/postconf.5.html#smtp_tls_connection_reuse https://www.postfix.org/postconf.5.html#smtp_tls_enable_rpk |
encrypt | E-Mails werden nur zugestellt, wenn der entfernte SMTP-Server STARTTLS anbietet und der TLS-Handshake erfolgreich ist. Auf dieser Ebene und höher setzt das optionale Attribut „protocols “ den Parameter main.cf smtp_tls_mandatory_protocols ausser Kraft, das optionale Attribut „ciphers “ setzt den Parameter main.cf smtp_tls_mandatory_ciphers ausser Kraft, das optionale Attribut „exclude “ (Postfix ≥ 2. 6) überschreibt den Parameter main.cf smtp_tls_mandatory_exclude_ciphers , und das optionale Attribut „connection_reuse “ (Postfix ≥ 3.4) überschreibt den Parameter main.cf smtp_tls_connection_reuse . Das optionale Attribut „enable_rpk “ (Postfix ≥ 3.9) übersteuert den Parameter main.cf smtp_tls_enable_rpk . https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_protocols https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_exclude_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_connection_reuse https://www.postfix.org/postconf.5.html#smtp_tls_enable_rpk |
dane | Die TLS-Richtlinie für das Ziel wird über TLSA-Einträge in DNSSEC ermittelt. Wenn keine TLSA-Datensätze gefunden werden, wird die effektive Sicherheitsstufe may verwendet. Wenn TLSA-Einträge gefunden werden, aber keine verwendbar sind, ist die effektive Sicherheitsstufe encrypt . Wenn brauchbare TLSA-Einträge für den entfernten SMTP-Server gefunden werden, muss das Serverzertifikat mit den TLSA-Einträgen übereinstimmen (und der SNI-Name wird bedingungslos auf die TLSA-Basisdomäne gesetzt). RFC 7672 (DANE) TLS-Authentifizierung und DNSSEC-Unterstützung sind mit Postfix 2.11 und höher verfügbar. Das optionale Attribut „connection_reuse “ (Postfix ≥ 3.4) setzt den Parameter main.cf smtp_tls_connection_reuse ausser Kraft. Wenn die effektiv verwendete Sicherheitsstufe may ist, überschreiben die optionalen Attribute „ciphers “, „exclude “ und „protocols “ (Postfix ≥ 2.6) die Konfigurationsparameter smtp_tls_ciphers , smtp_tls_exclude_ciphers und smtp_tls_protocols . Wenn die effektive Sicherheitsstufe verschlüsselt ist, überschreiben die optionalen Attribute „ciphers “, „exclude “ und „protocols “ (Postfix ≥ 2.6) die Konfigurationsparameter smtp_tls_mandatory_ciphers , smtp_tls_mandatory_exclude_ciphers und smtp_tls_mandatory_protocols . https://www.postfix.org/postconf.5.html#smtp_tls_connection_reuse https://www.postfix.org/postconf.5.html#smtp_tls_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_exclude_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_protocols https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_exclude_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_protocols |
dane-only | Die TLS-Richtlinie für das Ziel wird über TLSA-Einträge in DNSSEC ermittelt. Wenn keine TLSA-Einträge gefunden werden oder keine verwendbar sind, wird keine Verbindung mit dem Server hergestellt. Wenn brauchbare TLSA-Einträge für den entfernten SMTP-Server gefunden werden, muss das Serverzertifikat mit den TLSA-Einträgen übereinstimmen. RFC 7672 (DANE) TLS-Authentifizierung und DNSSEC-Unterstützung sind mit Postfix 2.11 und höher verfügbar. Die optionalen Attribute „ciphers “, „exclude “ und „protocols “ (Postfix ≥ 2.6) setzen die Konfigurationsparameter smtp_tls_mandatory_ciphers , smtp_tls_mandatory_exclude_ciphers und smtp_tls_mandatory_protocols ausser Kraft. Das optionale Attribut „connection_reuse “ (Postfix ≥ 3.4) übersteuert den Parameter main.cf smtp_tls_connection_reuse . https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_exclude_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_protocols https://www.postfix.org/postconf.5.html#smtp_tls_connection_reuse |
fingerprint | Verfügbar mit Postfix 2.5 und höher. Bei dieser Sicherheitsstufe gibt es keine vertrauenswürdigen Zertifizierungsstellen. Die Vertrauenskette des Zertifikats, das Ablaufdatum, … werden nicht überprüft. Stattdessen listet das optionale Attribut „match“ oder der Parameter main.cf smtp_tls_fingerprint_cert_match die Zertifikatsfingerabdrücke bzw. die Fingerabdrücke des öffentlichen Schlüssels (ab Postfix 2.9) von akzeptablen Serverzertifikaten auf. Der zur Berechnung des Fingerabdrucks verwendete Digest-Algorithmus wird mit dem Parameter smtp_tls_fingerprint_digest ausgewählt. Mehrere Fingerabdrücke können mit einem „pipe“-Trennzeichen in einem einzigen Übereinstimmungsattribut kombiniert werden, oder es können mehrere Übereinstimmungsattribute verwendet werden. Das Zeichen „:“ wird nicht als Trennzeichen verwendet, da es zwischen jedem Paar von Fingerabdruckziffern (hexadezimal) steht. Die optionalen Attribute „ciphers“, „exclude “ und „protocols “ (Postfix ≥ 2.6) setzen die Konfigurationsparameter smtp_tls_mandatory_ciphers , smtp_tls_mandatory_exclude_ciphers und smtp_tls_mandatory_protocols ausser Kraft. Das optionale Attribut „connection_reuse “ (Postfix ≥ 3.4) übersteuert den Parameter main.cf smtp_tls_connection_reuse . Das optionale Attribut „enable_rpk “ (Postfix ≥ 3.9) setzt den Parameter main.cf smtp_tls_enable_rpk ausser Kraft. https://www.postfix.org/postconf.5.html#smtp_tls_fingerprint_cert_match https://www.postfix.org/postconf.5.html#smtp_tls_fingerprint_digest https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_exclude_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_protocols https://www.postfix.org/postconf.5.html#smtp_tls_connection_reuse https://www.postfix.org/postconf.5.html#smtp_tls_enable_rpk |
verify | E-Mails werden nur zugestellt, wenn der TLS-Handshake erfolgreich ist, die Zertifikatskette des entfernten SMTP-Servers validiert werden kann und ein DNS-Name im Zertifikat den angegebenen Übereinstimmungskriterien entspricht. Bei dieser Sicherheitsstufe wird davon ausgegangen, dass DNS-MX-Lookups sicher genug sind, und der im Serverzertifikat überprüfte Name wird möglicherweise über nicht authentifizierte DNS-MX-Lookups ermittelt. Der Name des Serverzertifikats muss entweder mit dem optionalen Attribut „match “ oder dem Wert des Parameters main.cf smtp_tls_verify_cert_match übereinstimmen. Mit Postfix ≥ 2.11 modifiziert das Attribut „tafile “ optional die Verifizierung der Vertrauenskette auf die gleiche Weise wie der Parameter smtp_tls_trust_anchor_file . Das „tafile “-Attribut kann mehrfach angegeben werden, um mehrere Vertrauensanker-Dateien zu laden. Das optionale Attribut „connection_reuse “ (Postfix ≥ 3.4) übersteuert den Parameter main.cf smtp_tls_connection_reuse . https://www.postfix.org/postconf.5.html#smtp_tls_verify_cert_match https://www.postfix.org/postconf.5.html#smtp_tls_trust_anchor_file https://www.postfix.org/postconf.5.html#smtp_tls_connection_reuse |
secure | E-Mails werden nur zugestellt, wenn der TLS-Handshake erfolgreich ist, die Zertifikatskette des entfernten SMTP-Servers validiert werden kann und ein DNS-Name im Zertifikat den angegebenen Übereinstimmungskriterien entspricht. Auf dieser Sicherheitsstufe werden DNS MX-Lookups, obwohl sie potenziell zur Bestimmung der IP-Adressen der Next-Hop-Gateways verwendet werden können, nicht als sicher genug für die TLS-Peername-Verifizierung angesehen. Stattdessen wird der im Serverzertifikat verifizierte Standardname direkt vom Next-Hop bezogen oder explizit über das optionale Attribut „match“ angegeben, das den Parameter main.cf smtp_tls_secure_cert_match ausser Kraft setzt. Die optionalen Attribute „ciphers “, „exclude “ und „protocols “ (Postfix ≥ 2.6) setzen die Konfigurationsparameter „smtp_tls_mandatory_ciphers“, „smtp_tls_mandatory_exclude_ciphers“ und smtp_tls_mandatory_protocols ausser Kraft. Mit Postfix ≥ 2.11 modifiziert das Attribut „tafile “ optional die Verifizierung der Vertrauenskette auf die gleiche Weise wie der Parameter smtp_tls_trust_anchor_file . Das „tafile “-Attribut kann mehrfach angegeben werden, um mehrere Vertrauensanker-Dateien zu laden. Das optionale Attribut „connection_reuse “ (Postfix ≥ 3.4) übersteuert den Parameter main.cf smtp_tls_connection_reuse . https://www.postfix.org/postconf.5.html#smtp_tls_secure_cert_match https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_exclude_ciphers https://www.postfix.org/postconf.5.html#smtp_tls_mandatory_protocols https://www.postfix.org/postconf.5.html#smtp_tls_trust_anchor_file https://www.postfix.org/postconf.5.html#smtp_tls_connection_reuse |
smtp_tls_wrappermode
Information | Beschreibung |
---|---|
Dokumentation | https://www.postfix.org/postconf.5.html#smtp_tls_wrappermode Postfix TLS Support |
Defaultwert | smtp_tls_wrappermode = no |
Neuer Wert | smtp_tls_wrappermode = yes |
Beschreibung | Erzwingt, dass der Postfix-SMTP-Client eine Verbindung über das submissions/smtps -Protokoll herstellt, anstatt den STARTTLS-Befehl zu verwenden. Dieser Modus erfordert smtp_tls_security_level = encrypt oder höher. |
Siehe auch | Postfix ArchLinux - Konfiguration: null client - smtps-Konfiguration - smtp_tls_security_level |
/etc/postfix/main.cf
Falls vorstehende Änderungen durchgeführt wurden, sollte ein Neustart von Postfix nichts mehr im Wege stehen.
Bevor der der postfix/master
-Daemon/Dienst zum ersten mal gestartet werden soll, ist eine Überprüfung der korrekten Konfiguration durch nachfolgenden Befehl, zu empfehlen
postconf -n
und es sollte eine Ausgabe, in etwa wie die nachfolgend gezeigte erscheinen:
# postconf -n alias_database = $alias_maps alias_maps = lmdb:${config_directory}/aliases compatibility_level = 3.9 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 inet_interfaces = loopback-only mydestination = myhostname = client.idmz.tachtler.net recipient_canonical_maps = lmdb:${config_directory}/recipient_canonical_maps relayhost = tachtler.net:465 smtp_dns_support_level = dnssec smtp_tls_CApath = ${config_directory}/ssl/certs smtp_tls_block_early_mail_reply = yes smtp_tls_chain_files = ${config_directory}/ssl/certs/client-chain.pem smtp_tls_ciphers = high smtp_tls_connection_reuse = yes smtp_tls_exclude_ciphers = ECDHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA, DHE-RSA-AES256-GCM-SHA384, DHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA, ECDHE-RSA-CAMELLIA256-SHA384, DHE-RSA-CAMELLIA256-SHA256, DHE-RSA-CAMELLIA256-SHA, AES256-SHA256, AES256-SHA, CAMELLIA256-SHA256, CAMELLIA256-SHA, ECDHE-RSA-AES128-SHA256, ECDHE-RSA-AES128-SHA, DHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA, ECDHE-RSA-CAMELLIA128-SHA256, DHE-RSA-CAMELLIA128-SHA256, DHE-RSA-CAMELLIA128-SHA, AES128-SHA256, AES128-SHA, CAMELLIA128-SHA256, CAMELLIA128-SHA smtp_tls_loglevel = 1 smtp_tls_mandatory_ciphers = high smtp_tls_mandatory_exclude_ciphers = ECDHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA, DHE-RSA-AES256-GCM-SHA384, DHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA, ECDHE-RSA-CAMELLIA256-SHA384, DHE-RSA-CAMELLIA256-SHA256, DHE-RSA-CAMELLIA256-SHA, AES256-SHA256, AES256-SHA, CAMELLIA256-SHA256, CAMELLIA256-SHA, ECDHE-RSA-AES128-SHA256, ECDHE-RSA-AES128-SHA, DHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA, ECDHE-RSA-CAMELLIA128-SHA256, DHE-RSA-CAMELLIA128-SHA256, DHE-RSA-CAMELLIA128-SHA, AES128-SHA256, AES128-SHA, CAMELLIA128-SHA256, CAMELLIA128-SHA smtp_tls_mandatory_protocols = >=TLSv1.2, <=TLSv1.3 smtp_tls_protocols = >=TLSv1.2, <=TLSv1.3 smtp_tls_security_level = secure smtp_tls_session_cache_database = lmdb:${data_directory}/smtp_scache smtp_tls_wrappermode = yes tls_append_default_CA = yes tls_random_bytes = 255 tlsproxy_tls_CApath = $smtp_tls_CApath tlsproxy_tls_ask_ccert = yes tlsproxy_tls_chain_files = $smtp_tls_chain_files tlsproxy_tls_ciphers = $smtp_tls_ciphers tlsproxy_tls_exclude_ciphers = $smtp_tls_exclude_ciphers tlsproxy_tls_loglevel = $smtp_tls_loglevel tlsproxy_tls_mandatory_ciphers = $smtp_tls_mandatory_ciphers tlsproxy_tls_mandatory_exclude_ciphers = $smtp_tls_mandatory_exclude_ciphers tlsproxy_tls_mandatory_protocols = $smtp_tls_mandatory_protocols tlsproxy_tls_protocols = $smtp_tls_protocols tlsproxy_tls_security_level = encrypt
HINWEIS - die Konfiguration des postfix/master
-Daemon/Dienst konnte korrekt gelesen werden, wenn die Konfiguration ohne Fehlermeldungen erscheint, was letztendlich zwar nicht bedeutet, das Sie auch korrekt ist, aber zumindest syntaktische Fehler ausschliesst !!!
Neustart
Zuerst sollte nun der postfix-Server mit nachfolgendem Befehle neu gestartet werden:
# systemctl restart postfix.service
Mit nachfolgendem Befehl kann der Status des Postfix-Servers abgefragt werden:
# systemctl status postfix.service ● postfix.service - Postfix Mail Transport Agent Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; preset: > Active: active (running) since Tue 2024-12-03 18:58:17 CET; 4s ago Invocation: df0ee0c93f9549798168495043342473 Process: 1275 ExecStart=/usr/bin/postfix start (code=exited, status=0/SUCCE> Main PID: 1342 (master) Tasks: 3 (limit: 2315) Memory: 2.6M (peak: 4.3M) CPU: 244ms CGroup: /system.slice/postfix.service ├─1342 /usr/lib/postfix/bin/master -w ├─1343 pickup -l -t unix -u └─1344 qmgr -l -t unix -u Dec 03 18:58:17 client systemd[1]: Starting Postfix Mail Transport Agent... Dec 03 18:58:17 client postfix[1340]: postfix/postlog: starting the Postfix mai> Dec 03 18:58:17 client postfix/postfix-script[1340]: starting the Postfix mail > Dec 03 18:58:17 client postfix/master[1342]: daemon started -- version 3.9, con> Dec 03 18:58:17 client systemd[1]: Started Postfix Mail Transport Agent.
Nachfolgender Befehl listet die IP-Adressen und die Ports auf, auf denen der Postfix-Server lauscht:
# ss -taubenp | grep postfix tcp LISTEN 0 100 127.0.0.1:25 0.0.0.0:* users:(("master",pid=1342,fd=13)) ino:10863 sk:4 cgroup:/system.slice/postfix.service <-> tcp LISTEN 0 100 [::1]:25 [::]:* users:(("master",pid=1342,fd=14)) ino:10864 sk:a cgroup:/system.slice/postfix.service v6only:1 <->
Test
Ein Test, ob die interne Kommunikation vom Postfix-null client zum Postfix-main client via TLS/StartTLS-Verschlüsselung und mittels „secure“ erzwungen wird und auf den Fingerprint des Client-Zertifikats überprüft wird, kann erst erfolgen, wenn die nachfolgenden Konfigurationen innerhalb des Konstrukts
wie folgt durchgeführt werden.
Es kann mit einem kleinen Test vom
- Postfix-null client
aus herausgefunden werden, ob lokal erzeugte e-Mails auch intern Zugestellt werden können, was ausnahmsweise mit nachfolgendem Befehl (und nicht mit telnet
) durchgeführt werden soll:
# echo "Test E-Mail - SMTPS - null client und main server" | /usr/sbin/sendmail root
Als Ergebnis sollten zwei Dinge kontrolliert werden:
- Die Log-Einträge im
systemd-journald
- Der Inhalt in der (falls nicht schon vorhandenen) neu im mbox-Format erstellten Datei
/var/spool/mail/klaus
Der Inhalte der Log-Einträge im systemd-journald
auf dem
- Postfix-null client
sollte eine Ausgabe wie nachfolgend dargestellt ergeben, was mit nachfolgendem Befehl durchgeführt werden kann:
# journalctl -u postfix*
wonach eine Ausgabe, in etwa wie die nachfolgend gezeigte erscheinen sollte: (Nur relevanter Ausschnitt):
Dec 04 21:07:36 client postfix/pickup[2260]: 7E3CC8D: uid=0 from=<root> Dec 04 21:07:36 client postfix/cleanup[2329]: 7E3CC8D: message- id=<20241204140736.7E3CC8D@client.idmz.tachtler.net> Dec 04 21:07:36 client postfix/qmgr[2136]: 7E3CC8D: from=<root@client.idmz.tachtler.net>, size=314, nrcpt=1 (queue active) Dec 04 21:07:36 client postfix/tlsproxy[2338]: CONNECT to [10.0.0.60]:465 Dec 04 21:07:36 client postfix/tlsproxy[2338]: Verified TLS connection established to mx1.tachtler.net[10.0.0.60]:465: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256 Dec 04 21:07:36 client postfix/smtp[2336]: Verified TLS connection established to mx1.tachtler.net[10.0.0.60]:465: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256 Dec 04 21:07:36 client postfix/tlsproxy[2338]: DISCONNECT [10.0.0.60]:465 Dec 04 21:07:36 client postfix/smtp[2336]: 7E3CC8D: to=<root@tachtler.net>, orig_to=<root>, relay=mx1.tachtler.net[10.0.0.60]:465, delay=0.14, delays=0.03/0.03/0.06/0.02, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 90B87180083) Dec 04 21:07:36 client postfix/qmgr[2136]: 7E3CC8D: removed
HINWEIS - Wichtig ist hier das auftauchen von
Verified TLS connection established …
Der Inhalte der Log-Einträge im systemd-journald
auf dem
- Postfix-main server
sollte eine Ausgabe wie nachfolgend dargestellt ergeben, was mit nachfolgendem Befehl durchgeführt werden kann:
# journalctl -u postfix*
wonach eine Ausgabe, in etwa wie die nachfolgend gezeigte erscheinen sollte: (Nur relevanter Ausschnitt):
Dec 04 21:07:36 server postfix/smtps/smtpd[12226]: connect from client.idmz.tachtler.net[10.0.0.80] Dec 04 21:07:36 server postfix/smtps/smtpd[12226]: Trusted TLS connection established from client.idmz.tachtler.net[10.0.0.80]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256 Dec 04 21:07:36 server postfix/smtps/smtpd[12226]: 90B87180083: client=client.idmz.tachtler.net[10.0.0.80] Dec 04 21:07:36 server postfix/cleanup[12230]: 90B87180083: message- id=<20241204140736.7E3CC8D@client.idmz.tachtler.net> Dec 04 21:07:36 server postfix/qmgr[12157]: 90B87180083: from=<root@client.idmz.tachtler.net>, size=805, nrcpt=1 (queue active) Dec 04 21:07:36 server postfix/smtps/smtpd[12226]: disconnect from client.idmz.tachtler.net[10.0.0.80] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5 Dec 04 21:07:36 server postfix/local[12231]: 90B87180083: to=<klaus@server.idmz.tachtler.net>, orig_to=<root@tachtler.net>, relay=local, delay=0.02, delays=0.01/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox) Dec 04 21:07:36 server postfix/qmgr[12157]: 90B87180083: removed
WICHTIG - Die E-Mail liegt nicht auf dem „null client“, sondern auf dem unter relayhost
definierten Ziel!
Auf dem „main server“ kann der Inhalt der im mbox-Format angelegten Datei /var/spool/mail/klaus
angesehen werden und sollte ebenfalls eine Ausgabe wie nachfolgend dargestellt ergeben, was mit nachfolgendem Befehl durchgeführt werden kann:
# cat /var/spool/mail/klaus
wonach eine Ausgabe, in etwa wie die nachfolgend gezeigte erscheinen sollte:
# cat /var/spool/mail/klaus From root@client.idmz.tachtler.net Wed Dec 4 21:07:36 2024 Return-Path: <root@client.idmz.tachtler.net> X-Original-To: root@tachtler.net Delivered-To: root@tachtler.net Received: from client.idmz.tachtler.net (client.idmz.tachtler.net [10.0.0.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "*.idmz.tachtler.net", Issuer "www.tachtler.net" (verified OK)) by mx1.tachtler.net (Postfix) with ESMTPS id 90B87180083 for <root@tachtler.net>; Wed, 04 Dec 2024 21:07:36 +0100 (CET) Received: by client.idmz.tachtler.net (Postfix, from userid 0) id 7E3CC8D; Wed, 04 Dec 2024 21:07:36 +0100 (CET) Message-Id: <20241204140736.7E3CC8D@client.idmz.tachtler.net> Date: Wed, 04 Dec 2024 21:07:36 +0100 (CET) From: root@client.idmz.tachtler.net Test E-Mail - SMTPS - null client und main server
Prüfung
HINWIES - Wenn der Fingerprint des Client-Zertifikats NICHT übereinstimmt, sollte nachfolgende Meldung im LOG erscheinen:
Postfix-null client
Dec 04 19:29:27 client postfix/smtp[1442]: ABED894: to=<root@tachtler.net>, orig_to=<root@client.idmz.tachtler.net>, relay=mx1.tachtler.net[fd00::10:10:0:0:60]:465, delay=0.02, delays=0/0/0.02/0, dsn=5.7.1, status=bounced (host mx1.tachtler.net[fd00::10:10:0:0:60] said: 554 5.7.1 <client.idmz.tachtler.net[fd00::10:10:0:0:80]>: Client host rejected: Access denied (in reply to RCPT TO command))
Postfix-main server
Dec 04 19:29:27 server postfix/smtps/smtpd[8419]: NOQUEUE: reject: RCPT from client.idmz.tachtler.net[fd00::10:10:0:0:80]: 554 5.7.1 <client.idmz.tachtler.net[fd00::10:10:0:0:80]>: Client host rejected: Access denied; from=<> to=<root@tachtler.net> proto=ESMTP helo=<client.idmz.tachtler.net>