Enforcing a match between FROM address and sasl username

Issue

If a user's password is compromised, the Server default setup allows the user to relay emails using a different email address than the one uses to authenticate with smtp.

A message header from that user looks like this:

zimbra1 postfix/smtpd[29431]: B28914D5978: client=xxxxx.server.com[w.x.y.z], sasl_method=LOGIN, sasl_username=

Where the sender's user name and the from address are indicated in bold. This article explains how to ensure that the from address matches the sender's username. 


How-to

Zimbra Collaboration 8.8.x, 8.7.x, 8.6

Note:

Optional, use an exception DB

If you want an exceptions DB to allow people to send as alternate addresses

 cd /opt/zimbra/conf
 edit slm-exceptions-db

Add the alternate ID addresses and the real userid, for example for the user joe who has joe@gmail.com

 joe@gmail.com joe

Then run postmap slm-exceptions-db to generate the database

postmap slm-exceptions-db

Update zimbraMtaSmtpdRejectUnlistedRecipient & zimbraMtaSmtpdRejectUnlistedSender

zmprov mcf zimbraMtaSmtpdRejectUnlistedRecipient yes
zmprov mcf zimbraMtaSmtpdRejectUnlistedSender yes
zmmtactl restart
zmconfigdctl restart

Set the zimbraMtaSmtpdSenderLoginMaps portion

If the exception db is used
zmprov mcf zimbraMtaSmtpdSenderLoginMaps 'lmdb:/opt/zimbra/conf/slm-exceptions-db, proxy:ldap:/opt/zimbra/conf/ldap-slm.cf' +zimbraMtaSmtpdSenderRestrictions reject_authenticated_sender_login_mismatch
If the exception db is not used
zmprov mcf zimbraMtaSmtpdSenderLoginMaps  proxy:ldap:/opt/zimbra/conf/ldap-slm.cf +zimbraMtaSmtpdSenderRestrictions reject_authenticated_sender_login_mismatch
Edit the file smtpd_sender_restrictions

You need to edit the file

vi /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf

Should look like this:

permit_mynetworks, reject_sender_login_mismatch

After a minute, zmconfigd will update the postfix configuration automatically and apply the new rules. Now if an account is hacked, and this is in place, they will not be able to send out emails with different "from" addresses. 


Ref:

https://wiki.zimbra.com/wiki/Enforcing_a_match_between_FROM_address_and_sasl_username_8.5

Comments

Popular posts from this blog

Cambium cnPilot E400/E410/E500 Configuration Tutorial

Disabling Zimbra's AntiSpam, Amavis and AntiVirus filtering

Error "Unable to retrive Zimbra GPG key for package validation"