OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Allowing mail only from specific address

From: mouss (usebsdfree.fr)
Date: Thu Sep 14 2006 - 16:22:33 CDT


Nathan Kane wrote:
> Hello,
>
> Is there a way to configure postfix to reject all mail sent to an
> address unless the mail is from a specific address?
>
> For example, if postfix is receiving mail for mydomain.com I want to
> reject all mail to joeusermydomain.com unless the sender is
> fooyourdomain.com.
>
> I have found how to do the opposite (reject mail from specific users),
> but this one is stumping me.
>
> I know I can filter after the fact, but don't want to do it that way.
>

Since you didn't show your config, we can't provide an "adapted"
solution. Here is a generic one, which requires caution (see below).

smtpd_recipient_restrictions =
    check_recipient_restriction hash:$dir/zed
   ...

smtpd_restrcition_classes = ... zed_policy ...

zed_policy =
    check_sender_access pcre:$dir/zed_acl
   

# cat $dir/zed
zedexample.com joe_policy

# cat $dir/joe_acl
/^butchexample\.org$/ DUNNO
/^fabienneexample\.net$/ 550 Who's Zed?
/./ 550 Zed's dead, baby.
Zed's dead.

CAUTION: do not put ok or permit in this map.