
This assumes your Linux Postfix server is already configured to query users from LDAP. If not, follow the OpenLDAP tutorial.
Create the ldap-aliases.cf file.
~]# touch /etc/postfix/ldap-aliases.cf
Add the hostname and base DN of your LDAP server to the ldap-aliases.cf file.
server_host = ldap.example.com
search_base = dc=example,dc=com
Make sure you can query a LDAP user.
~]# postmap -q JohnDoe ldap:/etc/postfix/ldap-aliases.cf
Add ldap:/etc/postfix/ldap-aliases.cf to the alias_maps line in your /etc/postfix/main.cf file.
alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-aliases.cf
The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.
If your system is using systemd, use the systemctl command to restart postfix.
systemctl restart postfix
If your system is using init, use the service command to restart postfix.
service postfix restart
Did you find this article helpful?
If so, consider buying me a coffee over at