We are using postfix 2.7 and custom SMTPD (based on qpsmtpd) in highly customized configuration for spam filtering. We have a new requirement to filter postfix-generated bounces through our custom qpsmtpd process (not so much for content filtering, but to process these bounces accordingly).
Our current configuration looks (in part) like this:
main.cf (only customizations shown):
2526 inet n - - - 0 cleanup
pickup fifo n - - 60 1 pickup
-o content_filter=smtp:127.0.0.2
Our smtpd injects messages to postfix on port 2526, by speaking directly to the cleanup daemon. And the custom pickup command instructs postfix to hand off all locally-generated mail (from cron, nagios, or other custom scripts) to our custom smtpd.
The problem is that this configuration does not affect postfix generated bounce messages, since they do not go through the pickup daemon.
I have tried adding the same content_filter option to the bounce daemon commands, but it does not seem to have any effect:
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
For reference, here is my main.cf file, as well:
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
I also tried adding the internal_mail_filter_classes option to main.cf, but also tono affect:
internal_mail_filter_classes = bounce,notify
I am open to any suggestions, including handling our current content-filtering-loop in a different way.
If it's not clear what I'm asking, please let me know, and I can try to clarify.
In this case you do it too complicated. This is the easy way.
You need to have this (additional) in your
main.cf
:in the
/etc/postfix/transport_maps
putthen
postmap /etc/postfix/transport_maps
. Afterwardspostfix reload
or restart Postfix.This will notify the [email protected] user of all bounces and as this user is said to be transported through 127.0.0.2:25 you get all these mails through that server. Replace the addresses/IP/port according to your environment.