Make postfix not send bounce emails when rejected by Cluebringer (policyd v2)

email-bouncespolicydpostfix

I have recipient throttling (quotas) enabled on cluebringer and it's working well. However, every time someone is being throttled, postfix sends back a bounce mail.

I do not want it to send back a bounce mail if an email has been rejected by cluebringer. Do you know how I can do this?

Given below is my postconf -n

$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = myserver.com, localdomain, localhost, localhost.localdomain, localhost
myhostname = myhostname.compute.internal
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_discard_ehlo_keywords = silent-discard, dsn
smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:10031
smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:10031
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

Best Answer

Do you really mean that Postfix sends a bounce? Or do you mean it rejects the incoming message with a 5xx code and then the sending MTA sends a bounce? Also, you don't say how policyd is configured - it tells Postfix whether to REJECT (5xx) or DEFER (4xx), and I'm guessing you want the latter so that the sending MTA retries until the user is under quota again.

If my understanding is correct, you can either change policyd to defer, or maybe amend your config like:

smtpd_end_of_data_restrictions = defer_if_reject check_policy_service inet:127.0.0.1:10031
smtpd_recipient_restrictions = defer_if_reject check_policy_service inet:127.0.0.1:10031

Edit: The "554 5.7.1 : Recipient address rejected: Policy rejection; Message count quota exceeded" is a reject SMTP response, not itself a bounce. There must be some other MTA involved besides myserver.com (eg if you are emailing blah@myserver.com from a Yahoo account for some reason, the DSN is coming from Yahoo).

Yes, discarding mail is certainly "unconventional" and MTAs are designed not to do it, but you can probably specify Verdict: DISCARD in cluebringer). See man 5 access and http://wiki.policyd.org/accesscontrol. There is no "discard_if_reject" keyword, but maybe you can have policyd return DUNNO and put discard at the end of the restriction.

You might also want to blackhole by piping to /dev/null in procmail.

Related Topic