Block SMTP session with sender domain which doesn't itself accept SMTP connection.

Posted by bignose on Server Fault See other posts from Server Fault or by bignose
Published on 2010-06-09T03:47:32Z Indexed on 2010/06/09 6:23 UTC
Read the original article Hit count: 260

Filed under:
|
|
|

I'm administrating a mail service for a small business. Their mail host's internet connection is an ADSL service with a permanent IP address.

Unfortunately, many misconfigured mail systems will happily deliver to this host, but, when the host attempts to send mail back (e.g. a bounce notice, or a normal response from someone), 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.

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.

Note that I'm not, as some commenters have assumed, talking about checking whether the SMTP client will receive messages. The check I want is whether the declared sender's domain (regardless of who the current SMTP client is) will accept SMTP connections from here. In other words: when we get around to sending a message back, we'll need the sender's domain to accept SMTP connections; I want to do that check before accepting the incoming session.

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.

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

© Server Fault or respective owner

Related posts about postfix

Related posts about smtp