I am trying to restrict inbound email to only those addresses registered in Microsoft Exchange and have tried editing /etc/postfix/recipient_access but this has no effect.
Is there any documentation that describes how to do this, preferably using LDAP so that as users are added to MS Exchange, they are automatically allowed to receive email through EFA.
Thanks
Colin
Allowing email to known Exchange recipients only
- shawniverson
- Posts: 3649
- Joined: 13 Jan 2014 23:30
- Location: Indianapolis, Indiana USA
- Contact:
Re: Allowing email to known Exchange recipients only
When you created recipient_access, did you compile it with postmap and restart postfix?
If you want to automate this, you can use a script to rebuild the recipient_access list periodically and automate with a cron job...check out this post...
/viewtopic.php?f=14&t=433
Code: Select all
sudo postmap /etc/postfix/recipient_access
/viewtopic.php?f=14&t=433
Re: Allowing email to known Exchange recipients only
Ok I have got the LDAP integration to work to a fashion (I will come back to this in another post later once this is working)
The process now generates /etc/postfix/relay_recipients (or /etc/postfix/recipient_access I have tried both) and then runs postmap /etc/postfix/relay_recipients (or /etc/postfix/recipient_access as appropriate) and this generates a /etc/postfix/relay_recipients.db
The content of /etc/postfix/relay_recipients is in the format:
user1@mydomain.co.uk OK
user2@mydomain.co.uk OK
and so on.
When I send an email from external to say fred@mydomain.co.uk (who doesn't exist), it still gets passed through to my Exchange server.
What am I missing? And is there a definitive step by step guide?
The process now generates /etc/postfix/relay_recipients (or /etc/postfix/recipient_access I have tried both) and then runs postmap /etc/postfix/relay_recipients (or /etc/postfix/recipient_access as appropriate) and this generates a /etc/postfix/relay_recipients.db
The content of /etc/postfix/relay_recipients is in the format:
user1@mydomain.co.uk OK
user2@mydomain.co.uk OK
and so on.
When I send an email from external to say fred@mydomain.co.uk (who doesn't exist), it still gets passed through to my Exchange server.
What am I missing? And is there a definitive step by step guide?
Re: Allowing email to known Exchange recipients only
Got it working with the following commands:
postconf -e "relay_recipient_maps = hash:/etc/postfix/relay_recipients"
postfix reload
Now back to the other issue I have. I cannot get the the script to work with OUs. It works with a CN though. And if I use $hqbase="dc=example,dc=com" then it picks up everything (CNs and OUs)
postconf -e "relay_recipient_maps = hash:/etc/postfix/relay_recipients"
postfix reload
Now back to the other issue I have. I cannot get the the script to work with OUs. It works with a CN though. And if I use $hqbase="dc=example,dc=com" then it picks up everything (CNs and OUs)
- shawniverson
- Posts: 3649
- Joined: 13 Jan 2014 23:30
- Location: Indianapolis, Indiana USA
- Contact:
Re: Allowing email to known Exchange recipients only
Can you PM me your script?
I would like to test it against my domain...
I would like to test it against my domain...
Re: Allowing email to known Exchange recipients only
Thanks for helping me fix this. I have one final but very important question:
How do you undo all this if it fails to work or you no longer want it implemented?
How do you undo all this if it fails to work or you no longer want it implemented?
- shawniverson
- Posts: 3649
- Joined: 13 Jan 2014 23:30
- Location: Indianapolis, Indiana USA
- Contact:
Re: Allowing email to known Exchange recipients only
Just empty out the relay_recipients. Remove it and replace it with a zero length file of the same name and postmap it.