|
|
A.12. Accept Bounces Only for Real UsersAs discussed in Accept Bounces Only for Real Users, there is now a loophole that prevents us from catching bogus Delivery Status Notification sent to system users and aliases, such as postmaster. Here we cover two alternate ways to ensure that bounces are only accepted for users that actually send outgoing mail. A.12.1. Check for Recipient MailboxThe first method is performed in the acl_rcpt_to ACL. Here, we check that the recipient address corresponds to a local mailbox:
Unfortunately, how we perform the mailbox check will depend on how you deliver your mail (as before, we extract the portion before the first "=" sign of the recipient address, to accomodate for Envelope Sender Signatures):
Since in the case of locally delivered mail, this mailbox check duplicates some of the logic that is performed in the routers, and since it is specific to the mail delivery mechanism on our site, it is perhaps a bit kludgy for the perfectionists among us. So we will now provide an alternate way. A.12.2. Check for Empty Sender in Aliases RouterYou probably have a router named system_aliases or similar, to redirect mail for users such as postmaster and mailer-demon. Typically, these aliases are not used in the sender address of outgoing mail. As such, you can ensure that incoming Delivery Status Notifications are not routed through it by adding the following condition to the router:
A sample aliases router may now look like this:
Although we now block bounces to some system aliases, other aliases were merely shadowing existing system users (such as "root", "daemon", etc). If you deliver local mail through the the accept driver, and use check_local_user to validate the recipient address, you may now find yourself routing mail directly to these system accounts. To fix this problem, we now want to add an additional condition in the router that handles your local mail (e.g. local_user) to ensure that the recipient not only exists, but is a "regular" user. For instance, as above, we can check that the user ID is in the range 500 - 60000:
A sample router for local delivery may now look like this:
Beware that if you implement this method, the reject response from your server in response to bogus bounce mail for system users will be the same as for unknown recipients (550 Unknown User in our case). |