Postfix mit Dovecot

Suedlicht

New Member
Schönen guten Tag,

ich versuche gerade für die Berufsschule in einer virtuellen Umgebung einen Postfix Mailserver mit Dovecot zu installieren. Leider habe ich mich bei der Konfiguration total verrannt und weiss nun nicht mehr vor oder zurück.

Das ganze soll eine möglichts "all in one" Maillösung werden, also Pop3, Imap und smtp.

Meine Postfix main.cf sieht aktuell so aus:
smtpd_banner = $myhostname ESMTP
biff = no

append_dot_mydomain = no

readme_directory = no

smtpd_use_tls=yes
smtpd_tls_security_level = may
smtpd_tls_auth_only = no
smtpd_tls_cert_file=/etc/ssl/certs/mail.cert
smtpd_tls_key_file=/etc/ssl/private/mail.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_received_header = yes
tls_random_source = dev:/dev/urandom

myhostname = mailsrv.bfs.localdomain
mydomain = mailsrv.bfs.localdomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = mailsrv.bfs.localdomain, mailsrv, localhost.localdomain, localhost, $mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
broken_sasl_auth_clients = yes

virtual_mailbox_domains = /etc/postfix/virtual_domains
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_alias_maps = hash:/etc/postfix/virtual_alias
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

Meine Postfix master.cf ist folgende:
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
#smtp inet n - - - 1 postscreen
smtpd pass - - - - - smtpd
#dnsblog unix - - - - 0 dnsblog
#tlsproxy unix - - - - 0 tlsproxy
submission inet n - - - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
#smtps inet n - - - - smtpd
# -o syslog_name=postfix/smtps
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
relay unix - - - - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}

Ich kann aktuell Mails über Imap und Pop3 empfangen, das Senden funktioniert leider noch nicht so wie es soll. Wenn ich mynetworks testweise auf 0.0.0.0/0 einstelle kann ich über Outlook Mails verschicken, über das installierte Webmal (afterlogic) allerdings nicht.

Das Logfile sag folgendes:

Mar 15 17:36:33 mailsrv postfix/smtpd[16237]: NOQUEUE: reject: RCPT from hostname[ip]: 554 5.7.1 <mailadresse>: Relay access denied; from=<mailadresse> to=<mailadresse> proto=ESMTP helo=<thinkpad>

Ich hoffe ihr könnt mir helfen :-/

LG Suedlicht
 
Versuch mal damit in der main.cf:


Code:
smtpd_sasl_auth_enable = no
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $mydomain


und bei den Restrictions:
Code:
permit_sasl_authenticated,


Wie verwaltest du die Passwörter? Mit einer dovecot passwd Datei? Die dovecot config wär auch noch hilfreich, denn darüber wird beim Senden via Postfix authentifiziert.
 
Hallo

Ja, für die Benutzerverwaltung benutze ich die Dovecot passwd und shadow Dateien.

Meine Dovecot Konfiguration sieht aktuell so aus:

auth_mechanisms = plain login
disable_plaintext_auth = no
log_path = /var/log/dovecot.log
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail
passdb {
args = /var/mail/vhosts/%d/shadow
driver = passwd-file
}
protocols = imap pop3
#service auth {
# unix_listener /var/spool/postfix/private/auth {
# group = vmail
# mode = 0660
# user = postfix
# }
# unix_listener auth-master {
# group = vmail
# mode = 0600
# user = vmail
# }
#}
ssl_cert=</etc/ssl/certs/mail.cert
ssl_key=</etc/ssl/private/mail.key
userdb {
args = /var/mail/vhosts/%d/passwd
driver = passwd-file
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}
 
Kommentier' mal folgende Zeilen im dovecot aus:
Code:
#service auth {
# unix_listener /var/spool/postfix/private/auth {
# group = vmail
# mode = 0660
# user = postfix
# }
# unix_listener auth-master {
# group = vmail
# mode = 0600
# user = vmail
# }
#}

und füge meine oben genannten zu postfix ein.
 
Hallo,

habe deine Zeilen eingefügt und die von Dir vorgeschlagenen Zeilen auskommentiert. Leider keine Veränderung.

Das Logfile zeigt immer noch die selben Einträge.

Die Kennwörter habe ich über

doveadm pw -s HMAC-MD5 -p Kennwort

generiert. Kann mein Dovecot / Postfix diese in der jetzigen Einstellung lesen?
 
Hau mal in der master.cf alles vom submission raus und das rein:

