Postfix can be configured to prevent email senders from using an email address that does not belong to them. This article describes how to configure the sender restriction in Postfix to prevent senders from spoofing email addresses.

Edit sender-login.pcre
2. Create a Postfix map file which returns a user name given an email address. The line below is a regular expression that returns the user part from an email address. Example, bugsbunny@acme.local returns bugsbunny as the user name. If this works for you, then save it into the file /etc/postfix/sender_login.pcre
/(.*)@.*/ $1
Edit main.cf3. Edit the file /etc/postfix/ and add the lines below.
smtpd_sender_login_maps = pcre:/etc/postfix/sender_login.pcre
smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch

If you have a different map file, specify it in the smtpd_sender_login_maps line.

Service Configuration4. Restart the Postfix or MailScanner service if you have installed it. Learn how to start and stop services here.
Terminal5. Try sending an email using an address that does not belong to you, Postfix should reject your attempt.

Visit the forum to ask for help or to give a comment.

Posted on 4/30/2010 and last updated on 5/22/2010
Filed under Postfix