OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Restrict users to received outside mails

From: mouss (moussnetoyen.net)
Date: Sun Sep 07 2008 - 12:25:19 CDT


Sam Przyswa wrote:
> Hi,
>
> How to restrict users to received outside mail (from internet) but only
> from the local domain/network ?
>

If your goal is to restrict few addresses so that:

- they can only send mail to your own domains (domains in mydestination,
virtual_*_domains and relay_domains).

- the addresses can only be used from mynetworks (outsiders may not use
the address as sender or recipient)

then you can do it like this:

smtpd_restriction_classes =
        ...
        internal_only
        ...

smtpd_sender_restrictions =
        check_sender_access hash:/etc/postfix/restricted_addr
        check_recipient_access hash:/etc/postfix/restricted_addr

internal_only =
        # they can't relay
        reject_unauth_destination
        # they can only be used from mynetworks
        permit_mynetworks
        reject

== restricted_addr
fooexample.com internal_only
local.example.org internal_only

if this is not what you want, explain your goal more clearly. it may be
easier to give examples of what is allowed and what is not. if you can
formulate the goal in a "mathematical logic" style (if blah and blah,
then allow. if blah and blah then reject. ...), do that too.