I'm taking steps to harden my outgoing postfix SMTP server. I want to prevent users from spoofing their sender address.
When sending email with postfix SMTP the sender is identified in three ways:
- In the email itself there is a
From:
header - as defined in RFC 822 - When sending with SMTP there is a
MAIL FROM
address - as defined in RFC 821 - When logging into postfix (SMTP) a client specifies a username which can also be interpreted as the sender
Looking in the manual, I believe that reject_sender_login_mismatch and reject_unlisted_sender will together guarantee that the MAIL FROM
email as associated with the postifx login. That's 2 and 3 above match.
I'm stuck on how to ensure that all three match. I'm happy if the result just re-writes the message rather than rejecting but either would be fine. However I don't see a way to do this. I can see that cleanup will add a missing From:
header but I see no way to check and rewrite one.
Thanks to those who pointed out another similar question. Unfortunately this has been of no help as the question has two answers, one is very vague the other appears to be wrong.