Public Maildomain in a non-public Directory Service

In an environment where the mail domain is public but the Directory (LDAP~) domain is not, some specific settings need to be adjusted. This can be archieved by properly adjusting the main.cf via the appropriate UCR variables. In the assumed szenario there only a single mail domain is configured.

Instructions

adjust mail settings at your domain’s mail server via UCR

# the first command takes care if your FQDN is registered as mailserver via DNS MX record
root@ucs-mail:~# mailserver=$( host -t mx $( dnsdomainname ) | grep $(hostname -f ) | awk '{print $7}' | sed 's/\.$//' )

root@ucs-mail:~# ucr set mail/postfix/myhostname="$mailserver"
root@ucs-mail:~# ucr set mail/postfix/myorigin="$mailserver"
root@ucs-mail:~# ucr set mail/smtp/helo/name="$mailserver"
root@ucs-mail:~# ucr set mail/postfix/smtp/banner="$mailserver ESMTP"

check adjusted mail settings

root@ucs-mail:~# grep -E "(^my|helo)" /etc/postfix/main.cf

root@ucs-mail:~# postfix check
root@ucs-mail:~# postfix reload