Postfix und Clamsmtpd verhindern Mailversand

haegar

New Member
Hi,

wenn ich clamsmtpd wie weiter unten beschrieben einrichte, kann ich keine Mail mehr senden. In mail.err steht dann:
Code:
Nov 30 18:30:31 h2386003 /usr/lib/plesk-9.0/psa-pc-remote[29356]: Message aborted.
Nov 30 18:30:31 h2386003 postfix-local[1903]: Unable to get sender domain by sender mailname
Nov 30 18:30:31 h2386003 dk_check[1904]: DK_STAT_NOSIG: No signature available in message


Code:
und in maillog
Nov 30 18:30:31 h2386003 postfix/smtpd[1900]: connect from localhost[127.0.0.1]
Nov 30 18:30:31 h2386003 postfix/smtpd[1900]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 554 5.7.1 <absender@meinedomain.tld>: Recipient address rejected: Access denied; from=<absender@meinedomain.tld> to=<emfaenger@meinedomain.tld> proto=ESMTP helo=<meinhost.meinedomain.tld>
Nov 30 18:30:31 meinhost postfix/smtpd[1888]: disconnect from dslb-188-107-080-197.188.107.pools.vodafone-ip.de[188.107.80.197]


Es folgen noch die vollständigen Konfigurationsdateien. Hier die Änderungen, die ich vorgenommen habe, um postfix und clamsmtpd zusammenarbeiten zu lassen:
- clamsmtpd.conf Adressen für input/output angepasst:
Code:
Listen: 127.0.0.1:10025
OutAddress: 10026

- main.cf zwei Zeilen eingefügt
Code:
content_filter = scan:127.0.0.1:10025
receive_override_options = no_address_mappings

master.cf folgenden Block eingefügt:
Code:
# AV scan filter (used by content_filter)
scan      unix  -       -       n       -       16      smtp
        -o smtp_send_xforward_command=yes
# For injecting mail back into postfix from the filter
127.0.0.1:10026 inet  n -       n       -       16      smtpd
        -o content_filter=
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
        -o smtpd_helo_restrictions=
        -o smtpd_client_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks_style=host
        -o smtpd_authorized_xforward_hosts=127.0.0.0/8

danach die Services neu gestartet (clamsmtpd und postfix in dieser Reihenfolge). Ich sehe auch dass clamsmtpd und postfix laufen bzw. an den richtigen Adressen lauschen:
lsof -i
Code:
clamsmtpd  1301     clamsmtp    3u  IPv4 3211677102      0t0  TCP localhost:10025 (LISTEN)
master    26861         root  124u  IPv4 3175453666      0t0  TCP localhost:10026 (LISTEN)
aber es gehen dann, wie oben beschrieben, keine Mails mehr raus oder rein. Ich habe mir zum Test einfach selbst eine Mail gesendet, noch völig ohne Virentest, reiner Funktionstest "klappt der normale Mailversand noch".

Was mache ich da falsch? Die generelle Konfiguration müsste passen, da ohne die beiden Zeilen in der main.cf alles funktioniert.

die vollständige main.cf enthält:
Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/postfix_default.pem
smtpd_tls_key_file = $smtpd_tls_cert_file
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = meinhost.meinedomain.tld
alias_maps = hash:/etc/aliases, hash:/var/spool/postfix/plesk/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost.meinedomain.tld, localhost, localhost.localdomain
relayhost = 
mynetworks = 
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = , hash:/var/spool/postfix/plesk/vmailbox
transport_maps = , hash:/var/spool/postfix/plesk/transport
smtpd_tls_security_level = may
smtp_tls_security_level = may
smtp_use_tls = no
smtpd_timeout = 3600s
smtpd_proxy_timeout = 3600s
disable_vrfy_command = yes
smtpd_sender_restrictions = check_sender_access hash:/var/spool/postfix/plesk/blacklists, permit_sasl_authenticated
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_rbl_client zen.spamhaus.org
smtp_send_xforward_command = yes
smtpd_authorized_xforward_hosts = 127.0.0.0/8 [::1]/128
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
virtual_mailbox_base = /var/qmail/mailnames
virtual_uid_maps = static:30
virtual_gid_maps = static:31
smtpd_milters = , inet:127.0.0.1:12768
sender_dependent_default_transport_maps = hash:/var/spool/postfix/plesk/sdd_transport_maps
virtual_transport = plesk_virtual
plesk_virtual_destination_recipient_limit = 1
mailman_destination_recipient_limit = 1
virtual_mailbox_limit = 0
message_size_limit = 30720000
content_filter = scan:127.0.0.1:10025
receive_override_options = no_address_mappings

