On 23 Dec 2014, at 8:32, James B. Byrne wrote:

We have an smtpd_helo_restriction of reject_unknown_helo_hostname that
regularly fails for one of our (very) large correspondents. As it turns out the reason is quite legitimate, the helo identity fqdn issued from several of their email gateways does not match up to the IP address that they are using. There nothing much one can do about that save exempting their domain in the
helo_checks map.

However, in tracking this down I discovered that they were using multiple PTR records to reverse map the same IP address back to multiple hosts. My research indicates that the practice of multiple PTR records for a single IP address is permitted. When I do a dig -x on the IP address of the mail hosts that are rejected by our configuration I get back three PRT records (none of which happen to map to the helo ID fqdn transmitted but that is another matter).

Your unnamed correspondents sound a lot like Microsoft's hosted Exchange operation, whose DNS seems to have been designed by people who were concerned that sensible DNS would violate someone else's patents. There is no rational rule that will reliably fit the things they do with HELO & PTR names.

My question is: Does Postfix detect and handle this situation? While it is certainly atypical specifying multiple PTR records apparently is a permitted condition. If the helo/ehelo fqdn issued by one of their mail hosts matches any one of the three PRT records for the IP address they are connecting from then would the reject_unknown_helo_hostname restriction reject or permit the
connection?

dig -x 192.168.0.1

192.168.0.1     IN PTR mail1.domain.tld.
192.168.0.1     IN PTR mail2.domain.tld.
192.168.0.1     IN PTR mail3.domain.tld.

If mail3.domain.tld connected from 192.168.0.1 what would be the result; assuming that reject_unknown_helo_hostname is in effect and domain.tld is not
excepted in the helo_checks map?

As Dr. Venema has said more tersely, Postfix doesn't do anything deep and complex to find a way to make baroque naming schemes match subtle concepts of debatable correctness. What he didn't say but which you seem to be misunderstanding is that reject_unknown_helo_hostname DOES NOT deal with any PTR records at all. It merely requires that the HELO name have an A or MX record. Nothing more.

For example, I just confirmed that this remains true in 2.11 by doing this manual SMTP from a host in a domain I've replaced with 'example.net':

*****transcript start*****
        somehost.example.net:~$ telnet toaster.scconsult.com 25
        Trying 67.149.19.4...
        Connected to toaster.scconsult.com.
        Escape character is '^]'.
        220-toaster.scconsult.com ESMTP Postfix
        220 toaster.scconsult.com ESMTP Postfix
        EHLO otherhost.example.net
        250-toaster.scconsult.com
        250-PIPELINING
        250-SIZE 20480000
        250-ETRN
        250-STARTTLS
        250-ENHANCEDSTATUSCODES
        250-8BITMIME
        250 DSN
        MAIL FROM:<[email protected]>
        250 2.1.0 Ok
        RCPT TO:<[email protected]>
        250 2.1.5 Ok
        DATA
        354 End data with <CR><LF>.<CR><LF>
        From: [email protected]
        To: [email protected]
        Subject: Test Message
        Date: Sat, 27 Dec 2014 16:01:55 -0500 (EST)
        
        hello bill
        .
        250 2.0.0 Ok: queued as 3k8yBq6DX6z1Y9GjK
*****transcript end*****

This resulted in the delivery of this:

***message start***             
        Return-Path: <[email protected]>
        X-Original-To: [email protected]
        Delivered-To: [email protected]
        Received: from otherhost.example.net (somehost.example.net [192.0.2.1])
                by toaster.scconsult.com (Postfix) with ESMTP id 
3k8yBq6DX6z1Y9GjK
                for <[email protected]>; Sat, 27 Dec 2014 16:02:11 -0500 
(EST)
        From: [email protected]
        To: [email protected]
        Subject: Test Message
        Date: Sat, 27 Dec 2014 16:01:55 -0500 (EST)

        hello bill
***message end***               

The server here (toaster) requires that the HELO name have forward resolution (as the name replaced by 'otherhost.example.net' does) because of reject_unknown_helo_hostname. It ALSO requires that the client IP have a PTR record that resolves to a name that has some forward resolution because of reject_unknown_reverse_client_hostname. It does NOT require that the forward resolution return the client IP, because I DO NOT use reject_unknown_client_hostname.

So, any question about rejecting based on PTRs is probably about either reject_unknown_client_hostname and/or reject_unknown_reverse_client_hostname. In general, reject_unknown_client_hostname is too strong a test, while reject_unknown_reverse_client_hostname has very few false positives. When a mail system uses multiple PTRs, it is a strong hint that at some point reject_unknown_client_hostname is going to trigger, due to whatever odd architecture justifies the multiple PTRs exposing itself to the world. Because Postfix (wisely) does not anticipate all DNS edge cases, you have to choose between 3 comprehensibly simple options for PTR-based enforcement: none, requiring all PTRs to give names with some forward resolution, or requiring all PTRs to give names that resolve back to the original IP. All that multiple PTRs changes is that it means you have a m/n chance of rejection where n = the total number of PTR records and m = the number of records that don't meet the rule you choose to enforce.

Reply via email to