Can I make an exception to reject_unknown_client_hostname?

My outer SMTP is blocking some e-mails with the error 450 4.7.1 Client host rejected: cannot find your hostname, which we traced back to the reject_unknown_client_hostname. As it happens, the hostname to which the reverse address resolves does not, itself, have a DNS record. The chances of getting this fixed are low, but we do need to get their e-mail.

So, can we configure some sort of exception to get around this rule just for them?


Solution 1:

You can allow specific client to bypass the smtpd_client_restrictions:

smtpd_client_restrictions =
  check_client_access hash:/etc/postfix/client_access,
  reject_invalid_hostname

This would first take the specified action in client_access, and if it doesnt match any rule listed there, then reject the senders that have no valid domain.

The syntax in client_access would be:

1.2.3.4    OK
bad.domain REJECT

Once this file is setup, execute the following command to generate the indexed version of this file (db):

postmap /etc/postifx/client_access

Reload postfix and you should be ok.

More doc on access tables

More on smtpd_client_restrictions

EDIT: If for some reason you need to debug this, you could try to enable debugging in smtpd depending on who is connecting to your service. Edit /etc/postfix/master.cf, locate smtpd service and add a line like this one:

smtp      inet  n       -       -       -       -       smtpd
       -o debug_peer_level=10 -o debug_peer_list=1.2.3.4

It will enable debug only for peer 1.2.3.4. This should give you an idea of what is happening when the client 1.2.3.4 is connecting to the smtp service to send you email, by looking at your mail log.