Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.


Vorhergehende Überarbeitung
centos:mail_c7:mta_8 [20.04.2018 10:32. ] – Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
-====== SASL-Authentifizierung beim Postfix MTA 2.11 unter CentOS 7 ====== 
-Zur Authentifizierung unserer Mail-Clients gegenüber unserem Mailserver wollen wir **SMTP-Auth**((//SMTP-Authentication//)) einsetzen.  
-Da SMTP-Auth nicht regelt, wie der Mailserver auf die eigentliche Userdatenbank zugreifen kann, benötigen wir Unterstützung durch **SASL**((//**S**imple **A**uthentication and **S**ecurity **L**ayer//)). Mit Hilfe von **[[https://tools.ietf.org/html/rfc4422|SASL]]** kann für verschiede Protokolle, wie z.B. **SMTP**, **IMAP** oder **POP3**, im Internet eine Benutzerauthentifizierung relativ einfach realisiert werden, da SASL hierzu eine standardisierte Vermittlungsschicht zur Verfügung stellt. Weitere Informationen findet man auf der **[[http://de.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer|Wikipedia SASL Seite]]**, im **[[https://tools.ietf.org/html/rfc4422|RFC 4422]]**, oder auf der Webseite der **[[http://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml|IANA]]**.  
- 
-Postfix unterstützt zwei verschiedene SASL-Implementierungen, die je nach Betrachtung mehr oder minder kompliziert bei der Installation und Konfiguration sind. 
-  * **cyrus-sasl** Die SASL-Implementierung mit Hilfe der **[[http://www.cyrusimap.org/docs/cyrus-sasl/2.1.25/|cyrus-sasl Bibliothek]]** \\  
-  * **dovecot** Der **[[centos:mail_c7:dovecot_1|Dovecot IMAP-Server]]** kann für Postfix einen SASL-Service bereitstellen 
- 
-Beide Lösungen sind vom Grundsatz her gleich aufgebaut - liegt doch beiden folgende Struktur zu Grunde. 
-<uml width=300 center title="Die 3 SASLayer"> 
-  skinparam defaultFontName Courier 
- 
-  state "Client" as request 
-  request :   request  
- 
-  state "SASL-Layer" as layer { 
-    state "Authentication Interface" as auth_int  
-    state "Mechanismen" as mech  
-    state "Methoden / Password Verification Services" as method  
-    } 
- 
-  request -right-> auth_int 
-  auth_int -down-> mech 
-  mech -up-> auth_int 
-  mech --> method 
-  method --> mech 
- 
-</uml> 
- 
-Folgende Funktionen werden durch die entsprechenden Layer zur Verfügung gestellt: 
-  * **Authentication Interface**: Hauptaufgabe des //Authentication Interfaces// ist es, dem Client mitzuteilen, ob Authentifizierung angeboten wird und wenn ja, welche //Mechanismen// dabei genutzt werden können.  
-  * **Mechanismen**: Ein //Mechanismus// definiert, welche Daten zur Authentifizierung benötigt werden, z.B. Usernamen und Passwort oder z.B. ein Clientzertifikat und wie die Anmeldedaten übermittelt oder transportiert werden müssen (z.B. TLS transportverschlüsselt). 
-  * **Methoden / Password Verification Service**: Dies ist die eigentliche Kernfunktion von SASL, führen diese doch die eigentliche Überprüfung der der Anmeldedaten am Authentication-Backend (z.B. **/etc/passwd**, **LDAP** oder **mySQL**) durch. Der unterschied zwischen den //Methoden// und den //Password Verification Services// ist, dass bei den Methoden die benötigten Funktionen in einer Art //plugin// nachgeladen werden und bei den Password Verification Services dies durch eigenständige (Unter-)Programmteile realisiert wird. 
- 
-Auf dieses abstrakte Schaubild werden wir speziell bei der **cyrus-sasl**-Variante genauer eingehen. 
-===== SASL mit cyrus-sasl ===== 
-==== Grundlagen ==== 
-{{:centos:mail_c7:cyrus-sasl.png?nolink&150 |Bild: cyrus-sasl Logo}} Die älteste und auch sehr verbreitete **[[http://www.cyrusimap.org/docs/cyrus-sasl/2.1.25/|Cyrus SASL Library]]**, kann verschiedene Authentifizierungsmethoden zur Verfügung stellen, wie z.B. Plain, CRAM-MD5, Digest-MD5, PAM oder NTLM. Die scheinbare Komplexität schreckt viele Mailserver-Administratoren ab.  
- 
-Dass dies nicht unbedingt stimmt, wollen wir uns an Hand des nachfolgenden Konfigurationsbeispiels genauer ansehen. Werfen wir als erstes nocheinmal kurz einen Blick auf das zuvor gezeigte Schaubild - zum besseren Verständnis, welche Teile welche Aufgaben wahrnehmen und wo diese Teile ggf. konfiguriert werden, wurde dieses etwas erweitert. 
- 
-<uml width=900 center title="SASL-Implementierung mit Hilfe der Cyrus SASL Library"> 
-  skinparam defaultFontName Courier 
- 
- 
-state MUA as "Mail-Client des Absenders" { 
-  state "SASL Request" as request 
-  request : Der Mail-User-Agent "MUA" will 
-  request : sich authentifizieren, da er  
-  request : eine eMail an einen externen 
-  request : Empfänger senden will. (relaying) 
-} 
- 
-  state "SASL-Layer" as layer { 
-    state "Authentication Interface" as auth_int { 
-      state "SMTP-Daemon" as smtpd 
-      smtpd : Annahme der ankommenden Verbindung 
-      smtpd : sowie Durchführung der Authentifizierung 
-      smtpd : und ggf. Annahme der Nachricht  
-    } 
-    state "Mechanismen" as mech  
-    mech : PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
-    state "Methoden / Password Verification Services" as method  
-    } 
- 
-state "mySQL Datenbank" as mysql  
-  mysql : postfix-admin   
-  mysql : Datenbanktabelle 
- 
- 
- 
-  request -right-> smtpd 
-  auth_int -down-> mech 
-  mech -up-> auth_int 
-  mech --> method 
-  method --> mech 
-  method -down-> mysql 
-  mysql -up-> method 
- 
- 
-   
- note left of layer 
- 
-  /etc/sysconfig/saslauthd 
-  ├── SOCKETDIR=/run/saslauthd 
-  ├── MECH=pam 
-  └── FLAGS= 
- 
- end note 
- 
- 
- note right of mech 
- 
-  /etc/sasl2/smtpd.conf 
-  └── mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
- 
- end note 
- 
- note right of method 
- 
-  /etc/sasl2/smtpd.conf 
-  ├── pwcheck_method: auxprop 
-  ├── auxprop_plugin: sql 
-  ├── sql_engine: mysql 
-  ├── sql_hostnames: mysql.dmz.nausch.org 
-  ├── sql_database: postfix 
-  ├── sql_user: postfix_user 
-  ├── sql_passwd: rbBgeM2b2btx9iMHfzd 
-  ├── sql_select: SELECT password FROM mailbox WHERE username='%u@%r' AND active = '1' 
-  ├── sql_usessl: no 
-  └── mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
- 
- end note 
- 
- note right of smtpd 
- 
-  /etc/postfix/main.cf 
-  ├── smtpd_sasl_auth_enable = yes 
-  ├── smtpd_sasl_type = cyrus  
-  ├── smtpd_sasl_path = smtpd 
-  ├── broken_sasl_auth_clients = yes 
-  ├── smtpd_sasl_security_options = noanonymous 
-  └── smtpd_sasl_tls_security_options = $smtpd_sasl_security_options 
- 
- end note 
- 
-</uml> 
- 
-==== Installation ==== 
-Die Installation der Cyrus-SASL-Library und der benötigten Mechanismen erfolgt mit Hilfe des Paketverwaltungs-Programms **yum**. 
-   # yum install cyrus-sasl 
- 
-Was genau uns dieses Paket mitbrachte, erkunden wir mit Hilfe des folgenden Aufrufs. 
-   # rpm -qil cyrus-sasl 
-<code>Name        : cyrus-sasl 
-Version     : 2.1.26 
-Release     : 17.el7 
-Architecture: x86_64 
-Install Date: Mon 27 Oct 2014 04:34:24 PM CET 
-Group       : System Environment/Libraries 
-Size        : 144267 
-License     : BSD with advertising 
-Signature   : RSA/SHA256, Fri 04 Jul 2014 03:04:49 AM CEST, Key ID 24c6a8a7f4a80eb5 
-Source RPM  : cyrus-sasl-2.1.26-17.el7.src.rpm 
-Build Date  : Tue 10 Jun 2014 06:15:13 AM CEST 
-Build Host  : worker1.bsys.centos.org 
-Relocations : (not relocatable) 
-Packager    : CentOS BuildSystem <http://bugs.centos.org> 
-Vendor      : CentOS 
-URL         : http://asg.web.cmu.edu/sasl/sasl-library.html 
-Summary     : The Cyrus SASL library 
-Description : 
-The cyrus-sasl package contains the Cyrus implementation of SASL. 
-SASL is the Simple Authentication and Security Layer, a method for 
-adding authentication support to connection-based protocols. 
-/etc/sysconfig/saslauthd 
-/run/saslauthd 
-/usr/lib/systemd/system/saslauthd.service 
-/usr/lib/tmpfiles.d/saslauthd.conf 
-/usr/sbin/pluginviewer 
-/usr/sbin/saslauthd 
-/usr/sbin/testsaslauthd 
-/usr/share/doc/cyrus-sasl-2.1.26 
-/usr/share/doc/cyrus-sasl-2.1.26/LDAP_SASLAUTHD 
-/usr/share/man/man8/pluginviewer.8.gz 
-/usr/share/man/man8/saslauthd.8.gz 
-/usr/share/man/man8/sasldblistusers2.8.gz 
-/usr/share/man/man8/saslpasswd2.8.gz 
-/usr/share/man/man8/testsaslauthd.8.gz 
-</code> 
- 
-Da wir zur Benutzerverwaltung die WEB-Anwendung postfix.admin und die dazu nötige mySQL-Datenbank verwenden, benötigen wir noch den **//SQL auxprop Support für Cyrus SASL//**. 
-   # yum install cyrus-sasl-sql 
- 
-Den Inhalt des Authentifizierungs-Plugin zeigt uns der der Befehl ''rpm -qil cyrus-sasl-sql''. 
-   # rpm -qil cyrus-sasl-sql 
-<code>Name        : cyrus-sasl-sql 
-Version     : 2.1.26 
-Release     : 17.el7 
-Architecture: x86_64 
-Install Date: Tue 28 Oct 2014 12:00:58 PM CET 
-Group       : System Environment/Libraries 
-Size        : 28320 
-License     : BSD with advertising 
-Signature   : RSA/SHA256, Fri 04 Jul 2014 03:05:28 AM CEST, Key ID 24c6a8a7f4a80eb5 
-Source RPM  : cyrus-sasl-2.1.26-17.el7.src.rpm 
-Build Date  : Tue 10 Jun 2014 06:15:13 AM CEST 
-Build Host  : worker1.bsys.centos.org 
-Relocations : (not relocatable) 
-Packager    : CentOS BuildSystem <http://bugs.centos.org> 
-Vendor      : CentOS 
-URL         : http://asg.web.cmu.edu/sasl/sasl-library.html 
-Summary     : SQL auxprop support for Cyrus SASL 
-Description : 
-The cyrus-sasl-sql package contains the Cyrus SASL plugin which supports 
-using a RDBMS for storing shared secrets. 
-/usr/lib64/sasl2/libsql.so 
-/usr/lib64/sasl2/libsql.so.3 
-/usr/lib64/sasl2/libsql.so.3.0.0 
-</code> 
- 
-Die einzelnen SASL-Mechanismen hat der Paket-Maintainer in separate RPMs ausgelagert.  
-   # yum search cyrus-sasl- | grep support | grep x86_64 
-<code>cyrus-sasl-gs2.x86_64 : GS2 support for Cyrus SASL 
-cyrus-sasl-gssapi.x86_64 : GSSAPI authentication support for Cyrus SASL 
-cyrus-sasl-ldap.x86_64 : LDAP auxprop support for Cyrus SASL 
-cyrus-sasl-md5.x86_64 : CRAM-MD5 and DIGEST-MD5 authentication support for Cyrus 
-cyrus-sasl-ntlm.x86_64 : NTLM authentication support for Cyrus SASL 
-cyrus-sasl-plain.x86_64 : PLAIN and LOGIN authentication support for Cyrus SASL 
-cyrus-sasl-scram.x86_64 : SCRAM auxprop support for Cyrus SASL 
-cyrus-sasl-sql.x86_64 : SQL auxprop support for Cyrus SASL</code> 
- 
-Für unsere Kunden mit Ihren **MUA**((**M**ail **U**ser **A**gent))s wollen wir anbieten: 
-  * **PLAIN** und **LOGIN** 
-  * **CRAM-MD5** und **DIGEST-MD5** sowie 
-  * **NTLM** 
- 
-Wir installieren also die drei benötigten RPMs **//cyrus-sasl-plain//**, **//cyrus-sasl-md5//** und **//cyrus-sasl-ntlm//**.  
-   # yum install cyrus-sasl-plain cyrus-sasl-md5 cyrus-sasl-ntlm 
- 
-Den Inhalt der einzelnen RPMs können wir uns bei Bedarf jeweils mit ''rpm -qil <paketname>'' anzeigen lassen. 
-   # rpm -qil cyrus-sasl-plain 
-<code>Name        : cyrus-sasl-plain 
-Version     : 2.1.26 
-Release     : 17.el7 
-Architecture: x86_64 
-Install Date: Tue 28 Oct 2014 12:34:48 PM CET 
-Group       : System Environment/Libraries 
-Size        : 39968 
-License     : BSD with advertising 
-Signature   : RSA/SHA256, Fri 04 Jul 2014 03:05:21 AM CEST, Key ID 24c6a8a7f4a80eb5 
-Source RPM  : cyrus-sasl-2.1.26-17.el7.src.rpm 
-Build Date  : Tue 10 Jun 2014 06:15:13 AM CEST 
-Build Host  : worker1.bsys.centos.org 
-Relocations : (not relocatable) 
-Packager    : CentOS BuildSystem <http://bugs.centos.org> 
-Vendor      : CentOS 
-URL         : http://asg.web.cmu.edu/sasl/sasl-library.html 
-Summary     : PLAIN and LOGIN authentication support for Cyrus SASL 
-Description : 
-The cyrus-sasl-plain package contains the Cyrus SASL plugins which support 
-PLAIN and LOGIN authentication schemes. 
-/usr/lib64/sasl2/liblogin.so 
-/usr/lib64/sasl2/liblogin.so.3 
-/usr/lib64/sasl2/liblogin.so.3.0.0 
-/usr/lib64/sasl2/libplain.so 
-/usr/lib64/sasl2/libplain.so.3 
-/usr/lib64/sasl2/libplain.so.3.0.0 
-</code> 
- 
-   # rpm -qil cyrus-sasl-md5 
-<code>Name        : cyrus-sasl-md5 
-Version     : 2.1.26 
-Release     : 17.el7 
-Architecture: x86_64 
-Install Date: Tue 28 Oct 2014 12:34:46 PM CET 
-Group       : System Environment/Libraries 
-Size        : 82048 
-License     : BSD with advertising 
-Signature   : RSA/SHA256, Fri 04 Jul 2014 03:05:14 AM CEST, Key ID 24c6a8a7f4a80eb5 
-Source RPM  : cyrus-sasl-2.1.26-17.el7.src.rpm 
-Build Date  : Tue 10 Jun 2014 06:15:13 AM CEST 
-Build Host  : worker1.bsys.centos.org 
-Relocations : (not relocatable) 
-Packager    : CentOS BuildSystem <http://bugs.centos.org> 
-Vendor      : CentOS 
-URL         : http://asg.web.cmu.edu/sasl/sasl-library.html 
-Summary     : CRAM-MD5 and DIGEST-MD5 authentication support for Cyrus SASL 
-Description : 
-The cyrus-sasl-md5 package contains the Cyrus SASL plugins which support 
-CRAM-MD5 and DIGEST-MD5 authentication schemes. 
-/usr/lib64/sasl2/libcrammd5.so 
-/usr/lib64/sasl2/libcrammd5.so.3 
-/usr/lib64/sasl2/libcrammd5.so.3.0.0 
-/usr/lib64/sasl2/libdigestmd5.so 
-/usr/lib64/sasl2/libdigestmd5.so.3 
-/usr/lib64/sasl2/libdigestmd5.so.3.0.0 
-</code> 
- 
-   # rpm -qil cyrus-sasl-ntlm 
-<code>Name        : cyrus-sasl-ntlm 
-Version     : 2.1.26 
-Release     : 17.el7 
-Architecture: x86_64 
-Install Date: Tue 28 Oct 2014 01:25:57 PM CET 
-Group       : System Environment/Libraries 
-Size        : 36800 
-License     : BSD with advertising 
-Signature   : RSA/SHA256, Fri 04 Jul 2014 03:05:17 AM CEST, Key ID 24c6a8a7f4a80eb5 
-Source RPM  : cyrus-sasl-2.1.26-17.el7.src.rpm 
-Build Date  : Tue 10 Jun 2014 06:15:13 AM CEST 
-Build Host  : worker1.bsys.centos.org 
-Relocations : (not relocatable) 
-Packager    : CentOS BuildSystem <http://bugs.centos.org> 
-Vendor      : CentOS 
-URL         : http://asg.web.cmu.edu/sasl/sasl-library.html 
-Summary     : NTLM authentication support for Cyrus SASL 
-Description : 
-The cyrus-sasl-ntlm package contains the Cyrus SASL plugin which supports 
-the NTLM authentication scheme. 
-/usr/lib64/sasl2/libntlm.so 
-/usr/lib64/sasl2/libntlm.so.3 
-/usr/lib64/sasl2/libntlm.so.3.0.0 
-</code> 
- 
- 
-==== Konfiguration ==== 
-Die Konfiguration von **cyrus-sasl** erfolgt nun mit Hilfe von zwei Dateien. Die erste Datei //**/etc/sysconfig/saslauthd**// benötigt keine besondere Beachtung für unseren Anwendungsfall. 
-   # less /etc/sysconfig/saslauthd 
-<file bash /etc/sysconfig/saslauthd> 
-# Directory in which to place saslauthd's listening socket, pid file, and so 
-# on.  This directory must already exist. 
-SOCKETDIR=/run/saslauthd 
- 
-# Mechanism to use when checking passwords.  Run "saslauthd -v" to get a list 
-# of which mechanism your installation was compiled with the ablity to use. 
-MECH=pam 
- 
-# Additional flags to pass to saslauthd on the command line.  See saslauthd(8) 
-# for the list of accepted flags. 
-FLAGS= 
-</file> 
- 
-Die weitere wichtige Stelle, an der wir nun die **SASL-Mechanismen** und die **SASL Methoden & Password Verification Services** konfigurieren müssen, ist //**/etc/sasl2/smtpd.conf**//. Diese Datei wurde uns bereits bei der Installation von Postfix selbst auf unseren Server gestellt. 
-   # rpm -qf /etc/sasl2/smtpd.conf  
- 
-   postfix-2.11.1-1.el7.centos.x86_64 
- 
-Diese Konfigurationsdatei bearbeiten wir nun mit dem editor unserer wahl, z.B. **vim**. 
- 
-# vim /etc/sasl2/smtpd.conf 
-<file bash /etc/sasl2/smtpd.conf># Django : 2014-10-27 - Fehler, fehlerhafte Authentifizierungen und Warnungen loggen 
-# default: log_level: 1 
-log_level: 3 
- 
-# Django : 2014-10-27 - Das Auxiliary Property plugin für die Anbindung an das Datenbankbackend mysql  
-#          verwenden 
-# default: pwcheck_method: saslauthd 
-pwcheck_method: auxprop 
- 
-# Django : 2014-10-27 - Die Mechanismen PLAIN, LOGIN, CRAM-MD5, DIGEST-MD5 und NTLM anbieten 
-# default: mech_list: plain login 
-mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
- 
-# Django : 2014-10-27 - Definition der Datenbankanbindung an unseren mySQL-Datenbankserver 
-# default: unset 
-auxprop_plugin: sql 
-sql_engine: mysql 
-sql_hostnames: mysql.dmz.nausch.org 
-sql_database: postfix 
-sql_user: postfix_user 
-sql_passwd: rbBgeM2b2btx9iMHfzd 
-sql_select: SELECT password FROM mailbox WHERE username='%u@%r' AND active = '1' 
-sql_usessl: no 
-</file> 
- 
-==== manueller Start von Cyrus-SASL ==== 
-Da wir die Konfiguration von **Cyrus-SASL** erfolgreich beendet haben, können wir nun den zugehörigen Service starten. 
-   # systemctl start saslauthd.service 
- 
-Den erfolgreichen Start des Daemon können wir wie folgt abfragen. 
-   # systemctl status saslauthd.service 
-<code>saslauthd.service - SASL authentication daemon. 
-   Loaded: loaded (/usr/lib/systemd/system/saslauthd.service; disabled) 
-   Active: active (running) since Tue 2014-10-28 20:19:36 CET; 1min 17s ago 
-  Process: 27468 ExecStart=/usr/sbin/saslauthd -m $SOCKETDIR -a $MECH $FLAGS (code=exited, status=0/SUCCESS) 
- Main PID: 27469 (saslauthd) 
-   CGroup: /system.slice/saslauthd.service 
-           ├─27469 /usr/sbin/saslauthd -m /run/saslauthd -a pam 
-           ├─27470 /usr/sbin/saslauthd -m /run/saslauthd -a pam 
-           ├─27471 /usr/sbin/saslauthd -m /run/saslauthd -a pam 
-           ├─27472 /usr/sbin/saslauthd -m /run/saslauthd -a pam 
-           └─27473 /usr/sbin/saslauthd -m /run/saslauthd -a pam 
- 
-Oct 28 20:19:36 vml000087.dmz.nausch.org systemd[1]: Starting SASL authentication daemon.... 
-Oct 28 20:19:36 vml000087.dmz.nausch.org saslauthd[27469]: detach_tty      : master pid is: 27469 
-Oct 28 20:19:36 vml000087.dmz.nausch.org saslauthd[27469]: ipc_init        : listening on socket: /run/saslauthd/mux 
-Oct 28 20:19:36 vml000087.dmz.nausch.org systemd[1]: Started SASL authentication daemon.. 
-</code> 
- 
-==== manueller Start von Cyrus-SASL beim Systemstart ==== 
-Wollen wir den Daemon beim Hochfahren des Systems automatisch starten, greifen wir auf den Befehl **systemctl** zurück. 
-   # systemctl enable saslauthd.service 
-    
-   ln -s '/usr/lib/systemd/system/saslauthd.service' '/etc/systemd/system/multi-user.target.wants/saslauthd.service' 
- 
-Möchten wir uns vergewissern, ob der Daemon beim Systemstart gestartet wird oder nicht, erfahren wir ebenfalls mit dem Befehl **systemctl**. 
-   # systemctl is-enabled saslauthd.service 
- 
-   enabled 
- 
-Startet der Server nicht automatisch, wird uns ein "**disabled**" zurückgemeldet. 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
-==== Postfix-Konfiguration ==== 
-Die Konfiguration von SASL-Auth beim Postfix MTA gestaltet sich sehr einfach im Vergleich zu den Vorbereitungen auf Seiten von **cyrus-sasl**. Detailierte Hinweise hierzu finden wir in der entsprechenden **[[http://www.postfix.org/SASL_README.html|SASL-Dokumentation]]** von Postfix.  
- 
-Wir legen uns eine eigene Sektion in der Postfix-Konfigurationsdatei //**/etc/postfix/main.cf**// an. 
- 
-<code bash>... 
- 
-################################################################################ 
-## SASL-Authentifizierung 
-# 
-# Django : 2014-10-27 SASL Authentifizierung aktivieren 
-#          http://www.postfix.org/SASL_README.html 
-# default: smtpd_sasl_auth_enable = no 
-smtpd_sasl_auth_enable = yes 
- 
-# Django : 2014-10-27 Statt des Default SASL-Mechanismus "cyrus" wollen wir die 
-#          SALS-Implementierung von Dovecot nutzen. 
-#          http://www.postfix.org/postconf.5.html#smtpd_sasl_type 
-# default: smtpd_sasl_type = cyrus 
- 
-# Django : 2014-10-27 Definition wie Postfix das Authentifizierungsbackend 
-#          erreichen kann; dies ist entweder eine Datei mit weiteren  
-#          Konfigurationsdetails oder ein UNIX oder TCP-Socket 
-#          http://www.postfix.org/postconf.5.html#smtpd_sasl_path 
-# default: smtpd_sasl_path = smtpd 
- 
-# Django : 2014-10-27 Obsolete Authentifizierungsbefehle (RFC 4954) unter- 
-#          stützen, um so Clients wie z.B. MicroSoft Outlook Express version 4 
-#          oder MicroSoft Exchange Version 5.0 die Authentifizierungsmöglichkeit 
-#          zur Verfügung zu stellen. 
-#          http://www.postfix.org/postconf.5.html#broken_sasl_auth_clients 
-# default: broken_sasl_auth_clients = no 
-broken_sasl_auth_clients = yes 
- 
-# Django : 2014-10-27 Definition des Namen des lokalen SASL Authentifizierungs 
-#          Realm. 
-#          http://www.postfix.org/postconf.5.html#smtpd_sasl_local_domain 
-# default: smtpd_sasl_local_domain = 
- 
-# Django : 2014-10-27 Postfix SMTP Daemon SASL Sicherheitsoptionen 
-#          Welche Authentifizierungsmechanismen soll der Postfix SMTP-Daemon 
-#          den Clients anbieten? 
-#          http://www.postfix.org/postconf.5.html#smtpd_sasl_security_options 
-# default: smtpd_sasl_security_options = noanonymous 
- 
-# Django : 2014-10-27 SASL Authentifizierung Sicherheitsoptionen, die er 
-#          SMTP-Daemon für TLS verschlüsselte SMTP-Verbindungen nutzen soll. 
-#          http://www.postfix.org/postconf.5.html 
-# default: smtpd_sasl_tls_security_options = $smtpd_sasl_security_options 
- 
-... 
-</code> 
- 
-Der Der Wert **yes** beim Konfigurationsparameter **broken_sasl_auth_clients** bewirkt, dass auch Clients wie z.B. MicroSoft Outlook Express Version 4 oder MicroSoft Exchange version 5.0, die die obsoleten Authentifizierungsbefehle (RFC 4954) unterstützen, sich authentifizieren können. Man erkennt die gesetzte Option an der zweiten Zeile ''250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM'' bei den **ESMTP**-Rückmeldungen beim SMTP-Dialog nach dem sich der Client mit ''EHLO <hostname>'' gemeldet hat. 
- 
-Zur Aktivierung unserer Konfigurationsänderungen führen wir nun einen Reload unseres Daemon durch. 
-   # systemctl reload postfix 
- 
-Nachdem wir die Konfiguration von **cyrus-sasl** und unseres **postfix**-Daemon erfolgreich abgeschlossen haben, können wir uns daran machen, die **[[centos:mail_c7:mta_8?&#testen|Installation zu testen]]**. 
- 
-===== SASL mit Dovecot ===== 
-{{:centos:mail_c7:dovecot_logo.png?nolink&150 |Dovecot-Logo}} Der IMAP-Server **[[centos:mail_c7:dovecot_1|DOVECOT]]** findet immer mehr Anhänger im Postmaster-Umfeld. Dies nicht zuletzt wegen der Robustheit und der einfachen Konfigurationsmöglichkeiten. Letzteres gilt natürlich auch für das Thema SASL!  
- 
-Wie auch die **[[http://www.cyrusimap.org/docs/cyrus-sasl/2.1.25/|Cyrus SASL Library]]**, kann //Dovecot// verschiedene Authentifizierungsmethoden zur Verfügung stellen, wie z.B. Plain, CRAM-MD5, Digest-MD5, PAM oder NTLM. 
- 
-Werfen wir auch hier erst einen Blick auf das Eingangs gezeigte **[[centos:mail_c7:mta_8|Schaubild]]** - zum besseren Verständnis, welche Teile welche Aufgaben wahrnehmen und wo diese Teile ggf. konfiguriert werden, wurde auch dieses entsprechend erweitert. 
- 
-<uml width=900 center title="SASL-Implementierung mit Hilfe der Cyrus SASL Library"> 
-  skinparam defaultFontName Courier 
- 
- 
-state MUA as "Mail-Client des Absenders" { 
-  state "SASL Request" as request 
-  request : Der Mail-User-Agent "MUA" will 
-  request : sich authentifizieren, da er  
-  request : eine eMail an einen externen 
-  request : Empfänger senden will. (relaying) 
-} 
- 
-  state "SASL-Layer" as layer { 
-    state "Authentication Interface" as auth_int { 
-      state "SMTP-Daemon" as smtpd 
-      smtpd : Annahme der ankommenden Verbindung 
-      smtpd : sowie Durchführung der Authentifizierung 
-      smtpd : und ggf. Annahme der Nachricht  
-       
-      state "SASL-Daemon" as dovecot 
-      dovecot : SASL-Socket/Port des 
-      dovecot : DOVECOT-IMAP-Server 
-    } 
-    state "Mechanismen" as mech  
-    mech : PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
-    state "Methoden / Password Verification Services" as method  
-    } 
- 
-state "mySQL Datenbank" as mysql  
-  mysql : postfix-admin   
-  mysql : Datenbanktabelle 
- 
- 
- 
-  request -right-> smtpd 
-  smtpd -down-> dovecot 
-  dovecot -down-> mech 
-  mech -up-> dovecot 
-  mech --> method 
-  method --> mech 
-  method -down-> mysql 
-  mysql -up-> method 
- 
- 
- note left of method 
- 
-  /etc/dovecot/conf.d/10-auth.conf 
-  └── !include auth-sql.conf.ext 
- 
- end note 
- 
- note right of smtpd 
- 
-  /etc/postfix/main.cf 
-  ├── service auth { 
-  ├── smtpd_sasl_type = dovecot  
-  ├── smtpd_sasl_path = inet:10.0.0.77:3659 
-  ├── broken_sasl_auth_clients = yes 
-  ├── smtpd_sasl_security_options = noanonymous 
-  └── smtpd_sasl_tls_security_options = $smtpd_sasl_security_options 
- 
- end note 
- 
- note right of dovecot 
- 
-  /etc/dovecot/conf.d/10-master.conf 
-  ├── service auth { 
-  ├──── inet_listener { 
-  ├──── address = imap.dmz.nausch.org 
-  ├──── port = 3659 
-  ├─── } 
-  └── } 
- 
- end note 
- 
- note right of mech 
- 
-  /etc/dovecot/conf.d/10-auth.conf 
-  └── auth_mechanisms = plain login digest-md5 cram-md5 ntlm 
- 
- end note 
- 
-</uml> 
- 
-==== Konfiguration ==== 
-Hinweise zur Konfiguration findet man in der **[[http://wiki2.dovecot.org/HowTo/PostfixAndDovecotSASL|Dokuseite]]** von Dovecot. 
- 
-Die Auswahl der SASL-Mechanismen erfolgt beim Dovecot-IMAP-Server in der Konfigurationsdatei //**/etc/dovecot/conf.d/10-auth.conf**//. Die dort hinterlegten SASL-Mechanismen gelten sowohl für den IMAP/POP3-Daemon, wie auch für den SASL-Proxy, der für Postfix die Authentifikationsschnittstelle zur Verfügung stellt. 
-   # vim /etc/dovecot/conf.d/10-auth.conf 
- 
-<code bash>... 
- 
-# Space separated list of wanted authentication mechanisms: 
-#   plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey 
-#   gss-spnego 
-# NOTE: See also disable_plaintext_auth setting. 
-# Django : 2014-05-23 
-# default: auth_mechanisms = plain 
-auth_mechanisms = plain login digest-md5 cram-md5 ntlm 
- 
-... 
-</code> 
- 
-Wie auch schon bei den **SASL-Mechanismen** greifen wir bei den **Methoden / Password Verification Service** auf die Konfigurationen des Dovecot-IMAP-Servers zurück. Wir brauchen daher nichts weiter gesondert konfigurieren, sondern greifen auf die **[[centos:mail_c7:dovecot_6|Dovecot, Authentifizierungs]]**-Konfiguration zurück. 
-   # less /etc/dovecot/conf.d/10-auth.conf 
- 
-<code>... 
- 
-# Django : 2014-07-30 
-# Auswahl des Authentifizierungsmechanismus 
-# default: !include auth-system.conf.ext 
-#!include auth-system.conf.ext 
-!include auth-sql.conf.ext 
-</code> 
- 
-Was uns eigentlich an Konfiguration auf Seiten des Dovecot-Servers nocht fehlt ist die Schnittstelle des SASL-Proxies, also dem Punkt an dem der Postfix Mailserver die Authentifizierungsanfrage an den Dovecot-Server stellen kann. Diese Konfiguration erfolgt mit Hilfe der Konfigurationsdatei //**/etc/dovecot/conf.d/10-master.conf**//. 
-   # vim /etc/dovecot/conf.d/10-master.conf 
- 
-<code bash>... 
- 
-service auth { 
-  # auth_socket_path points to this userdb socket by default. It's typically 
-  # used by dovecot-lda, doveadm, possibly imap process, etc. Users that have 
-  # full permissions to this socket are able to get a list of all usernames and 
-  # get the results of everyone's userdb lookups. 
-  # 
-  # The default 0666 mode allows anyone to connect to the socket, but the 
-  # userdb lookups will succeed only if the userdb returns an "uid" field that 
-  # matches the caller process's UID. Also if caller's uid or gid matches the 
-  # socket's uid or gid the lookup succeeds. Anything else causes a failure. 
-  # 
-  # To give the caller full permissions to lookup all users, set the mode to 
-  # something else than 0666 and Dovecot lets the kernel enforce the 
-  # permissions (e.g. 0777 allows everyone full permissions). 
-  unix_listener auth-userdb { 
-    # Django : 2014-08-08 
-    # Authentication Socket für userdb-Anfragen bei Nutzung von shared folders 
-    # default: #mode = 0666 
-    #          #user =  
-    #          #group = 
-    user = vmail 
-    group = vmail 
-  } 
- 
-  # Postfix smtp-auth 
-  #unix_listener /var/spool/postfix/private/auth { 
-  #  mode = 0666 
-  #} 
- 
-  # Auth process is run as this user. 
-  #user = $default_internal_user 
- 
-  # Django : 2014-05-23 
-  # default: unset 
-  # Authentifizierungsport 3659 für Postfix Frontend-Mailserver definiert 
-    inet_listener { 
-     address = 10.0.0.77 
-     port = 3659 
-  } 
-} 
- 
-... 
-</code> 
- 
-<WRAP center round info> 
-Dies ist vermutlich der Grund, warum viele Administratoren der Dovecot-SASL Implementierung der Cyrus-SASL Implementierung vorziehen. 
-</WRAP> 
- 
- 
-Zur Aktivierung unserer Konfigurationsänderungen führen wir nun einen Reload des Dovecot-Daemon durch. 
-   # systemctl reload dovecot.service 
- 
- 
- 
-==== Paketfilter ==== 
-Damit unser Postfix-MTA (smtp.dmz.nausch.org) auch Authentifizierungsanfragen an unseren Dovecot-MDA (imap.dmz.nausch.org) stellen kann, muss dieser den Authentifizierungs-Port **3659** erreichen können. Wir erstellen also eine passende Regel bei unserem Paketfilter/Firewall. 
- 
-   # firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4" source address="10.0.0.87/32" port protocol="tcp" port="3659" destination address="10.0.0.77/32" accept" 
- 
-Zur Aktivierung führen wir einen Reload des Firewall-Daemon durch. 
- 
-   # firewall-cmd --reload 
- 
-Wollen wir überprüfen, ob die Regel entsprechend aktiv ist, fragen wir unsere Firewall ab. 
- 
-   # iptables -nvL IN_public_allow 
-<code>Chain IN_public_allow (1 references) 
- pkts bytes target     prot opt in     out     source               destination          
-    0     0 ACCEPT     tcp  --  *      *       10.0.0.87            10.0.0.77            tcp dpt:3659 ctstate NEW 
-    0     0 ACCEPT     tcp  --  *      *       10.0.0.87            10.0.0.77            tcp dpt:24 ctstate NEW 
-    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/           0.0.0.0/           tcp dpt:22 ctstate NEW 
-</code> 
- 
-==== Postfix-Konfiguration ==== 
-Die Konfiguration von SASL-Auth beim Postfix MTA gestaltet sich ähnlich einfach, wie beim zuvor vorgestellten Konfigurationsbeispiel bei der **[[centos:mail_c7:mta_8?&#postfix-konfiguration|Cyrus-SASL-Implementierung]]**. Detailierte Hinweise hierzu finden wir in der entsprechenden **[[http://www.postfix.org/SASL_README.html|SASL-Dokumentation]]** von Postfix.  
- 
-Wir legen uns eine eigene Sektion in der Postfix-Konfigurationsdatei //**/etc/postfix/main.cf**// an. 
- 
-<code bash>... 
- 
-################################################################################ 
-## SASL-Authentifizierung 
-# 
-# Django : 2014-10-27 SASL Authentifizierung aktivieren 
-#          http://www.postfix.org/SASL_README.html 
-# default: smtpd_sasl_auth_enable = no 
-smtpd_sasl_auth_enable = yes 
- 
-# Django : 2014-10-27 Statt des Default SASL-Mechanismus "cyrus" wollen wir die 
-#          SALS-Implementierung von Dovecot nutzen. 
-#          http://www.postfix.org/postconf.5.html#smtpd_sasl_type 
-# default: smtpd_sasl_type = cyrus 
-smtpd_sasl_type = dovecot 
- 
-# Django : 2014-10-27 Definition wie Postfix das Authentifizierungsbackend 
-#          erreichen kann; dies ist entweder eine Datei mit weiteren  
-#          Konfigurationsdetails oder ein UNIX oder TCP-Socket 
-#          http://www.postfix.org/postconf.5.html#smtpd_sasl_path 
-# default: smtpd_sasl_path = smtpd 
-smtpd_sasl_path = inet:imap.dmz.nausch.org:3659 
- 
-# Django : 2014-10-27 Obsolete Authentifizierungsbefehle (RFC 4954) unter- 
-#          stützen, um so Clients wie z.B. MicroSoft Outlook Express version 4 
-#          oder MicroSoft Exchange Version 5.0 die Authentifizierungsmöglichkeit 
-#          zur Verfügung zu stellen. 
-#          http://www.postfix.org/postconf.5.html#broken_sasl_auth_clients 
-# default: broken_sasl_auth_clients = no 
-broken_sasl_auth_clients = yes 
- 
-# Django : 2014-10-27 Definition des Namen des lokalen SASL Authentifizierungs 
-#          Realm. 
-#          http://www.postfix.org/postconf.5.html#smtpd_sasl_local_domain 
-# default: smtpd_sasl_local_domain = 
- 
-# Django : 2014-10-27 Postfix SMTP Daemon SASL Sicherheitsoptionen 
-#          Welche Authentifizierungsmechanismen soll der Postfix SMTP-Daemon 
-#          den Clients anbieten? 
-#          http://www.postfix.org/postconf.5.html#smtpd_sasl_security_options 
-# default: smtpd_sasl_security_options = noanonymous 
- 
-# Django : 2014-10-27 SASL Authentifizierung Sicherheitsoptionen, die er 
-#          SMTP-Daemon für TLS verschlüsselte SMTP-Verbindungen nutzen soll. 
-#          http://www.postfix.org/postconf.5.html 
-# default: smtpd_sasl_tls_security_options = $smtpd_sasl_security_options 
- 
-... 
-</code> 
- 
-Der Der Wert **yes** beim Konfigurationsparameter **broken_sasl_auth_clients** bewirkt, dass auch Clients wie z.B. MicroSoft Outlook Express Version 4 oder MicroSoft Exchange version 5.0, die die obsoleten Authentifizierungsbefehle (RFC 4954) unterstützen, sich authentifizieren können. Man erkennt die gesetzte Option an der zweiten Zeile ''250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM'' bei den **ESMTP**-Rückmeldungen beim SMTP-Dialog nach dem sich der Client mit ''EHLO <hostname>'' gemeldet hat. 
- 
-Zur Aktivierung unserer Konfigurationsänderungen führen wir nun einen Reload unseres Daemon durch. 
-   # systemctl reload postfix 
- 
-Nachdem wir die Konfiguration von **cyrus-sasl** und unseres **postfix**-Daemon erfolgreich abgeschlossen haben, können wir uns daran machen, die **[[centos:mail_c7:mta_8?&#testen|Installation zu testen]]**. 
- 
- 
-===== Testen ===== 
-==== Authentifizierungsoptionen ==== 
-Als erstes testen wir, ob und ggf. welche SASL-Mechanismen unser POstfix SMTP-Server nun anbietet. Dazu öffnet wir eine SMTP-Sitzung und melden uns beim SMTP-Daemon mit dem "Begrüßungsbefehl" //**EHLO**//. Der Server offeriert uns dann die SASL-Mechanismen, die er dem Client anbietet. 
-   # telnet ::1 25 
-<code>Trying ::1... 
-Connected to ::1. 
-Escape character is '^]'. 
-220 mx01.nausch.org ESMTP Postfix 
-EHLO foo 
-250-mx01.nausch.org 
-250-PIPELINING 
-250-SIZE 52428800 
-250-ETRN 
-250-STARTTLS 
-250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5 NTLM 
-250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5 NTLM 
-250-ENHANCEDSTATUSCODES 
-250 8BITMIME 
-quit 
-221 2.0.0 Bye 
-Connection closed by foreign host. 
-</code> 
- 
-An der zweiten Zeile ''250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM'' bei den **ESMTP**-Rückmeldungen beim SMTP-Dialog, nach dem sich der Client mit ''EHLO <hostname>'' gemeldet hat, sehen wir den gesetzten **broken_sasl_auth_clients = yes**. Der Der Wert **yes** beim Konfigurationsparameter **broken_sasl_auth_clients** bewirkt, dass auch Clients wie z.B. MicroSoft Outlook Express Version 4 oder MicroSoft Exchange version 5.0, die die obsoleten Authentifizierungsbefehle (RFC 4954) unterstützen, sich authentifizieren können.  
- 
-==== Test der Authentifizierung ==== 
-Zum leichteren Testen der Authentifizierung greifen wir auf das "Schweitzer Taschenmesser für SMTP" kurz **[[http://www.jetmore.org/john/code/swaks/|SWAKS]]** zurück. Vor allem beim Testen der **[[http://de.wikipedia.org/wiki/Challenge-Response-Authentifizierung|Challenge-Response-Authentifizierung]]** unterstützt uns **swaks** ebenso, wie beim Tippen der einzelnen SMTP-Befehle. 
- 
-Nach Aufruf von **swaks** werden wir nach dem zugehörigen Passwort gefragt. Anschließend sehen wir den SMTP-Dialog zwischen dem Cilene "swaks" und dem Server "postfix". 
- 
-   # swaks --to django@nausch.org --from michael@nausch.org --auth LOGIN --auth-user michael@nausch.org --header-X-Test "test email" --server 10.0.0.87 
- 
-   Password: DAx1d13g31l354u! 
- 
-<code>=== Trying 10.0.0.87:25... 
-=== Connected to 10.0.0.87. 
-<-  220 mx01.nausch.org ESMTP Postfix 
- -> EHLO vml000087.dmz.nausch.org 
-<-  250-mx01.nausch.org 
-<-  250-PIPELINING 
-<-  250-SIZE 52428800 
-<-  250-ETRN 
-<-  250-STARTTLS 
-<-  250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
-<-  250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
-<-  250-ENHANCEDSTATUSCODES 
-<-  250-8BITMIME 
-<-  250 DSN 
- -> AUTH LOGIN 
-<-  334 VXNlcm5hbWU6 
- -> bWljaGFl69BuYXVzY2gub3Jn 
-<-  334 UGFzc3dvcQ69 
- -> RGQ0bWRkMyE= 
-<-  235 2.7.0 Authentication successful 
- -> MAIL FROM:<michael@nausch.org> 
-<-  250 2.1.0 Ok 
- -> RCPT TO:<django@nausch.org> 
-<-  250 2.1.5 Ok 
- -> DATA 
-<-  354 End data with <CR><LF>.<CR><LF> 
- -> Date: Tue, 28 Oct 2014 22:59:26 +0100 
- -> To: django@nausch.org 
- -> From: michael@nausch.org 
- -> Subject: test Tue, 28 Oct 2014 22:59:26 +0100 
- -> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/ 
- -> X-Test: test email 
- ->  
- -> This is a test mailing 
- ->  
- -> . 
-<-  250 2.0.0 Ok: queued as DE611C00088 
- -> QUIT 
-<-  221 2.0.0 Bye 
-=== Connection closed with remote host. 
-</code> 
- 
-Im Maillog wird die erfolgreiche Authentifizierung und die weitere Verarbeitung unserer Mail entsprechend dokumentiert. 
- 
-   # less /var/log/maillog 
-<code>Oct 28 22:59:34 vml000087 postfix/smtpd[27693]: connect from vml000087.dmz.nausch.org[10.0.0.87] 
-Oct 28 22:59:34 vml000087 postfix/smtpd[27693]: DE611C00088: client=vml000087.dmz.nausch.org[10.0.0.87], sasl_method=LOGIN, sasl_username=michael@nausch.org 
-Oct 28 22:59:34 vml000087 postfix/cleanup[27698]: DE611C00088: message-id=<20141028215934.DE611C00088@mx01.nausch.org> 
-Oct 28 22:59:34 vml000087 postfix/qmgr[27526]: DE611C00088: from=<michael@nausch.org>, size=502, nrcpt=1 (queue active) 
-Oct 28 22:59:34 vml000087 postfix/smtpd[27693]: disconnect from vml000087.dmz.nausch.org[10.0.0.87] 
-Oct 28 22:59:35 vml000087 postfix/lmtp[27699]: DE611C00088: to=<django@nausch.org>, relay=10.0.0.77[10.0.0.77]:24, delay=0.38, delays=0.06/0.01/0/0.31, dsn=2.0.0, status=sent (250 2.0.0 <django@nausch.org> l2nwKlYRUFSFQwAArK2B9Q Saved) 
-Oct 28 22:59:35 vml000087 postfix/qmgr[27526]: DE611C00088: removed 
-</code> 
- 
-**swaks** beherrscht natürlich auch das Verfahren **CRAM-MD5**: 
-   # swaks --to django@nausch.org --from michael@nausch.org --auth CRAM-MD5 --auth-user michael@nausch.org --header-X-Test "test email" --server 10.0.0.87 
- 
-   Password: DAx1d13g31l354u! 
- 
-<code>=== Trying 10.0.0.87:25... 
-=== Connected to 10.0.0.87. 
-<-  220 mx01.nausch.org ESMTP Postfix 
- -> EHLO vml000087.dmz.nausch.org 
-<-  250-mx01.nausch.org 
-<-  250-PIPELINING 
-<-  250-SIZE 52428800 
-<-  250-ETRN 
-<-  250-STARTTLS 
-<-  250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
-<-  250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
-<-  250-ENHANCEDSTATUSCODES 
-<-  250-8BITMIME 
-<-  250 DSN 
- -> AUTH CRAM-MD5 
-<-  334 PDI2OTAzMjcP1ffp4ff0NzA1MUBteDAxLm5hdXNjaC5vcmc+ 
- -> bWljaGP1ffp4ffFlbEBuYXVzY2MwNzczOTg2ZmQ1ZjP1ffp4ffUzOWNkOWE0YTM1ZGMx 
-<-  235 2.7.0 Authentication successful 
- -> MAIL FROM:<michael@nausch.org> 
-<-  250 2.1.0 Ok 
- -> RCPT TO:<django@nausch.org> 
-<-  250 2.1.5 Ok 
- -> DATA 
-<-  354 End data with <CR><LF>.<CR><LF> 
- -> Date: Tue, 28 Oct 2014 22:51:47 +0100 
- -> To: django@nausch.org 
- -> From: michael@nausch.org 
- -> Subject: test Tue, 28 Oct 2014 22:51:47 +0100 
- -> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/ 
- -> X-Test: test email 
- ->  
- -> This is a test mailing 
- ->  
- -> . 
-<-  250 2.0.0 Ok: queued as CCB35C00088 
- -> QUIT 
-<-  221 2.0.0 Bye 
-=== Connection closed with remote host. 
-</code> 
- 
-Maillog: 
-<code>Oct 28 22:51:51 vml000087 postfix/smtpd[27669]: connect from vml000087.dmz.nausch.org[10.0.0.87] 
-Oct 28 22:51:51 vml000087 postfix/smtpd[27669]: CCB35C00088: client=vml000087.dmz.nausch.org[10.0.0.87], sasl_method=CRAM-MD5, sasl_username=michael@nausch.org 
-Oct 28 22:51:51 vml000087 postfix/cleanup[27674]: CCB35C00088: message-id=<20141028215151.CCB35C00088@mx01.nausch.org> 
-Oct 28 22:51:51 vml000087 postfix/qmgr[27526]: CCB35C00088: from=<michael@nausch.org>, size=502, nrcpt=1 (queue active) 
-Oct 28 22:51:51 vml000087 postfix/smtpd[27669]: disconnect from vml000087.dmz.nausch.org[10.0.0.87] 
-Oct 28 22:51:51 vml000087 postfix/lmtp[27675]: CCB35C00088: to=<django@nausch.org>, relay=10.0.0.77[10.0.0.77]:24, delay=0.12, delays=0.04/0.02/0/0.06, dsn=2.0.0, status=sent (250 2.0.0 <django@nausch.org> 3B0zBGIPUFTOQgAArK2B9Q Saved) 
-Oct 28 22:51:51 vml000087 postfix/qmgr[27526]: CCB35C00088: removed 
-</code> 
- 
-Zu guter Letzt testen wir noch das Verfahren **NTLM**. 
-   # swaks --to django@nausch.org --from michael@nausch.org --auth NTLM --auth-user michael@nausch.org --header-X-Test "test email" --server 10.0.0.87 
- 
-   Password: DAx1d13g31l354u! 
- 
-<code>=== Trying 10.0.0.87:25... 
-=== Connected to 10.0.0.87. 
-<-  220 mx01.nausch.org ESMTP Postfix 
- -> EHLO vml000087.dmz.nausch.org 
-<-  250-mx01.nausch.org 
-<-  250-PIPELINING 
-<-  250-SIZE 52428800 
-<-  250-ETRN 
-<-  250-STARTTLS 
-<-  250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
-<-  250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM 
-<-  250-ENHANCEDSTATUSCODES 
-<-  250-8BITMIME 
-<-  250 DSN 
- -> AUTH NTLM 
-<-  334  
- -> TlRMTVNTUBABAAAAB6IAAAAAAAAAAAAAAAAAAAAAAAA= 
-<-  334 TlRMTVNTUABCAAAAHgAeADAAAAAF0gIAJsLjyygqM30AAAAAAAAAAAAAAAAAAAAATQBYADAAMQAuAE4AQQBVAFMAQwBIAC4ATwBSAEcA 
- -> TlRTFMNTUAADAAAAGAAYAEAAAAAYABgAWAAAAB4AHgBwAAAAJAAkAI4AAAAkACQAsgAAAAAAAACWAAAABaICAJj/ymDAxyE253qytBGRgm2wg7GOYB4byOvGaTn7wPf/wxTL7okh3kAnFN5KHfE0DAxyB4bywADEALgBOAEEAVQBTAEMASAAuAE8AUgBHAG0AaQBjAGgAYQBlAGwAQABuAGEQBzAGMAaAAuAG8AcgBnAG0AaQBjAGgAYQBlwAQABuAGEAdQBzAGMADAxyB4byAG8AcgBnAA== 
-<-  235 2.7.0 Authentication successful 
- -> MAIL FROM:<michael@nausch.org> 
-<-  250 2.1.0 Ok 
- -> RCPT TO:<django@nausch.org> 
-<-  250 2.1.5 Ok 
- -> DATA 
-<-  354 End data with <CR><LF>.<CR><LF> 
- -> Date: Tue, 28 Oct 2014 22:55:33 +0100 
- -> To: django@nausch.org 
- -> From: michael@nausch.org 
- -> Subject: test Tue, 28 Oct 2014 22:55:33 +0100 
- -> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/ 
- -> X-Test: test email 
- ->  
- -> This is a test mailing 
- ->  
- -> . 
-<-  250 2.0.0 Ok: queued as BDD65C00088 
- -> QUIT 
-<-  221 2.0.0 Bye 
-=== Connection closed with remote host. 
-</code> 
- 
-Maillog: 
-<code>Oct 28 22:55:37 vml000087 postfix/smtpd[27681]: connect from vml000087.dmz.nausch.org[10.0.0.87] 
-Oct 28 22:55:37 vml000087 postfix/smtpd[27681]: BDD65C00088: client=vml000087.dmz.nausch.org[10.0.0.87], sasl_method=NTLM, sasl_username=michael@nausch.org 
-Oct 28 22:55:37 vml000087 postfix/cleanup[27686]: BDD65C00088: message-id=<20141028215537.BDD65C00088@mx01.nausch.org> 
-Oct 28 22:55:37 vml000087 postfix/qmgr[27526]: BDD65C00088: from=<michael@nausch.org>, size=502, nrcpt=1 (queue active) 
-Oct 28 22:55:37 vml000087 postfix/smtpd[27681]: disconnect from vml000087.dmz.nausch.org[10.0.0.87] 
-Oct 28 22:55:38 vml000087 postfix/lmtp[27687]: BDD65C00088: to=<django@nausch.org>, relay=10.0.0.77[10.0.0.77]:24, delay=0.24, delays=0.04/0.02/0/0.17, dsn=2.0.0, status=sent (250 2.0.0 <django@nausch.org> UTXtEMoQUFRnQwAArK2B9Q Saved) 
-Oct 28 22:55:38 vml000087 postfix/qmgr[27526]: BDD65C00088: removed 
-</code> 
- 
-===== SASL und Submission/Relaying ===== 
-Damit nun unsere authentifizierten Nutzer, wie auch Clients aus unserem eigenen Netz oder auch z.B. der Backupmailserver auch über unseren Server, Empfänger fremder Maildomains Nachrichten schicken können (relayen) passen wir noch die Konfiguration unseres Mailservers an. 
-==== Relaying ==== 
-In der Hauptkonfigurationsdatei //**/etc/postfix/main.cf**// legen wir eine neue Section **SMTP Relay Restrictions** an. 
-   # vim /etc/postfix/main.cf 
-<code bash>...  
- 
-################################################################################ 
-## SMTP Relay Restrictions 
-# 
-# Django : 2014-10-27 - Definition, wer über unseren MX relayen darf oder nicht.  
-#          http://www.postfix.org/postconf.5.html#smtpd_relay_restrictions 
-# default: smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination 
-# 
-smtpd_relay_restrictions = 
-# Unsere eigenen Nutzer zulassen-/erlauben 
-           permit_sasl_authenticated 
-           permit_mynetworks 
-# Backupserver (MX) erlauben 
-           permit_mx_backup 
-# alles andere an relaying verbieten, d.h. mit einem finalen error 550 abweisen 
-           reject_unauth_destination 
- 
-... 
-</code> 
- 
-==== Submission ==== 
-Auch bei Submission auf Port **587** setzen wir die Option **permit_sasl_authenticated**. 
-   # vim /etc/postfix/master.cf 
- 
-<code bash>... 
- 
-# Django : 2014-10-27 Submission auf Port 587 geöffnet 
-submission inet n                               smtpd 
-  -o syslog_name=postfix/submission 
-  -o smtpd_tls_security_level=encrypt 
-  -o smtpd_sasl_auth_enable=yes 
-  -o smtpd_reject_unlisted_recipient=no 
-  -o smtpd_etrn_restrictions=reject 
-  #-o smtpd_client_restrictions=$mua_client_restrictions 
-  #-o smtpd_helo_restrictions=$mua_helo_restrictions 
-  #-o smtpd_sender_restrictions=$mua_sender_restrictions 
-  -o smtpd_recipient_restrictions= 
-  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject 
-  -o milter_macro_daemon_name=ORIGINATING 
-  -o mydestination=lists.nausch.org,fax.nausch.org 
- 
-... 
-</code> 
- 
-====== Links ====== 
-  * **⇐ [[centos:mail_c7:mta_7|Zurück zum Kapitel "virtuelle(r) Mailserver unter Postfix 2.11. und CentOS 7"]]** 
-  * **⇒ [[centos:mail_c7:mta_9|Weiter zum Kapitel "Backup-Mailserver mit Postfix 2.11 unter CentOS7"]]** 
-  * **[[centos:mail_c7:start|Zurück zum Kapitel >>Mailserverinstallation unter CentOS 7<<]]** 
-  * **[[wiki:start|Zurück zu >>Projekte und Themenkapitel<<]]** 
-  * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]** 
- 
-~~AUTOTWEET:~~ 
  
  • centos/mail_c7/mta_8.txt
  • Zuletzt geändert: 20.05.2021 12:43.
  • von 127.0.0.1