Code:
submission inet n       -       n       -       -       smtpd
 -o smtpd_sasl_type=dovecot
 -o smtpd_sasl_path=private/auth
 -o smtpd_sasl_auth_enable=yes
 -o smtpd_tls_auth_only=yes
 -o smtpd_tls_security_level=encrypt
 -o smtpd_recipient_restrictions=reject_unknown_recipient_domain,permit_sasl_authenticated,reject

Edit, ich seh grad bei dir heissts dort authenticate d. Da ist ein Leerzeichen drin, was nicht hingehört.
 
Folgendes sagt mir dann das Logile

Mar 15 18:12:19 mailsrv postfix/master[17532]: terminating on signal 15
Mar 15 18:12:19 mailsrv postfix/master[17699]: daemon started -- version 2.9.6, configuration /etc/postfix
Mar 15 18:12:31 mailsrv postfix/smtpd[17719]: fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit
Mar 15 18:12:32 mailsrv postfix/master[17699]: warning: process /usr/lib/postfix/smtpd pid 17719 exit status 1
Mar 15 18:12:32 mailsrv postfix/master[17699]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
 
Hier die aktuellen Konfigurationsdateien

Postfix main.cf

Code:
smtpd_banner = $myhostname ESMTP 
biff = no

append_dot_mydomain = no

readme_directory = no

smtpd_use_tls=yes
smtpd_tls_security_level = may
smtpd_tls_auth_only = no
smtpd_tls_cert_file=/etc/ssl/certs/mail.cert
smtpd_tls_key_file=/etc/ssl/private/mail.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_received_header = yes
tls_random_source = dev:/dev/urandom

smtpd_recipient_restrictions = permit_sasl_authenticated

myhostname = mailsrv.bfs.localdomain
mydomain = mailsrv.bfs.localdomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = mailsrv.bfs.localdomain, mailsrv, localhost.localdomain, localhost, $mydomain
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
broken_sasl_auth_clients = yes

virtual_mailbox_domains = /etc/postfix/virtual_domains
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_alias_maps = hash:/etc/postfix/virtual_alias
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

smtpd_sasl_auth_enable = no
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $mydomain

Postfix master.cf

Code:
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
submission inet n       -       n       -       -       smtpd
 -o smtpd_sasl_type=dovecot
 -o smtpd_sasl_path=private/auth
 -o smtpd_sasl_auth_enable=yes
 -o smtpd_tls_auth_only=yes
 -o smtpd_tls_security_level=encrypt
 -o smtpd_recipient_restrictions=reject_unknown_recipient_domain,permit_sasl_authenticated,reject
#smtps     inet  n       -       -       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
	-o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix	-	n	n	-	2	pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}

Dovecot Konfiguration:

Code:
auth_mechanisms = plain login
disable_plaintext_auth = no
log_path = /var/log/dovecot.log
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail
passdb {
  args = /var/mail/vhosts/%d/shadow
  driver = passwd-file
}
protocols = imap pop3
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = vmail
    mode = 0660
    user = postfix
  }
  unix_listener auth-master {
    group = vmail
    mode = 0600
    user = vmail
  }
}
ssl_cert=</etc/ssl/certs/mail.cert
ssl_key=</etc/ssl/private/mail.key
userdb {
  args = /var/mail/vhosts/%d/passwd
  driver = passwd-file
}
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
}
 
Leider unveränderte Logfileeinträge.

Die Zeile

Code:
smtpd_require_helo = yes

habe ich auskommentiert, da es beim neu starten von Postfix zu folgendem Fehler kam:

Code:
warning: /etc/postfix/main.cf: unused parameter: smtpd_require_helo=yes

Folgende Zeilen habe ich zur main.cf hinzugefügt

Code:
smtpd_client_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_unknown_client, reject_rbl_client sbl-xbl.spamhaus.org
smtpd_sender_restrictions = permit_mynetworks,reject_unknown_address,reject_unknown_sender_domain,reject_non_fqdn_sender 
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_recipient_limit = 250
 
Versuche heauszufinden, ob smtpd auf Port 25 oder smtpd auf Port 587 den Fehler erzeugt. Dazu in master.cf erst das eine auskommentieren und dann das andere.

--
.A.
 
Port 25 sagt über Telnet folgendes:

Code:
220 mailsrv.bfs.localdomain ESMTP
EHLO mailsrv.bfs.localdomain
250-mailsrv.bfs.localdomain
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM:<n1@bfs.localdomain>
250 2.1.0 Ok
RCPT TO:<n2@bfs.localdomain>
554 5.7.1 <n2@bfs.localdomain>: Relay access denied
 
Als erstes sollest Du Dich um
Mar 15 18:12:31 mailsrv postfix/smtpd[17719]: fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit
kümmern. Danach geht es an die Weiterleitung.

--
.A.
 
Back
Top