OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Overriding reject_unlisted_recipients

From: Ben Beuchler (insytegmail.com)
Date: Fri Oct 26 2007 - 14:25:58 CDT


I'm trying to redirect all mail that matches a lookup table or policy
server rule, even if the mail is for a nonexistent user. Otherwise I
want to continue rejecting mail for nonexistent users.

I'm trying to test my ideas by configuring postfix to redirect all
mail from a specific sender back to itself, even if the rcpt doesn't
exist. Here's what I've got so far:

=============================================
main.cf:
smtpd_reject_unlisted_recipient = no

smtpd_restriction_classes = test_redirect
test_redirect =
    check_sender_access regexp:/etc/postfix/redirect_all,
    reject_unlisted_recipient = no,
    permit

smtpd_recipient_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    check_sender_access hash:/etc/postfix/redirect_table,
    reject_unauth_destination,
    reject_unlisted_recipient,
    check_policy_service unix:private/tumgreyspf,
    permit
=============================================

=============================================
/etc/postfix/redirect_all:
/^/ redirect insyteexample1.net
=============================================

=============================================
/etc/postfix/redirect_table:
insyteexample1.net test_redirect
=============================================

Here's what happens when I try to trigger these rules:

Oct 26 14:03:00 mazer postfix/smtpd[3555]: connect from unknown[209.240.75.2]
Oct 26 14:03:00 mazer postfix/smtpd[3555]: NOQUEUE: redirect: RCPT
from unknown[209.240.75.2]: <insyteexample1.net>: Sender address
triggers REDIRECT insyteexample1.net; from=<insyteexample1.net>
to=<frankiedomain2.com> proto=ESMTP helo=<proton.pozitronic.com>
Oct 26 14:03:00 mazer postfix/smtpd[3555]: NOQUEUE: reject: RCPT from
unknown[209.240.75.2]: 550 5.1.1 <frankiedomain2.com>: Recipient
address rejected: User unknown in virtual alias table;
from=<insyteexample1.net> to=<frankiedomain2.com> proto=ESMTP
helo=<proton.pozitronic.com>
Oct 26 14:03:01 mazer postfix/smtpd[3555]: disconnect from unknown[209.240.75.2]

Clearly I'm misunderstanding something. Any pointers?

-Ben