我有SpamAssasing + DKIM + Amavis + ClamAV的后缀,并且我需要再添加一个过滤器,以便为其中一个虚拟域的外发邮件添加免责声明。
我已经创建了/ etc / postfix / disclaimer
#!/bin/bash
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail
DISCLAIMER_ADDRESSES=/etc/postfix/disclaimer_addresses
# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69
# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15
cat > /var/spool/filter/in.$$
/usr/bin/logger in.$$
from_address=`egrep '^From:' /var/spool/filter/in.$$ -m 1| cut -d "<" -f 2 | cut -d ">" -f 1`
if [ `grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES}` ]; then
/usr/bin/altermime --input=/var/spool/filter/in.$$ --disclaimer=/etc/postfix/disclaimer.txt --xheader="X-Copyrighted-Material: Please visit http://xxx.xxx" --log-syslog --verbose
fi
$SENDMAIL -oi "$@" < /var/spool/filter/in.$$
exit $?
这是我的master.cf:
smtp inet n - - - - smtpd -o content_filter=spamfilter:dummy
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_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
-o content_filter=dfilt:
spamfilter unix - n n - - pipe flags=Rq user=spamfilter argv=/usr/bin/spamfilter -f ${sender} -- ${recipient}
pickup unix n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr unix n - n 300 1 qmgr
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
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
vacation unix - n n - - pipe
flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} -- ${recipient}
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}
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
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_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
在日志文件中,我看到:
Sep 10 12:31:29 mailserver postfix/qmgr[19081]: 06D4011E19DE: from=
<vukasin@xxx.xx>, size=1464, nrcpt=1 (queue active)
Sep 10 12:31:29 mailserver altermime: Attempting to add disclaimer
Sep 10 12:31:29 mailserver altermime: Done.
Sep 10 12:31:31 mailserver postfix/pipe[19879]: 06D4011E19DE: to=<user2@yyyy.yy>, relay=dfilt, delay=2.3, delays=0.27/0/0/2, dsn=2.0.0, status=sent (delivered via dfilt service)
Sep 10 12:31:31 mailserver postfix/qmgr[19081]: 06D4011E19DE: removed
Sep 10 12:31:31 mailserver opendkim[2477]: 5068A11E19F5: localhost [127.0.0.1] not internal
Sep 10 12:31:31 mailserver opendkim[2477]: 5068A11E19F5: not authenticated
Sep 10 12:31:31 mailserver opendkim[2477]: 5068A11E19F5: s=default d=xxx.xx SSL
Sep 10 12:31:31 mailserver opendkim[2477]: 5068A11E19F5: bad signature data
Sep 10 12:31:31 mailserver postfix/qmgr[19081]: 5068A11E19F5: from=<vukasin@xxx.xx>, size=2595, nrcpt=1 (queue active)
Sep 10 12:31:31 mailserver postfix/smtpd[19899]: connect from localhost[127.0.0.1]
Sep 10 12:31:31 mailserver postfix/smtpd[19899]: 7252B11E19DE: client=localhost[127.0.0.1]
Sep 10 12:31:31 mailserver postfix/cleanup[19729]: 7252B11E19DE: message-id=<CAM7nknEqM1e2Y6rwQxVfLrZ=pLHEoo6MWhHoRYk=6L5gUCTL7Q@mail.yyyy.yy>
Sep 10 12:31:31 mailserver opendkim[2477]: 7252B11E19DE: localhost [127.0.0.1] not internal
Sep 10 12:31:31 mailserver opendkim[2477]: 7252B11E19DE: not authenticated
Sep 10 12:31:31 mailserver opendkim[2477]: 7252B11E19DE: s=default d=xxx.xx SSL
Sep 10 12:31:31 mailserver opendkim[2477]: 7252B11E19DE: bad signature data
Sep 10 12:31:31 mailserver postfix/qmgr[19081]: 7252B11E19DE: from=<vukasin@xxx.xx>, size=3288, nrcpt=1 (queue active)
Sep 10 12:31:31 mailserver postfix/smtpd[19899]: disconnect from localhost[127.0.0.1]
Sep 10 12:31:31 mailserver amavis[19415]: (19415-11) Passed CLEAN {RelayedOpenRelay}, [209.85.166.41] <vukasin@xxx.xx> -> <user2@yyyy.yy>, Message-ID: <CAM7nknEqM1e2Y6rwQxV
fLrZ=pLHEoo6MWhHoRYk=6L5gUCTL7Q@mail.yyyy.yy>, mail_id: XG7rkdh62VK7, Hits: -, size: 2788, queued_as: 7252B11E19DE, 161 ms
Sep 10 12:31:31 mailserver postfix/smtp[19692]: 5068A11E19F5: to=<user2@yyyy.yy>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.24, delays=0.08/0/0/0.16, dsn=2.0.0, status=sent (250 2.0. 0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 7252B11E19DE)
Sep 10 12:31:31 mailserver postfix/qmgr[19081]: 5068A11E19F5: removed
Sep 10 12:31:31 mailserver postfix/smtp[19695]: 7252B11E19DE: to=<user2@yyyy.yy>, relay=gmail-smtp-in.l.google.com[64.233.184.27]:25, delay=0.37, delays=0.09/0/0.04/0.24, dsn=2.0.0, status=sent (250 2.0.0 OK 1568111497 s29si18194436wrb.411 - gsmtp)
Sep 10 12:31:31 mailserver postfix/qmgr[19081]: 7252B11E19DE: removed
邮件到达收件人,但未更改。当我检查/var/spool/filter/in.$$时,添加了免责声明,但是由于某种原因该邮件从未发送过。仅发送原始邮件。我得到的错误是在master.cf中,但我不知道如何正确设置。
请帮助