centos:mailserver:grundinstallation_von_postfix

no way to compare when less than two revisions

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.


centos:mailserver:grundinstallation_von_postfix [16.02.2009 19:03. ] (aktuell) – angelegt django
Zeile 1: Zeile 1:
 +====== sicherer Mailserver mit Postfix ======
 +{{:centos:mailserver:postfix:postfixlogo.gif |Postfix-Logo}}Für die eMailkommunikation in unserem SOHO(( Small Office Home Office ))-LAN bedienen wir uns des SMTP-Server **Postfix**. Dies nicht zuletzt, da dieser, im Gegensatz zum Dinosaurier verschrieenen **Sendmail** wesentlich einfacher zu konfigurieren ist und auch sicherheitstechnische Vorteile bietet.\\
 +Die nachfolgende Beschreibung zeigt, wie man unter CentOS 5 einen Postfix-Mailserver aufsetzen und sicher betreiben kann.\\
 +\\
 +===== Installation =====
 +Von Haus aus wird bei der CentOS-Installation //sendmail// installiert. Daher werden wir zur späteren Konfiguration neben dem eigentlichen Paket **postfix** noch die beiden Pakete **system-switch-mail** und **system-switch-mail-gnome** via yum installieren.
 +<code>yum install postfix system-switch-mail system-switch-mail-gnome</code>
 +===== Konfiguration =====
 +Der Großteil der Konfiguration von Postfix erfolgt über **/etc/postfix.main.cf**. Desweiteren spielt die **/etc/postfix/master.cf** und weitere Dateien eine entscheidende Rolle.
 +<code># ll /etc/postfix/
 +insgesamt 296
 +-rw-r--r-- 1 root root 17832 21. Jan 2007  access
 +-rw-r--r-- 1 root root  3550 21. Jan 2007  bounce.cf.default
 +-rw-r--r-- 1 root root 11175 21. Jan 2007  canonical
 +-rw-r--r-- 1 root root  9920 21. Jan 2007  generic
 +-rw-r--r-- 1 root root 16838 21. Jan 2007  header_checks
 +-rw-r--r-- 1 root root 11942 21. Jan 2007  LICENSE
 +-rw-r--r-- 1 root root 26896  9. Aug 23:01 main.cf
 +-rw-r--r-- 1 root root 17981 21. Jan 2007  main.cf.default
 +-rw-r--r-- 1 root root   958 21. Jan 2007  makedefs.out
 +-rw-r--r-- 1 root root  4138  9. Aug 23:02 master.cf
 +-rw-r--r-- 1 root root 17639 21. Jan 2007  postfix-files
 +-rwxr-xr-x 1 root root  6366 21. Jan 2007  postfix-script
 +-rwxr-xr-x 1 root root 22564 21. Jan 2007  post-install
 +-rw-r--r-- 1 root root  6805 21. Jan 2007  relocated
 +-rw-r--r-- 1 root root  1629 21. Jan 2007  TLS_LICENSE
 +-rw-r--r-- 1 root root 12081 21. Jan 2007  transport
 +-rw-r--r-- 1 root root 11984 21. Jan 2007  virtual
 +</code>
 +Als erstes sehen wir uns die Hauptkonfigurationsdatei **/etc/postfix.main.cf** etwas genauer an.
 +Die Konfigurationsdatei ist durch die vielen sehr guten Dokumentationshinweise doch sehr angewachsen, aber im Grunde beschränkt sich diese auf ein paar wenige "aktive" Zeilen.
 +<code>egrep -v '(^#|^$)' /etc/postfix/main.cf
 +queue_directory = /var/spool/postfix
 +command_directory = /usr/sbin
 +daemon_directory = /usr/libexec/postfix
 +mail_owner = postfix
 +myhostname = host.domain.de
 +mydomain = domain.de
 +myorigin = $mydomain
 +inet_interfaces = all
 +mydestination = $myhostname, $mydomain, localhost, localhost.$mydomain
 +unknown_local_recipient_reject_code = 550
 +mynetworks = 192.168.1.0/24, 127.0.0.0/8
 +alias_maps = hash:/etc/aliases
 +alias_database = hash:/etc/aliases
 + 
 +  
 +debug_peer_level = 2
 +debugger_command =
 +         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
 +         xxgdb $daemon_directory/$process_name $process_id & sleep 5
 +sendmail_path = /usr/sbin/sendmail.postfix
 +newaliases_path = /usr/bin/newaliases.postfix
 +mailq_path = /usr/bin/mailq.postfix
 +setgid_group = postdrop
 +html_directory = no
 +manpage_directory = /usr/share/man
 +sample_directory = /usr/share/doc/postfix-2.3.3/samples
 +readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
 +</code>
 +Eine weitere Möglichkeit sich die Konfiguration unseres Mailservers, oder besser gesagt die Definitionen die von den Standardvorgaben abweichen, anzeigen zu lassen, ist die Verwendung von **postconf -n**:
 +<code>alias_database = hash:/etc/aliases
 +alias_maps = hash:/etc/aliases
 +command_directory = /usr/sbin
 +config_directory = /etc/postfix
 +daemon_directory = /usr/libexec/postfix
 +debug_peer_level = 2
 +html_directory = no
 +inet_interfaces = all
 +mail_owner = postfix
 +mailq_path = /usr/bin/mailq.postfix
 +manpage_directory = /usr/share/man
 +mydestination = $myhostname, $mydomain, localhost, localhost.$mydomain
 +myhostname = host.domain.de
 +mynetworks = 192.168.1.0/24, 127.0.0.0/8
 +mynetworks_style = subnet
 +myorigin = $mydomain
 +newaliases_path = /usr/bin/newaliases.postfix
 +queue_directory = /var/spool/postfix
 +readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
 +sample_directory = /usr/share/doc/postfix-2.3.3/samples
 +sendmail_path = /usr/sbin/sendmail.postfix
 +setgid_group = postdrop
 +smtpd_banner = $myhostname ESMTP $mail_name
 +unknown_local_recipient_reject_code = 550
 +</code>
 +===== Test =====
 +Die erfolgreiche erste Konfiguration testen wir am besten ganz einfach mit Hilfe von postfix selbst.
 +<code>service postfix check</code>
 +Der erste Start erfolgt dann ganz unspektakulär mittels:
 +<code>service postfix start</code>
 +Unsere erste Testmail verschicken wir dann von Hand und Verfolgen das Ergebnis im /var/log/maillog**.
 +<code>telnet localhost 25
 +HELO localhost
 +MAIL FROM: root@localhost
 +RCPT TO: django@localhost
 +DATA
 +From: root@localhost
 +To: django@localhost
 +Subject: erste Testmail
 +
 +Dies ist unsere erste Testmail
 +.
 +quit</code> 
 +<code>Aug  9 12:23:17 nss postfix/smtpd[30340]: connect from localhost.localdomain[127.0.0.1]
 +Aug  9 12:23:39 nss postfix/smtpd[30340]: 1780F76020C: client=localhost.localdomain[127.0.0.1]
 +Aug  9 12:23:53 nss postfix/cleanup[30354]: 1780F76020C: message-id=<20080809102339.1780F76020C@host.nausch.org>
 +Aug  9 12:23:53 nss postfix/qmgr[30337]: 1780F76020C: from=<root@localhost.domain.de>, size=400, nrcpt=1 (queue active)
 +Aug  9 12:23:53 nss postfix/local[30373]: 1780F76020C: to=<bigchief@localhost.domain.de>, orig_to=<bigchief@localhost>, relay=local, delay=21, delays=21/0/0
 +/0.04, dsn=2.0.0, status=sent (delivered to mailbox)
 +Aug  9 12:23:53 nss postfix/qmgr[30337]: 1780F76020C: removed
 +Aug  9 12:23:56 nss postfix/smtpd[30340]: disconnect from localhost.localdomain[127.0.0.1]</code>
  
  • centos/mailserver/grundinstallation_von_postfix.txt
  • Zuletzt geändert: 16.02.2009 19:03.
  • von django