我有一个 Postfix 邮件服务器,想使用 amavis 进行垃圾邮件和病毒检测。我遵循这教程将 amavis 添加到我正在运行的邮件服务器。我将其添加到 /etc/postfix/main.cf:
content_filter = smtp-amavis:[127.0.0.1]:10024
我的 /etc/postfix/master.cf 锁定如下:
smtp inet n - - - - smtpd
submission inet n - - - - smtpd -v
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o smtpd_sasl_security_options=noanonymous
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
pickup unix n - - 60 1 pickup
-o content_filter=
-o receive_override_options=no_header_body_checks
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
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
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}
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
##### Amavis inbound properties ######
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
postconf -n的输出:
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
inet_interfaces = all
inet_protocols = all
local_recipient_maps = $virtual_mailbox_maps
mailbox_size_limit = 0
mydestination =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = mydomain.com
readme_directory = no
recipient_delimiter =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_mailbox_domains = mydomain.com
virtual_mailbox_maps = ldap:/etc/postfix/virtual/ldap-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
我尝试发送的所有邮件均会获得延迟状态并显示以下日志信息:
Jan 19 10:28:51 mydomain postfix/smtp[2035]: BB27526F73: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=2.7, delays=0.13/0.01/0/2.5, dsn=4.5.0, status=deferred (host 127.0.0.1[127.0.0.1] said: 451 4.5.0 id=00944-02 - Temporary MTA failure on relaying, From MTA() during fwd-connect (Negative greeting: at (eval 134) line 479.): id=00944-02 (in reply to end of DATA command))
如果我重新排队延迟的邮件,它将被投递。但之前未排队的所有新邮件都会获得相同的状态并出现相同的问题。
有人知道如何解决这个问题吗?
编辑:这里是我的日志的另外几行,还有重新排队邮件后的日志:
Jan 19 13:45:13 mydomain postfix/smtpd[2361]: fatal: unexpected command-line argument: ###
Jan 19 13:45:14 mydomain postfix/master[2014]: warning: process /usr/lib/postfix/smtpd pid 2361 exit status 1
Jan 19 13:45:14 mydomain postfix/master[2014]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Jan 19 13:45:14 mydomain amavis[943]: (00943-06) (!)FWD from <[email protected]> -> <[email protected]>, 451 4.5.0 From MTA() during fwd-connect (Negative greeting: at (eval 134) line 479.): id=00943-06
Jan 19 13:45:14 mydomain amavis[943]: (00943-06) Blocked MTA-BLOCKED {TempFailedInbound}, [xxx.xxx.xxx.xxx]:50237 [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>, Queue-ID: 53094271AF, Message-ID: <[email protected]>, mail_id: eK3SxABQEng1, Hits: 1.438, size: 608, 2797 ms
Jan 19 13:45:14 mydomain postfix/smtp[2357]: 53094271AF: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=2.9, delays=0.12/0.01/0/2.8, dsn=4.5.0, status=deferred (host 127.0.0.1[127.0.0.1] said: 451 4.5.0 id=00943-06 - Temporary MTA failure on relaying, From MTA() during fwd-connect (Negative greeting: at (eval 134) line 479.): id=00943-06 (in reply to end of DATA command))
Jan 19 13:45:16 mydomain postfix/submission/smtpd[2355]: auto_clnt_close: disconnect private/tlsmgr stream
Jan 19 13:45:16 mydomain postfix/submission/smtpd[2355]: rewrite stream disconnect
Jan 19 13:45:24 mydomain postfix/postsuper[2364]: Requeued: 1 message
Jan 19 13:45:49 mydomain postfix/pickup[2293]: 00D21271BA: uid=107 from=<[email protected]> orig_id=53094271AF
Jan 19 13:45:49 mydomain postfix/cleanup[2348]: 00D21271BA: message-id=<[email protected]>
Jan 19 13:45:49 mydomain postfix/qmgr[2018]: 00D21271BA: from=<[email protected]>, size=727, nrcpt=1 (queue active)
Jan 19 13:45:49 mydomain dovecot: lmtp(2369): Connect from local
Jan 19 13:45:49 mydomain dovecot: lmtp(2369, [email protected]): wlQ8AX38vFRBCQAAXzmN0w: msgid=<[email protected]>: saved mail to INBOX
Jan 19 13:45:49 mydomain postfix/lmtp[2368]: 00D21271BA: to=<[email protected]>, relay=mydomain.localdomain[private/dovecot-lmtp], delay=38, delays=38/0.01/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> wlQ8AX38vFRBCQAAXzmN0w Saved)
Jan 19 13:45:49 mydomain dovecot: lmtp(2369): Disconnect from local: Successful quit
Jan 19 13:45:49 mydomain postfix/qmgr[2018]: 00D21271BA: removed
答案1
噢,我感觉自己真是太愚蠢了……
发现错误。masegaloeh,谢谢你的提示,也向所有因为我的愚蠢而浪费时间的人表示歉意......
我的 master.cf 中有一个错误放置的注释,在我发布内容到此处之前我删除了它,所以我的原始 master.cf 文件锁定如下:
##### Amavis inbound properties ######
127.0.0.1:10025 inet n - n - - smtpd ### stupid commend :(
-o content_filter=
-o local_recipient_maps=
答案2
此邮件日志行
Jan 19 13:45:13 mydomain postfix/smtpd[2361]: fatal: unexpected command-line argument: ###
很明显语法有问题master.cf
。您已经在回答中证实了这一点。在这一部分,我将尝试解释为什么当您重新排队邮件时邮件会通过。
当您发出命令postsuper - r
重新排队消息时,postfix 会将电子邮件移至 maildrop 队列。然后pickup
守护进程将“挑选”它并尝试发送它。在另一部分中,您在挑选过程中禁用了 amavis content_filter(通过 master.cf)。因此,重新排队的电子邮件将不会通过 amavis,因此不会出现上述错误消息。