0

I am using postfix + dovecot(imap+pop3) + mysql I whant to explicity define users or groups that can send email on behalf of others I was thinking doing this way: for all local(mysql) authenticated users filter outgoing mail: filter all mail by headers Return-Path/X-Original-To/From: field must matche authenticated user that sends it, otherwise bounce the email

Any ideas how to do this?

1 Answers1

3

You can use smtpd_sender_login_maps and reject_authenticated_sender_login_mismatch in smtpd_sender_restrictions to restrict which MAIL FROM addresses logged in users can use. For example:

main.cf:

smtpd_sender_login_maps = hash:/etc/postfix/sender_login_maps
smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch

/etc/postfix/sender_login_maps:

alice@example.com       alice
bob@example.com         bob
charlie@example.com     charlie
marketing@example.com   alice,charlie

Don't forget to run postmap:

# postmap /etc/postfix/sender_login_maps
sebix
  • 4,313
  • 2
  • 29
  • 47
mgorven
  • 30,615
  • 7
  • 79
  • 122