From: VR on
Having read postfix.org/regexp_table.5.html, I'm experimenting to stop
junk mail to common system accounts with
check_recipient_access regexp:/etc/postfix/reject_by_recipient_regexp

and trying to learn how to craft regexp's. I've tried many iterations
similar to:
/^To: man@/ REJECT or /^To: man(a)mydomain\.tld/ REJECT

I issue postfix reload after edits but the syntax is wrong so my test
message still queues for delivery.

May 12 16:29:45 mail postfix/smtpd[14294]: connect from
outbound.mydomain.tld[x.x.x.x]
May 12 16:29:47 mail postfix/smtpd[14294]: F0E792BC36:
client=outbound.mydomain.tld[x.x.x.x]
May 12 16:29:48 mail postfix/cleanup[14298]: F0E792BC36:
message-id=<51D9D6BFDD2B4143825EB048E4266FBE084227B3(a)outbound.mydomain.tld>
May 12 16:29:48 mail postfix/qmgr[14170]: F0E792BC36:
from=<me(a)mydomain.tld>, size=3744, nrcpt=1 (queue active)
May 12 16:29:48 mail postfix/local[14299]: F0E792BC36:
to=<man(a)mydomain.tld>, relay=local, delay=0.35, delays=0.32/0.01/0/0.02,
dsn=2.0.0, status=sent (delivered to mailbox)
May 12 16:29:48 mail postfix/qmgr[14170]: F0E792BC36: removed
May 12 16:29:48 mail postfix/smtpd[14294]: disconnect from
outbound.mydomain.tld[x.x.x.x]

What should proper syntax look like?

From: Brian Evans - Postfix List on
On 5/12/2010 4:44 PM, VR wrote:
> Having read postfix.org/regexp_table.5.html, I'm experimenting to stop
> junk mail to common system accounts with
> check_recipient_access regexp:/etc/postfix/reject_by_recipient_regexp
>
> and trying to learn how to craft regexp's. I've tried many iterations
> similar to:
> /^To: man@/ REJECT or /^To: man(a)mydomain\.tld/ REJECT
>
> I issue postfix reload after edits but the syntax is wrong so my test
> message still queues for delivery.
>
[snip log]
> What should proper syntax look like?

For a check_recipient_access, this should be (untested):
/^man@/ REJECT

For a header_checks, it should be like you said.

The difference? header_checks looks at the To: "header",
check_recipient_access looks at the "RCPT TO" command.

Brian

From: mouss on
VR a �crit :
> Having read postfix.org/regexp_table.5.html, I'm experimenting to stop
> junk mail to common system accounts with
> check_recipient_access regexp:/etc/postfix/reject_by_recipient_regexp
>
> and trying to learn how to craft regexp's. I've tried many iterations
> similar to:
> /^To: man@/ REJECT or /^To: man(a)mydomain\.tld/ REJECT

there's no "To: " in a recipient address. don't confuse with headers.

simply use a hash table (cdb if you can):
man(a)mydomain.tld REJECT

if you want regex/pcre, be as precise as you can. start with

/^man(a)mydomain\.tld$/ REJECT

you don't want to accidentally reject mail for milkman(a)domain.tld, nor
man(a)mydomain.tld.yahoo.com.


> [snip]