Postfix – autorisatie voor groepsleden

by wbk | 22 januari 2025 16:43

Standaard mag een Yunohost-gebruiker geen mails versturen met als from: een mail alias van een groep waar die gebruiker lid van is.

Om dat wel toe te staan, is een aanvulling op de Postfix-configuratie /etc/postfix/main.cf nodig.

Bij de migratie van Yunohost 11 naar Yunohost 12 (Debian Bullseye naar Bookworm) werd Postfix’s main.cf aangeduidt als “handmatig aangepast en mogelijk overschreven tijdens de upgrade”

Hieronder een diff van de aangepaste main.cf en de default van Yunohost.

 # Virtual Domains Control
 virtual_mailbox_domains = ldap:/etc/postfix/ldap-domains.cf
-virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf
+virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf,hash:/etc/postfix/app_senders_login_maps
 virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf,ldap:/etc/postfix/ldap-groups.cf
-smtpd_sender_login_maps=
+smtpd_sender_login_maps = unionmap:{
    # Regular Yunohost accounts
    ldap:/etc/postfix/ldap-accounts.cf,
-   # test: groups toevoegen, om groep-alias werkend te krijgen
-   ldap:/etc/postfix/ldap-groups.cf,
    # Extra maps for app system users who need to send emails
-   hash:/etc/postfix/app_senders_login_maps
-
+   hash:/etc/postfix/app_senders_login_maps }

De toevoeging komt uit /etc/postfix/ldap-groups.cf; daarin zitten:

# cat /etc/postfix/ldap-groups.cf
server_host = localhost
server_port = 389
search_base = dc=yunohost,dc=org
query_filter = (&(objectClass=groupOfNamesYnh)(mail=%s))
scope = sub
result_attribute = memberUid, mail
terminal_result_attribute = memberUid

Source URL: https://online.osba.nl/blog/2025/01/22/postfix-autorisatie-voor-groepsleden/