Incoming mail from sender, MX record won’t accept replies. How to block the incoming SMTP connection from that sender

postfixsmtp

How do I block an SMTP connection when I determine the sender's MX record will reject mail?

That is, if the advertised (MX record) way to send mail back to the domain will in fact not work, I want to reject the incoming SMTP connection.


I'm administrating a mail service for a small business. They have a mail host, foo.example.org, whose internet connection is an ADSL service with a permanent IP address.

Unfortunately, many mail systems are misconfigured in the following way:

  • the sending host, bar.example.com, will happily deliver to foo.example.org, and
  • the DNS for bar.example.com has an MX record listing the host (mail.example.com) to which mail should be directed for that domain; but
  • the specified host mail.example.com rejects SMTP connections from foo.example.org.

So the declared sender's domain has an MX which refuses to receive connections from this host. That misconfiguration makes their system a one-way mail sender, which is a problem.


Note that I'm not, as some commenters have assumed, talking about hosts which only send mail; that's not the problem. The misconfiguration is in that domain's mail system, declaring a sender domain for the message when that domain's MX won't accept SMTP connections from the domain to which you're sending.

I have also confirmed the DNS configuration is correct (with A and PTR records that map correctly both ways) and confirmed the host's IP address is not blacklisted in many of the reputable blacklist services, with helpful links from JohnnyD.

Those mail systems that are rejecting this host seem to be doing so primarily because it's on an ADSL service, regardless of the fact that it has a permanently-assigned IP address and is not listed in reputable lists of dynamic IP addresses (because it's a permanently-assigned address).


How can I configure Postfix on this customer's mail host to refuse SMTP sessions that declare a sender domain which itself refuses SMTP from this host? That is, if the SMTP client declares a domain that we can't make SMTP connections back to, then there's not much point accepting the incoming connection in the first place.

I'm imagining a late check (after the low-cost checks to winnow most of the rubbish connections) that keeps the client on the other end while it attempts an SMTP client connection back to the declared domain of the sender. If that connection is rejected, the incoming one is also rejected.

Yes, that means some mail might be blocked. But that's better than accepting the message, and then not having a way to reply or tell the sender there's a problem at their end. By blocking the message at SMTP time, the sender will at least receive prompt notification, which isn't the case now.

I'm also open to other suggestions for how this problem might be addressed (short of not using this mail host, which isn't an option).

Best Answer

I would start by doing a thourgh check of all composite blocking lists:

MyIpTest.com

Barracuda Central

Anti-Abuse Project - enter IP in Multi-RBL Check textbox on right

UCEProtect-Network

Let me know how you make out.

Related Topic