2

I have a postfix installation with amavis and postfwd. I'd like to block a single sender only for a single receiver. I tried with header_checks but multiline checking I was thinking something like

id=BLOCKIT
sender==badsender@domain.com; recipient==myreceiver@domain.com; action=REJECT no sender

on postfwd but I can't find the proper syntax... Has anyone some suggestions?

golemwashere
  • 724
  • 1
  • 10
  • 21

2 Answers2

3

I don't know how to do this in postfwd, but within Postfix, you can use Restriction Classes for this. If you e.g. want to prevent bob@example.net to send mail to your user alice@example.com:

smtpd_restriction_Classes = mail_for_alice
mail_for_alice = check_sender_access hash:/etc/postfix/mail_for_alice
smtpd_recipient_restrictions =
  ...
  check_recipient_access hash:/etc/postfix/special_recipients

The file special_recipients would contain a line like

alice@example.com mail_for_alice

And mail_for_alice would contain:

bob@example.net reject

That said, you are probably better of with doing all of this in postfwd ;-)

Stefan Förster
  • 1,141
  • 5
  • 8
  • tried this but it was not working in my case: I needed to skip bounces only for a certain user... I would have liked to drop MAILER-DAEMON messages only to him, looks like restrictions are before bounces and probably even postfwd would not have worked... I finished using another workaround with an alias to a script – golemwashere Sep 19 '13 at 18:51
2

I have accomplished similar tasks using Postgrey. You could install postgrey and disable the greylisting feature, but retain the whitelist and blacklist features. Many people find Postgrey intrusive, I find it to be a nearly perfect spam filter.

Paul
  • 2,755
  • 6
  • 24
  • 35
  • thanks the best option would be using or postfwd or amavisd that are already installed and working, I'd rather not add extra software again – golemwashere Sep 16 '13 at 12:03