kommentiere ich die beiden letzten Zeilen aus, funktioniert der Mailversand.

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" or
# on-line: http://www.postfix.org/master.5.html).
#
# 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_reject_unlisted_recipient=no
#  -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
#smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -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
#628       inet  n       -       -       -       -       qmqpd
#pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
#qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  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=R user=list:list argv=/usr/lib/plesk-9.0/postfix-mailman ${nexthop} ${user} ${recipient}


plesk_virtual unix - n n - - pipe flags=DORhu user=popuser:popuser argv=/usr/lib/plesk-9.0/postfix-local -f ${sender} -d ${recipient} -p /var/qmail/mailnames
pickup fifo n - - 60 1 pickup
plesk_saslauthd unix y y y - 1 plesk_saslauthd status=5 listen=6 dbpath=/plesk/passwd.db
qmgr fifo n - n 1 1 qmgr
smtps inet n - - - - smtpd -o smtpd_tls_wrappermode=yes

submission inet n - - - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination

plesk-85.214.125.7- unix - n n - - smtp -o smtp_bind_address=85.214.125.7 -o smtp_bind_address6= -o smtp_address_preference=ipv4

# AV scan filter (used by content_filter)
scan      unix  -       -       n       -       16      smtp
        -o smtp_send_xforward_command=yes
# For injecting mail back into postfix from the filter
127.0.0.1:10026 inet  n -       n       -       16      smtpd
        -o content_filter=
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
        -o smtpd_helo_restrictions=
        -o smtpd_client_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks_style=host
        -o smtpd_authorized_xforward_hosts=127.0.0.0/8

und zu guter letzt noch die clamsmtpd.conf
Code:
# ------------------------------------------------------------------------------
#                        SAMPLE CLAMSMTPD CONFIG FILE
# ------------------------------------------------------------------------------
# 
# - Comments are a line that starts with a #
# - All the options are found below with their defaults commented out


# The address to send scanned mail to. 
# This option is required unless TransparentProxy is enabled
OutAddress: 10026

# The maximum number of connection allowed at once.
# Be sure that clamd can also handle this many connections
#MaxConnections: 64

# Amount of time (in seconds) to wait on network IO
#TimeOut: 180

# Address to listen on (defaults to all local addresses on port 10025)
Listen: 127.0.0.1:10025

# The address clamd is listening on
ClamAddress: /var/run/clamav/clamd.ctl

# A header to add to all scanned email
Header: X-AV-Checked: ClamAV using ClamSMTP

# Directory for temporary files
TempDirectory: /var/spool/clamsmtp

# PidFile: location of PID file
PidFile: /var/run/clamsmtp/clamsmtpd.pid

# Whether or not to bounce email (default is to silently drop)
#Bounce: off

# Whether or not to keep virus files 
#Quarantine: off

# Enable transparent proxy support 
#TransparentProxy: off

# User to run as
User: clamsmtp

# Virus actions: There's an option to run a script every time a 
# virus is found. Read the man page for clamsmtpd.conf for details.

Danke,
Haegar
 
main.cf...[:]
Code:
content_filter = scan:127.0.0.1:10025

master.cf...:
Code:
# AV scan filter (used by content_filter)
scan      unix  -       -       n       -       16      smtp
        -o smtp_send_xforward_command=yes

Ohne viel prorbiert zu haben, behaupte ich mal, dass der service type unix und 127.0.0.1:10025 sich gegenseitig ausschließen. In
Code:
content_filter = scan:dummy
ist meiner Erinnerung nach nur ein Dummy-Wert zulässig, der nicht ausgewertet wird.

--
.A.
 
