Univention Bugzilla – Bug 38061
Postfix allows MAIL FROM address spoofing
Last modified: 2015-03-25 16:43:08 CET
Has to be implemented for UCS 4, too.
+++ This bug was initially created as a clone of Bug #31738 +++
The current postfix configuration allows users to spoof arbitrary MAIL FROM addresses, e.g. email@example.com. Once a user is authenticated every possible address can be used, even from mail domains that are not hosted by the UCS mail server.
According to main.cf:
# smtpd_sender_restrictions is not defined since all relevant checks have been moved to
# smtpd_recipient_restrictions and every mail has to pass smtpd_recipient_restrictions too.
But this doesn't work, because smtpd_recpient_restrictions just applies to the RCTP TO context which doesn't check the MAIL FROM address (http://www.postfix.org/postconf.5.html#smtpd_recipient_restrictions).
This is a simple workaround that checks whether the sender's login matches the MAIL FROM address he's trying to send mail for:
smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch
smtpd_sender_login_maps = ldap:/etc/postfix/ldap.virtual
When canonical address rewriting is enabled, the login maps need to be extended.
UCS 3.1-1-errata 122
(In reply to Sönke Schwardt-Krummrich from comment #3)
> So, if the SASL username has to match to the sender address and a simple
> reject_authenticated_sender_login_mismatch is sufficient, this can be
> achieved by calling:
This was not sufficient, as the change also affected usual incoming mails over port 25.
To give a possibility to fix this issue, the following changes have been made (together with the new feature from bug 38062):
1) via UCR a new set of restriction rules may be defined (submission_recipient_restrictions) similar to the UCR variables for smtpd_recipient_restrictions.
The new prefix is mail/postfix/submission/restrictions/recipient/...
A new lookup table ldap.saslusermapping has been added for the postfix option smtpd_sender_login_maps:
SASL-USER ==> (mailPrimaryAddress|mailAlternativeAddress)
SASL-USER is the mail address with which the user authenticates itself at postfix.
When updating to the actual version of this package, no functional change is done.
To fix the problem of the bug reporter, the following steps have to be performed:
To force the sender address to match with the registered mail addresses at the user account (mailPrimaryAddress or mailAlternativeAddress), the following UCR variables have to be set:
ucr set \
This sets the new submission_recipient_restrictions and activates the for the smtps service on port 465.
Also the smtpd_sender_login_maps option is configured for the smtps service.
@QA: the changes have been comitted with the bug number 31738 in SVN.
OK - no change during update
OK - /etc/postfix/ldap.saslusermapping
OK - UCR vars
OK - Setup
OK - smtps from extern only with authentification
OK - smtps from my_networks (without authentification)
OK - force sender address to match with registered mail addresses over smtps
OK - ucs-test -s mail
OK - horde
OK - 2015-03-13-univention-mail-postfix.yaml