Page 1 of 1

Restricting outbound internet emails to specific domains

Posted: Wed Sep 26, 2007 5:51 pm
by Armitage72
I'd like to be able to restrict outbound internet emails to specific domains. There is a KB article at http://portal.knowledgebase.net/display ... =0.7604334 that works for blocking all outbound internet emails which I was able to get working. Is it possible to modify the rules or routing so that certain domains are exempted?

For example, outbound internet emails to domain-a.com and domain-b.com are allowed, while any other external domains are rejected?

Thanks!

Posted: Tue Oct 02, 2007 7:23 pm
by florian
the scalix rules mechanism - as it is based on routes - could only do that if all recipients on the domain are listed in the directory, so it's pretty much inadequate. I would suggest to block the disallowed domain on the sendmail level, through which every outbound internet mail flows. believe accessdb is your friend there.

Florian.

Posted: Thu Oct 04, 2007 9:08 am
by Armitage72
Thanks for the tip, Florian. After some searching I found a post on how to do this in sendmail.

- cd to /etc/sendmail
- Add the following to sendmail.mc, changing the entries for outgoing_domains to the domains you want to allow emails to

Code: Select all

LOCAL_CONFIG
C{outgoing_domains} domainA.com domainB.com domainC.com

SLocal_check_rcpt
R$*                                             $: $1 $| $>CanonAddr $1
R$* $| $+ < >                                   $@ OK
R$* $| $+ < $* $={outgoing_domains} . >         $@ OK
R$* $| $+ < $+ >                                $#error $@ 5.7.1 $: "550 Access denied"
R$* $| $*                                       $@ $1


- Type 'make'
- Restart sendmail

External emails to domainA.com, domainB.com, and domainC.com will go through, all others will give a bounceback to the sender of "550 Access denied".

Posted: Thu Oct 04, 2007 10:50 am
by florian
Hey, great.

Thanks for documenting this back here. Now... as you've done that, maybe we can go one step further - would you be willing to doc this in a little mini how-to on wiki.scalix.com?

I think this is information worth preserving....

Cheers, Thanks,
Florian.