we have an Mdaemon server which redirects outbound mails to an external basic Postfix relayer. We have configured firewall rules (in front of postfix server) to accept smtp requests only from the public IP of the Mdaemon primary mail server. We also has configured this IP in main.cf mynetworks parameters.
mynetworks = 127.0.0.0/8 <public IP Mdaemon SVR>/32
We noticed that we were receiving mails with From=anyuser@anydomain bounced from the primary mail server and want to accept only requests with FROM=users@mydomain and reject the rest. We have read about it and the simplier way seems to be using smtpd_recipient_restrictions so we did,
At main.cf added
smtpd_recipient_restrictions = permit_mynetworks, check_sender_access hash:/etc/postfix/sender_access reject_unauth_destination
Created /etc/postfix/sender_access mydomain OK
postmap /etc/postfix/sender_access and postfix reload
However we keep getting logs accepting mails from other domains,
postfix/smtpd: connect from unknown[Public IP MDaemon] postfix/smtpd: EBC3826081: client=unknown[Public IP MDaemon] postfix/cleanup: EBC3826081: message-id=etPan.firstname.lastname@example.org postfix/qmgr: EBC3826081: from=otheruser@otherdomain, size=33492, nrcpt=1 (queue active) postfix/smtpd: disconnect from unknown[Public Ip Maemon] postfix/smtp: EBC3826081: to=<oneuser@onedomain>, ..., status=sent (250 Ok, message saved <Message-ID: etPan.email@example.com>)
or sometimes is rejected by antispammers (blacklist, greylists,..).
So, we will be grateful if you could help us to make this work, and any suggestion to secure this environment will be welcome.