Skip to content

Instantly share code, notes, and snippets.

@m4ce
Last active April 27, 2016 12:17
Show Gist options
  • Save m4ce/965ec89dd98aed9d9e4145aa399f1796 to your computer and use it in GitHub Desktop.
Save m4ce/965ec89dd98aed9d9e4145aa399f1796 to your computer and use it in GitHub Desktop.
Rewrite postfix sender/recipient mail address from FreeIPA (LDAP)
server_host = <ipa_host>
server_port = 389
bind = no
search_base = cn=users,cn=accounts,dc=example,dc=org
query_filter = (&(objectClass=person)(uid=%u))
result_attribute = mail
result_format = %s
start_tls = yes
version = 3
tls_key = <key>
tls_cert = <cert>
tls_ca_cert_file = /etc/ipa/ca.crt
sender_canonical_maps = regexp:/etc/postfix/sender_canonical, ldap:/etc/postfix/canonical_ldap
recipient_canonical_maps = regexp:/etc/postfix/recipient_canonical, ldap:/etc/postfix/canonical_ldap
@m4ce
Copy link
Author

m4ce commented Apr 27, 2016

If you don't want to create a system user to bind with, you need to allow read access to the user's mail attribute when binding anonymously.

ipa permission-add 'Mail readable by anonymous' --type=user --attrs=mail --bindtype=anonymous --permissions=read

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment