Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung |
tachtler:postfix_centos_7_-_multiple_instanzen [2019/05/20 08:55] – [Instanz löschen] klaus | tachtler:postfix_centos_7_-_multiple_instanzen [2019/05/22 10:03] (aktuell) – [Nützliche Befehle] klaus |
---|
| |
:!: **HINWEIS** - **Als __Ausgangssituation__ wird die __Standard__-Konfiguration von [[http://www.postfix.org/|Postfix]] verwendet, so wie diese unter [[https://www.centos.org/|CentOS]]-7 ausgeliefert wird, damit nicht durch weitere Konfigurationen von der wesentliche [[http://www.postfix.org/|Postfix]]-Instanzkonfiguration abgelegt wird!** | :!: **HINWEIS** - **Als __Ausgangssituation__ wird die __Standard__-Konfiguration von [[http://www.postfix.org/|Postfix]] verwendet, so wie diese unter [[https://www.centos.org/|CentOS]]-7 ausgeliefert wird, damit nicht durch weitere Konfigurationen von der wesentliche [[http://www.postfix.org/|Postfix]]-Instanzkonfiguration abgelegt wird!** |
| |
| ==== Postfix Version 2.x ==== |
| |
Nachfolgende die Verzeichnisstruktur der **Standard**-[[http://www.postfix.org/|Postfix]]-Konfiguration **__VOR__** dem Einsatz von Muliplen-[[http://www.postfix.org/|Postfix]]-Instanzen: | Nachfolgende die Verzeichnisstruktur der **Standard**-[[http://www.postfix.org/|Postfix]]-Konfiguration **__VOR__** dem Einsatz von Muliplen-[[http://www.postfix.org/|Postfix]]-Instanzen: |
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 138555 6150/master | tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 138555 6150/master |
</code> | </code> |
| |
| ==== Postfix Version 3.x ==== |
| |
| Nachfolgende die Verzeichnisstruktur der **Standard**-[[http://www.postfix.org/|Postfix]]-Konfiguration **__VOR__** dem Einsatz von Muliplen-[[http://www.postfix.org/|Postfix]]-Instanzen: |
| <code> |
| # ls -l /etc/postfix/ |
| total 252 |
| -rw-r--r-- 1 root root 21535 Apr 3 16:14 access |
| -rw-r--r-- 1 root root 13194 Apr 3 16:14 canonical |
| -rw-r--r-- 1 root root 164 Apr 3 16:14 dynamicmaps.cf |
| drwxr-xr-x 2 root root 6 Apr 3 16:14 dynamicmaps.cf.d |
| -rw-r--r-- 1 root root 10221 Apr 3 16:14 generic |
| -rw-r--r-- 1 root root 23802 Apr 3 16:14 header_checks |
| -rw-r--r-- 1 root root 28035 May 20 10:45 main.cf |
| -rw-r--r-- 1 root root 27742 Apr 3 16:14 main.cf.proto |
| -rw-r--r-- 1 root root 6360 Apr 3 16:14 master.cf |
| -rw-r--r-- 1 root root 6360 Apr 3 16:14 master.cf.proto |
| -rw-r--r-- 1 root root 21106 Apr 3 16:14 postfix-files |
| -rw-r--r-- 1 root root 6929 Apr 3 16:14 relocated |
| -rw-r--r-- 1 root root 12666 Apr 3 16:14 transport |
| -rw-r--r-- 1 root root 13963 Apr 3 16:14 virtual |
| </code> |
| |
| Nachfolgende die **Standard**-[[http://www.postfix.org/|Postfix]]-Konfiguration **__VOR__** dem Einsatz von Muliplen-[[http://www.postfix.org/|Postfix]]-Instanzen: |
| <code> |
| # postconf -n |
| postconf: warning: inet_protocols: disabling IPv6 name/address support: Address family not supported by protocol |
| alias_database = hash:/etc/aliases |
| alias_maps = hash:/etc/aliases |
| command_directory = /usr/sbin |
| compatibility_level = 2 |
| daemon_directory = /usr/libexec/postfix |
| data_directory = /var/lib/postfix |
| debug_peer_level = 2 |
| debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 |
| html_directory = no |
| inet_interfaces = localhost |
| mail_owner = postfix |
| mailq_path = /usr/bin/mailq.postfix |
| manpage_directory = /usr/share/man |
| meta_directory = /etc/postfix |
| mydestination = $myhostname, localhost.$mydomain, localhost |
| newaliases_path = /usr/bin/newaliases.postfix |
| queue_directory = /var/spool/postfix |
| readme_directory = /usr/share/doc/postfix-3.4.5/README_FILES |
| sample_directory = /usr/share/doc/postfix-3.4.5/samples |
| sendmail_path = /usr/sbin/sendmail.postfix |
| setgid_group = postdrop |
| shlib_directory = /usr/lib/postfix |
| unknown_local_recipient_reject_code = 550 |
| </code> |
| |
| :!: **HINWEIS** - **IPv6 ist auf diesem Server __deaktiviert__, daher die Fehlermeldung in der ersten Zeile!** |
| |
| :!: **HINWEIS** - Um die oben gezeigte Fehlermeldung auf einem Server **__ohne__ IPv6-Unterstützung** - **vorab** schnell zu beseitigen, kann nachfolgender Befehl ausgeführt werden: |
| <code> |
| # postconf -e inet_protocols=ipv4 |
| </code> |
| |
| Um **Warnungen** wie diese bei der Erstellung von weiteren [[http://www.postfix.org/|Postfix]]-Instanzen **__vorab__** schon vermeiden zu können, kann die Konfigurationsdatei |
| * **''/tec/postfix/main.cf.proto''** |
| angepasst werden, da diese bei der Erstellung von neuen [[http://www.postfix.org/|Postfix]]-Instanzen als **"Blaupause"** dient. Nachfolgende Anpassungen sind dazu erforderlich: |
| |
| (**Nur relevanter Ausschnitt**) |
| <code bash> |
| # Enable IPv4, and IPv6 if supported |
| # Tachtler |
| # default: #inet_protocols = ipv4 |
| inet_protocols = ipv4 |
| </code> |
| |
| Nachfolgende die Bestätigung das [[http://www.postfix.org/|Postfix]] gestartet ist und auf der IP-Adresse **''localhost (127.0.0.1)''** und auf Port **''25''** lauscht, was bei einer **Standard**-[[http://www.postfix.org/|Postfix]]-Konfiguration **__VOR__** dem Einsatz von Muliplen-[[http://www.postfix.org/|Postfix]]-Instanzen der Fall ist: |
| |
| (:-D p.s. Da manche lieber **//Poni//**'s als **//tulpen//** mögen, hier beide Befehle zur Überprüfung) |
| <code> |
| # lsof -Poni | grep master |
| master 6150 root 13u IPv4 138555 0t0 TCP 127.0.0.1:25 (LISTEN) |
| </code> |
| <code> |
| # netstat -tulpen | grep master |
| tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 138555 6150/master |
| </code> |
| |
| * //Quelle: Patrick Ben Koetter von der [[https://sys4.de/de/|[*]sys4]]. // |
| |
===== Konfiguration ===== | ===== Konfiguration ===== |
- [[http://www.postfix.org/|Postfix]]-Instanz **__nur__ für die E-Mail-Verarbeitung auf ''localhost''**. | - [[http://www.postfix.org/|Postfix]]-Instanz **__nur__ für die E-Mail-Verarbeitung auf ''localhost''**. |
- [[http://www.postfix.org/|Postfix]]-Instanz **__nur__ für die E-Mail-Verarbeitung von ''192.168.0.20''**. | - [[http://www.postfix.org/|Postfix]]-Instanz **__nur__ für die E-Mail-Verarbeitung von ''192.168.0.20''**. |
| |
| ==== /etc/postfix/main.cf.proto ==== |
| |
| :!: **HINWEIS** - **Ab [[http://www.postfix.org/|Postfix]] Version 3.x** |
| |
| Um bei der Erstellung von neuen [[http://www.postfix.org/|Postfix]]-Instanzen bereits **__vor__** deren Erstellung auf die Konfigurationsdatei |
| * ''/etc/[Name]/main.cf'' |
| Einfluss nehmen zu können, kann ab **[[http://www.postfix.org/|Postfix]] Version 3.x** die Konfigurationsdatei |
| * **''/etc/postfix/main.cf.proto''** |
| entsprechend angepasst werden, da diese Konfigurationsdatei als sozusagen **"Blaupause"** für die Erstellung der Konfigurationsdatei ''/etc/[Name]/main.cf'' dient. |
| |
| :!: **HINWEIS** - Alle Anpassungen in **''/etc/postfix/main.cf.proto''** sind nach der Erstellung einer [[http://www.postfix.org/|Postfix]]-Instanzen in deren ''/etc/[Name]/main.cf'' enthalten! |
| |
| * //Quelle: Patrick Ben Koetter von der [[https://sys4.de/de/|[*]sys4]]. // |
| |
| ==== /etc/postfix/master.cf.proto ==== |
| |
| :!: **HINWEIS** - **Ab [[http://www.postfix.org/|Postfix]] Version 3.x** |
| |
| Um bei der Erstellung von neuen [[http://www.postfix.org/|Postfix]]-Instanzen bereits **__vor__** deren Erstellung auf die Konfigurationsdatei |
| * ''/etc/[Name]/master.cf'' |
| Einfluss nehmen zu können, kann ab **[[http://www.postfix.org/|Postfix]] Version 3.x** die Konfigurationsdatei |
| * **''/etc/postfix/master.cf.proto''** |
| entsprechend angepasst werden, da diese Konfigurationsdatei als sozusagen **"Blaupause"** für die Erstellung der Konfigurationsdatei ''/etc/[Name]/master.cf'' dient. |
| |
| :!: **HINWEIS** - Alle Anpassungen in **''/etc/postfix/master.cf.proto''** sind nach der Erstellung einer [[http://www.postfix.org/|Postfix]]-Instanzen in deren ''/etc/[Name]/master.cf'' enthalten! |
| |
| * //Quelle: Patrick Ben Koetter von der [[https://sys4.de/de/|[*]sys4]]. // |
| |
==== Multi-Instanz-Unterstützung aktivieren ==== | ==== Multi-Instanz-Unterstützung aktivieren ==== |
Wenn andere Dateien in [[http://www.postfix.org/|Postfix]]-Instanz Verzeichnissen vorhanden sind, werden die **Verzeichnisse möglicherweise nicht vollständig entfernt**, eine Warnung wird protokolliert. | Wenn andere Dateien in [[http://www.postfix.org/|Postfix]]-Instanz Verzeichnissen vorhanden sind, werden die **Verzeichnisse möglicherweise nicht vollständig entfernt**, eine Warnung wird protokolliert. |
| |
:!: **ACHTUNG** - Die Aktion **''destroy''** löst potenziell gefährliche Dateientfernungen aus. Es sollte sichergestellt sein, dass die Daten, die Warteschlange und die Konfiguration der [[http://www.postfix.org/|Postfix]]-Instanz korrekt sind. Die Verzeichnisse sollten keine Dateien enthalten, die noch aufgehoben bzw. gebraucht werden sollten! | :!: **ACHTUNG** - Die Aktion **''destroy''** löst potenziell gefährliche Dateientfernungen aus. Es sollte sichergestellt sein, dass die Daten, die Warteschlange und die Konfiguration der [[http://www.postfix.org/|Postfix]]-Instanz die richtigen sind. Die Verzeichnisse sollten keine Dateien enthalten, die noch aufgehoben bzw. gebraucht werden sollten! |
| |
| Nachfolgen der Befehl zum löschen einer [[http://www.postfix.org/|Postfix]]-Instanz: |
| <code> |
| # postmulti -i postfix-eth0 -e destroy |
| rmdir: failed to remove 'pid': Directory not empty |
| postfix/postmulti-script: warning: /var/spool/postfix-eth0/pid: please verify contents and remove by hand |
| rmdir: failed to remove 'private': Directory not empty |
| postfix/postmulti-script: warning: /var/spool/postfix-eth0/private: please verify contents and remove by hand |
| rmdir: failed to remove 'public': Directory not empty |
| postfix/postmulti-script: warning: /var/spool/postfix-eth0/public: please verify contents and remove by hand |
| rmdir: failed to remove '/var/lib/postfix-eth0': Directory not empty |
| postfix/postmulti-script: warning: /var/lib/postfix-eth0: please verify contents and remove by hand |
| rmdir: failed to remove '/var/spool/postfix-eth0': Directory not empty |
| postfix/postmulti-script: warning: /var/spool/postfix-eth0: please verify contents and remove by hand |
| </code> |
| |
| Entsprechend der **Warnungen**, können die genannten Dateien und Verzeichnisse mit nachfolgendem Befehl(en) ebenfalls gelöscht werden: |
| <code> |
| # rm -rf /var/spool/postfix-eth0 /var/lib/postfix-eth0 |
| </code> |
| |
| Eine Überprüfung, ob die Instanz nun gelöscht ist, kann mit nachfolgendem Befehl durchgeführt werden: |
| <code> |
| # postmulti -l |
| - - y /etc/postfix |
| </code> |
| |
===== Konfiguration: Gesamtübersicht ===== | ===== Konfiguration: Gesamtübersicht ===== |
</code> | </code> |
| |
===== Konfiguration: Grundlagenerweiterung ===== | ===== Konfiguration: Beispiel ===== |
| |
==== Einschränkung: mydestination ==== | ==== Einschränkung: mydestination ==== |
| ''postmulti -i [Name] -p reload'' | Konfiguration einer Instanz neu einlesen | | | ''postmulti -i [Name] -p reload'' | Konfiguration einer Instanz neu einlesen | |
| ''postmulti -i [Name] -p stop'' | Stoppen einer Instanz | | | ''postmulti -i [Name] -p stop'' | Stoppen einer Instanz | |
| | ''postmulti -i [Name] -e destroy'' | :!: **VORSICHT** - Löschen einer Instanz | |
| |