Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:mail_c6:mta_14 [18.03.2014 13:17. ] – angelegt django | centos:mail_c6:mta_14 [21.11.2022 20:53. ] (aktuell) – [SRS - Sender Rewriting Scheme] django | ||
---|---|---|---|
Zeile 5: | Zeile 5: | ||
Das nachfolgende Schaubild verdeutlicht, | Das nachfolgende Schaubild verdeutlicht, | ||
- | < | + | <uml> |
title Mailversand einer eMail bei Weiterleitung (alias)\n | title Mailversand einer eMail bei Weiterleitung (alias)\n | ||
- | skin BlueModern | + | |
participant "\n Mail-Server mx1.example.org \n 88.217.127.21 \n" as links | participant "\n Mail-Server mx1.example.org \n 88.217.127.21 \n" as links | ||
participant "\n Mail-Server mx01.nausch.org \n 217.91.103.190 \n" as mitte | participant "\n Mail-Server mx01.nausch.org \n 217.91.103.190 \n" as mitte | ||
Zeile 56: | Zeile 56: | ||
Sollte die eMail zu uns zurück-bouncen, | Sollte die eMail zu uns zurück-bouncen, | ||
- | ==== Installation ==== | + | ===== Installation ===== |
+ | |||
+ | Für **SRS** setzen wir den **[[https:// | ||
+ | # man 5 tcp_table | ||
+ | <code bash> | ||
+ | |||
+ | NAME | ||
+ | | ||
+ | |||
+ | SYNOPSIS | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | DESCRIPTION | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | To test lookup tables, use the " | ||
+ | |||
+ | PROTOCOL DESCRIPTION | ||
+ | The TCP map class implements a very simple protocol: the client | ||
+ | | ||
+ | by the ASCII newline character. Request and reply parameters (see below) | ||
+ | | ||
+ | |||
+ | Send and receive operations must complete in 100 seconds. | ||
+ | |||
+ | REQUEST FORMAT | ||
+ | Each request specifies a command, a lookup key, and possibly a lookup result. | ||
+ | |||
+ | get SPACE key NEWLINE | ||
+ | Look up data under the specified key. | ||
+ | put SPACE key SPACE value NEWLINE | ||
+ | This request is currently not implemented. | ||
+ | |||
+ | REPLY FORMAT | ||
+ | | ||
+ | | ||
+ | |||
+ | 500 SPACE text NEWLINE | ||
+ | In case of a lookup request, the requested data does not exist. | ||
+ | request, the request was rejected. | ||
+ | |||
+ | 400 SPACE text NEWLINE | ||
+ | This indicates | ||
+ | client should retry the request later. | ||
+ | |||
+ | 200 SPACE text NEWLINE | ||
+ | The request was successful. In the case of a lookup | ||
+ | encoded version of the requested data. | ||
+ | |||
+ | ENCODING | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | The Postfix client always encodes a request. | ||
+ | reply is guaranteed to not contain the % or NEWLINE character. | ||
+ | |||
+ | SECURITY | ||
+ | Do not use TCP lookup tables for security critical purposes. | ||
+ | not protected and the server is not authenticated. | ||
+ | |||
+ | BUGS | ||
+ | Only the lookup method is currently implemented. | ||
+ | |||
+ | The client does not hang up when the connection is idle for a long time. | ||
+ | |||
+ | SEE ALSO | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | README FILES | ||
+ | Use " | ||
+ | | ||
+ | |||
+ | LICENSE | ||
+ | The Secure Mailer license must be distributed with this software. | ||
+ | |||
+ | AUTHOR(S) | ||
+ | | ||
+ | IBM T.J. Watson Research | ||
+ | P.O. Box 704 | ||
+ | | ||
+ | |||
+ | TCP_TABLE(5) | ||
+ | </ | ||
+ | Ob der im Einsatz befindliche Postfix diese Tabellen unterstützt, | ||
+ | # postconf -d | grep mail_version && postconf -m | ||
+ | |||
+ | < | ||
+ | milter_macro_v = $mail_name $mail_version | ||
+ | btree | ||
+ | cidr | ||
+ | environ | ||
+ | hash | ||
+ | ldap | ||
+ | mysql | ||
+ | nis | ||
+ | pcre | ||
+ | proxy | ||
+ | regexp | ||
+ | static | ||
+ | unix | ||
+ | </ | ||
+ | |||
+ | ==== Postfix ==== | ||
+ | Leider unterstützt der aus dem Base-Repository stammende Postfix in der Version 2.6.6 keine TCP Lookup Tabellen, so dass wir auf eine neuere Version ausweichen müssen. | ||
+ | |||
+ | Die Firma [[http:// | ||
+ | |||
+ | Wir laden uns also die entsprechenden RPM-Pakete auf unseren Server, dazu wechslen wir aber erst in unser lokales Programmarchiv. | ||
+ | # cd / | ||
+ | Dann holen wir uns die zwei Pakete via **wget**. | ||
+ | # wget http:// | ||
+ | |||
+ | # wget http:// | ||
+ | |||
+ | Haben wir unseren Mailserver zuvor noch nicht installiert und konfiguriert, | ||
+ | |||
+ | Bevor wir nun mit der Installation der beiden Pakete beginnen, stoppen wir ggf. unseren bereits laufenden Postfix-Mailserver. | ||
+ | # service postfix stop | ||
+ | |||
+ | Shutting down postfix: | ||
+ | |||
+ | Haben wir noch keinen Postfix-Mailserver installiert, | ||
+ | # yum localinstall --nogpgcheck postfix-2.10.0-1.el6.x86_64.rpm postfix-perl-scripts-2.10.0-1.el6.x86_64.rpm | ||
+ | |||
+ | Haben wir bereits eine Installation und Konfiguration unseres Postfix-Mailservers vorzuweisen, | ||
+ | # yum localupdate --nogpgcheck postfix-2.10.0-1.el6.x86_64.rpm postfix-perl-scripts-2.10.0-1.el6.x86_64.rpm | ||
+ | |||
+ | Mit dem Aufruf von **postconf** werden uns dann etwaige Konfigurationsparameter, | ||
+ | # service postfix start | ||
+ | |||
+ | Starting postfix: | ||
+ | |||
+ | Damit unser aktueller Postfix nicht bei einem Systemupdate ggf. überschrieben wird, excludieren wir diesen im alten Base-Repository. | ||
+ | # vim / | ||
+ | |||
+ | <file bash / | ||
+ | [updates] | ||
+ | # Django : 2014-03-17 | ||
+ | exclude=postfix* | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Fragen wir nun erneut die Lookup Tabellen Unterstützungen ab, werden uns im Gegensatz zur Version 2.6.6 bei der 2.10.0 wesentlich mehr angeboten. | ||
+ | # postconf -d | grep mail_version && postconf -m | ||
+ | |||
+ | < | ||
+ | protocol | ||
+ | milter_macro_v = $mail_name $mail_version | ||
+ | btree | ||
+ | cidr | ||
+ | environ | ||
+ | fail | ||
+ | hash | ||
+ | internal | ||
+ | ldap | ||
+ | memcache | ||
+ | mysql | ||
+ | nis | ||
+ | pcre | ||
+ | proxy | ||
+ | regexp | ||
+ | socketmap | ||
+ | static | ||
+ | tcp | ||
+ | texthash | ||
+ | unix | ||
+ | </ | ||
+ | |||
+ | ==== SRS-Deamon ==== | ||
+ | Als laden wir uns das aktuelle RPM auf unseren Server. | ||
+ | # cd / | ||
+ | |||
+ | # wget http:// | ||
+ | |||
+ | Dann installieren wir das Paket. | ||
+ | # yum localinstall postsrsd-1.0.1-1.el6.x86_64.rpm | ||
+ | |||
+ | Altenativ können wir das Paket natürlich auch direkt von [[http:// | ||
+ | # yum localinstall http:// | ||
+ | |||
+ | Ein Update des Paketes geht entsprechend der Installation. | ||
+ | # yum localupdate http:// | ||
+ | |||
+ | Was uns das Paket alles mitbringt, zeigt uns wie immer der Aufruf von **rpm -qil < | ||
+ | # rpm -qil postsrsd | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Install Date: Fri 28 Mar 2014 11:14:34 AM CET Build Host: vml010039.intra.nausch.org | ||
+ | Group : System Environment/ | ||
+ | Size : 41781 License: GPLV2+ | ||
+ | Signature | ||
+ | Packager | ||
+ | URL : https:// | ||
+ | Summary | ||
+ | Description : | ||
+ | PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based | ||
+ | lookup tables for Postfix. SRS is needed if your mail server acts | ||
+ | as forwarder. | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ===== Konfiguration ===== | ||
+ | |||
+ | ==== SRS-Deamon ==== | ||
+ | Die Konfiguration des **postsrsd**-Daemons gestaltet sich vergleichsweise einfach und erfolgt lediglich mit Hilfe Der Datei // | ||
+ | Mit unserem Editor der Wahl, z.B. vim bearbeiten wir diese Konfigurationsdatei. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | |||
+ | # Local domain name. | ||
+ | # Addresses are rewritten to originate from this domain. The default value | ||
+ | # is taken from `postconf -h mydomain` and probably okay. | ||
+ | # | ||
+ | # | ||
+ | # Django : 2014-03-27 | ||
+ | SRS_DOMAIN=nausch.org | ||
+ | |||
+ | # Exclude additional domains. | ||
+ | # You may list domains which shall not be subjected to address rewriting. | ||
+ | # If a domain name starts with a dot, it matches all subdomains, but not | ||
+ | # the domain itself. Separate multiple domains by space or comma. | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Secret key to sign rewritten addresses. | ||
+ | # When postsrsd is installed for the first time, a random secret is generated | ||
+ | # and stored in / | ||
+ | # | ||
+ | # | ||
+ | # Django : 2014-03-27 | ||
+ | SRS_SECRET=/ | ||
+ | |||
+ | # Local ports for TCP list. | ||
+ | # These ports are used to bind the TCP list for postfix. If you change | ||
+ | # these, you have to modify the postfix settings accordingly. The ports | ||
+ | # are bound to the loopback interface, and should never be exposed on | ||
+ | # the internet. | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Django : 2014-03-27 | ||
+ | SRS_FORWARD_PORT=10001 | ||
+ | SRS_REVERSE_PORT=10002 | ||
+ | |||
+ | # Drop root privileges and run as another user after initialization. | ||
+ | # This is highly recommended as postsrsd handles untrusted input. | ||
+ | # | ||
+ | RUN_AS=nobody | ||
+ | </ | ||
+ | |||
+ | ==== Postfix ==== | ||
+ | In der Postfix-Konfigurationsdatei // | ||
+ | |||
+ | <file bash / | ||
+ | |||
+ | # Django : 2014-03-18 | ||
+ | # Lookup-Tabelle zum Umschreibungen von Absender eMail-Adressen im SMTP-Envelop und im Header der eMail | ||
+ | sender_canonical_maps = btree:/ | ||
+ | # | ||
+ | # Definition welche Adressen umgeschrieben werden sollen | ||
+ | sender_canonical_classes = envelope_sender | ||
+ | # | ||
+ | # Lookup-Tabelle zum Umschreibungen von Empfänger eMail-Adressen im SMTP-Envelop und im Header der eMail | ||
+ | recipient_canonical_maps = btree:/ | ||
+ | # | ||
+ | # Definition welche Adressen umgeschrieben werden sollen | ||
+ | recipient_canonical_classes = envelope_recipient | ||
+ | |||
+ | ...</ | ||
+ | |||
+ | ===== Programmstart ===== | ||
+ | ==== erster manueller Start des Daemon ==== | ||
+ | Nun können wir das erste mal **PostSRSd** anstarten. | ||
+ | # service postsrsd start | ||
+ | |||
+ | Starting Postfix Sender Rewriting Scheme Daemon: | ||
+ | |||
+ | In der Prozessliste finden wir mindestens einen neuen Prozess, der gestartet wurde: | ||
+ | # ps aux | grep postsrsd | ||
+ | |||
+ | nobody | ||
+ | nobody | ||
+ | nobody | ||
+ | nobody | ||
+ | |||
+ | Mittels **netstat** können wir überpfüfen, | ||
+ | # netstat -tulpen | grep 1000 | ||
+ | |||
+ | tcp 0 0 127.0.0.1: | ||
+ | tcp 0 0 127.0.0.1: | ||
+ | |||
+ | Läuft unser Daemon kann mit Hilfe von **lsof** sehen wir nicht nur den geöffneten port, sondern auch die Verbindungen die dort anliegen. | ||
+ | # lsof -i :10001 | ||
+ | |||
+ | COMMAND | ||
+ | postsrsd 6170 nobody | ||
+ | postsrsd 7151 nobody | ||
+ | cleanup | ||
+ | postsrsd 7300 nobody | ||
+ | postsrsd 7300 nobody | ||
+ | postsrsd 7301 nobody | ||
+ | |||
+ | # lsof -i :10002 | ||
+ | |||
+ | postsrsd 6170 nobody | ||
+ | smtpd 7146 postfix | ||
+ | postsrsd 7151 nobody | ||
+ | postsrsd 7151 nobody | ||
+ | cleanup | ||
+ | postsrsd 7300 nobody | ||
+ | postsrsd 7301 nobody | ||
+ | postsrsd 7301 nobody | ||
+ | |||
+ | ==== automatisches Starten des Dienste beim Systemstart | ||
+ | Damit der Deamon **PostSRSd** automatisch bei jedem Systemstart startet, denn ohne laufenden **postsrsd** verweigert nun unser **postfix** die Annahme der Nachrichten, | ||
+ | # chkconfig postsrsd on | ||
+ | |||
+ | Die Überprüfungung ob postsrsd wirklich bei jedem Systemstart automatisch mit gestartet werden, kann durch folgenden Befehle erreicht werden: | ||
+ | # chkconfig --list | grep postsrsd | ||
+ | |||
+ | | ||
+ | Wichtig sind jeweils die Schalter **on** bei den Runleveln - **2 3 4 5**. | ||
+ | |||
+ | ===== Umschreibungen / Logging ===== | ||
+ | Im Maillog unseres Mailservers werden die Umschreibungen entsprechend dokumentiert. | ||
+ | # less / | ||
+ | |||
+ | Mar 18 21:01:59 vml000080 postsrsd[5806]: | ||
+ | |||
+ | Im Header zugestellten eMail beim Empfänger wird dies auch im **Return-Path**hinterlegt. | ||
+ | Return-Path: | ||
+ | |||
+ | Bounced das Zielsystem die Nachricht, weil dieses z.B. die Nachricht wegen einer vollen Mailbox nicht zustellen kann, kann das relayende System nun problemlos den eigentlichen Absender informieren, | ||
+ | |||
+ | Mar 13 21:27:25 vml000080 postsrsd[6883]: | ||
+ | ... | ||
+ | ... | ||
+ | Mar 18 21:27:26 vml000080 postfix/ | ||
+ | |||
+ | ====== Links ====== | ||
+ | * **[[centos: | ||
+ | * **[[wiki: | ||
+ | * **[[http:// | ||
+ | |||
- | FIXME //... coming soon...// FIXME |