我们在高度自定义configuration中使用postfix 2.7和自定义SMTPD(基于qpsmtpd)进行垃圾邮件过滤。 我们有一个新的要求,通过我们的自定义qpsmtpd过程(不是很多的内容过滤,但相应地处理这些反弹)来过滤postfix生成的反弹。
我们目前的configuration看起来(部分)是这样的:
main.cf (仅显示自定义):
2526 inet n - - - 0 cleanup pickup fifo n - - 60 1 pickup -o content_filter=smtp:127.0.0.2
我们的smtpd通过直接告诉cleanup守护进程向端口2526上的postfix注入消息。 自定义拾取命令指示后缀将所有本地生成的邮件(从cron,nagios或其他自定义脚本)交给我们的自定义smtpd。
问题是这个configuration不影响后缀生成的退回消息,因为它们不通过拾取守护进程。
我曾尝试将同样的content_filter选项添加到反弹守护程序命令,但似乎没有任何效果:
bounce unix - - - - 0 bounce -o content_filter=smtp:127.0.0.2 defer unix - - - - 0 bounce -o content_filter=smtp:127.0.0.2 trace unix - - - - 0 bounce -o content_filter=smtp:127.0.0.2
作为参考,这里是我的main.cf文件,以及:
biff = no # TLS parameters smtpd_tls_loglevel = 0 smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache smtp_tls_security_level = may mydestination = $myhostname alias_maps = proxy:pgsql:/etc/postfix/dc-aliases.cf transport_maps = proxy:pgsql:/etc/postfix/dc-transport.cf # This is enforced on incoming mail by QPSMTPD, so this is simply # the upper possible bound (also enforced in defaults.pl) message_size_limit = 262144000 mailbox_size_limit = 0 # We do our own message expiration, but if we set this to 0, then postfix # will try each mail delivery only once, so instead we set it to 100 days # (which is the max postfix seems to support) maximal_queue_lifetime = 100d hash_queue_depth = 1 hash_queue_names = deferred, defer, hold
我也尝试添加main.cf的internal_mail_filter_classes选项,但也会影响:
internal_mail_filter_classes = bounce,notify
我接受任何build议,包括以不同的方式处理我们当前的内容过滤循环。
如果我不明白我在问什么,请告诉我,我可以尝试澄清。
在这种情况下,你做得太复杂了。 这是简单的方法。
你需要在main.cf有这个(附加的):
notify_classes = resource, software, bounce, 2bounce bounce_notice_recipient = [email protected] 2bounce_notice_recipient = [email protected] transport_maps = hash:/etc/postfix/transport_maps #or another file. See below.
在/etc/postfix/transport_maps放
[email protected] smtp:127.0.0.2:25
然后postmap /etc/postfix/transport_maps 。 之后postfix reload或重新启动Postfix。
这将通知[email protected]用户所有的反弹,并且当这个用户被说成是通过127.0.0.2:25传输的时候,你通过那个服务器得到所有这些邮件。 根据您的环境更换地址/ IP /端口。