postfix does no longer use dns domain search

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 8.0
  • postfix-3.3.1-8.el8

Issue

The postfix MTA can ignore RES_DEFNAMES and RES_DNSRCH resolver flags which will result in not searching hostnames in the domain.

For example with the following postfix configuration:

# postconf -e "smtp_host_lookup = dns"
# postconf -e "smtp_dns_resolver_options = res_defnames, res_dnsrch"
# postconf -e "relayhost = [smtp]"

If the domain of the mail server is example.com it will not use smtp.example.com SMTP mail server for relaying.

Resolution

This problem can be resolved by addition of the native to the smtp_host_lookup configuration parameter, i.e.:

# postconf -e "smtp_host_lookup = dns, native"

Then it will behave the same way as in the Red Hat Enterprise Linux 7 and it will search the domain.

Fix release reverting to the original behaviour is tracked by public Bug 1723950

Root Cause

Resolver code in postfix has been rewritten and improved. After the rewrite it used the res_query libresolv call instead of the res_search libresolv call for DNS resolving, thus it didn't process the search rules controlled by the RES_DEFNAMES and RES_DNSRCH resolver flags.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.