OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: simple blocking based on addresses

From: mouss (usebsdfree.fr)
Date: Tue Jan 02 2007 - 15:29:48 CST


Derek B. Noonburg wrote:
> Is there any simple way to have postfix block mail from a specific
> address to another specific address?
>
> I'm getting a lot of spam from a certain (forged) address. It's all
> copies of some virus, and it's eating enough bandwidth that I'd like to
> kill it at the server, ideally before the message body gets sent. (It's
> trivial to filter later with procmail/spamassassin, but the goal here is
> to avoid the waste of bandwidth.) I don't really want to reject all
> email from that address -- there are other users on this mail server who
> might conceivably want to get legitimate email from that address.
>
> I looked at the postfix docs on filtering, etc., but it gets really
> complicated really fast. Is there an easy way to just kill anything
> sent from ab to cd?
>
>

There is no "general" solution because postfix checks do not "keep state".

if this is only for few addresses (or if you can setup few address
groups), then you can use restrictions classes.

smtpd_restriction_classes = ...
    reject_from_foo
    ...

smtpd_recipient_restrictions =
    ...
    check_recipient_access hash:/etc/postfix/maps/hash/recipient_acl
    ..

reject_from_foo =
    check_sender_access hash:/etc/postfix/maps/hash/ban_foo
   

== recipient_acl
openwideexample.com OK
foo.haterexample.com reject_from_foo
...

== ban_foo:
foobar.example REJECT