Tuesday, December 23, 2014

Can sendmail be configured to discard routed email that has been rejected by the next hop?



Background:




  1. We have a handful of hosts (running sendmail) acting as the MXs for a few domains each.

  2. Each domain is handled via the sendmail/cf /etc/mail/virtusertable, with a set of known recipients and a catch-all reject rule.

  3. Mail to postmaster on each host is aliased to root, and root is aliased to root+@ourdomain.com.

  4. The MX for ourdomain.com is Google Apps, and root@ourdomain.com is a simple group that forwards to the admins.

  5. Google Apps will reject some emails at the SMTP stage, usually because of illegal attachments (instead of accepting them and filing them as spam).




Problem:



Given a particular spam email sent to a domain in a virtusertable entry:




  1. If the recipient address rejects the mail, then sendmail will try and send a DSN to the sender.

  2. If that sender also rejects the mail (because it's a falsified sender, and the MX for the sender rejects the mail as spam), then sendmail sends a DSN to the postmaster.

  3. The routing detailed above takes place, and...Google Apps rejects the mail as well.


  4. sendmail now gives up with a "savemail panic", and leaves the mail in the queue forever.

  5. Our mail queue fills up with garbage



Is there any way I can get sendmail to discard messages that have been rejected by the next virtusertable hop (i.e. after step 1 in the Problem description)? Or does anyone have any other solutions to this?


Answer



In the end we gave up on fixing this at the sendmail end, bit the bullet, opened our wallets and paid for Google Apps Premium which allowed us to tell GA to accept all emails from the servers acting as MXs.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...