OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Blocking emails from certain addresses

From: mouss (usebsdfree.fr)
Date: Wed Nov 02 2005 - 07:04:10 CST


Oliver Marshall a écrit :

>Hi,
>
>I *thought* I had setup postfix to bounce emails from certain users with
>a given error, using an access file. However, turns out that I never
>added the access file to my main.cf list of stuff, so it wasn't used.
>Ooops.
>
>Can anyone tell me where I should put the /etc/postfix/access in order
>for the contents of /etc/postfix/access to be used to block email
>addresses ? ("access" is a text file containing email
>address<tab>error#<tab>description and is postmap'd when edited).
>
>
are you getting that from a sendmail installation? The syntax I know of is
foobadsite.example 5xx Comme back with flowers
wolfpig-eaters.example 4xx Your legs are black
barbadsite.example REJECT

where 5xx and 4xx is the code to return, such as 550.... recent postfix
can also return an enhanced status code.

see http://www.postfix.org/access.5.html

then in main.cf
smtpd_recipient_restrictions =
    permit_mynetworks
    reject_unauth_destination
    check_sender_access hash:/etc/postfix/access
    ...

to make it apply to your own users, put it before permit_mynetwors, but
then make sure to never put an OK (or a code that accepts the message,
lest you become an open relay).