Last edited by a moderator:
am Wochenende wieder Zeit dafür...

wenn ich statt der Portzuweisung 10026 dummy nehme, kommt erwartungsgemäß : unable to look up host dummy: Name or service

Hier mal mein Verständnis, wie das eigentlich laufen soll (dazu noch der Hinweis: Server läuft mit Verwaltungsoberfläche Plesk 12):

Eine Mail wird an sendmail übergeben, Plesk leitet das letztlich um, aber im Prinzip landet es über Port 25 (wenn von PHP-Mailer oder sendmail aus Kontaktformular o.ä. gesendet) oder port 587 (wenn aus Mailclient kommend) bei Postfix. Über die Einstellung in der main.cf wird der Vorgang an den service "scan" übergeben (content_filter = scan:127.0.0.1:10025). Der ist in clamsmtpals EIngang definiert (Listen: 127.0.0.1:10025).
clamsmtp gibt das dann über port 10026 wieder an postfix zurück (OutAddress: 10026) und postfix verarbeitet es durch die Einstellungen in der main.cf (hier nur eine Zeile wiedergegeben, Rest siehe im ersten Post des Threads: 127.0.0.1:10026 inet n - n - 16 smtpd).

Verkürzt:
sendmail/postfix --> scan:10025 --> clamsmtp --> OutAddress:10026 --> sendmail/postfix --> Versand

Das scheint mir alles logisch und richtig. Ohne den "umweg" über clamsmtp funktioniert der Mailversand auch völlig korrekt. Nur wenn ich "content_filter = scan:127.0.0.1:10025" in der master.cf einschalte kommt diese für mich im Zusammenhang unverständliche Fehlermeldung im error.log
Code:
Nov 30 18:30:31 h2386003 /usr/lib/plesk-9.0/psa-pc-remote[29356]: Message aborted.
Nov 30 18:30:31 h2386003 postfix-local[1903]: Unable to get sender domain by sender mailname
Nov 30 18:30:31 h2386003 dk_check[1904]: DK_STAT_NOSIG: No signature available in message

und in mail.log
Code:
Nov 30 18:30:31 h2386003 postfix/smtpd[1900]: connect from localhost[127.0.0.1]
Nov 30 18:30:31 h2386003 postfix/smtpd[1900]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 554 5.7.1 <absender@meinedomain.tld>: Recipient address rejected: Access denied; from=<absender@meinedomain.tld> to=<emfaenger@meinedomain.tld> proto=ESMTP helo=<meinhost.meinedomain.tld>
Nov 30 18:30:31 meinhost postfix/smtpd[1888]: disconnect from dslb-188-107-080-197.188.107.pools.vodafone-ip.de[188.107.80.197]

Habe ich da einen ganz falschen Ansatz (sendmail/postfix --> 10025 --> clamsmtp --> 10026 --> sendmail/postfix --> Versand) oder stimmt nur im Detail irgendeine Einstellung nicht?

Gruß,
Haegar
 
mail.log
Code:
Nov 30 18:30:31 h2386003 postfix/smtpd[1900]: connect from localhost[127.0.0.1]
Nov 30 18:30:31 h2386003 postfix/smtpd[1900]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 554 5.7.1 <absender@meinedomain.tld>: Recipient address rejected: Access denied; from=<absender@meinedomain.tld> to=<emfaenger@meinedomain.tld> proto=ESMTP helo=<meinhost.meinedomain.tld>
Nov 30 18:30:31 meinhost postfix/smtpd[1888]: disconnect from dslb-188-107-080-197.188.107.pools.vodafone-ip.de[188.107.80.197]

Was ich oben schrieb ist Quatsch. Du musst die Mail schließlich an smtp übergeben, damit sie bei 127.0.0.1:10025 ankommt.

Du solltest aber prüfen, ob Du von 127.0.0.1 an 127.0.0.1:10026 Mails einliefern kannst.

--
.A.
 
Gibt es einen bestimmten Grund, warum du clamsmtp nutzt? ClamAV läßt sich z.B. auch per milter-Schnittstelle in Postfix einbinden und das ist mit einer Zeile in der Postfix-Konfig erledigt
 
Back
Top