On Wednesday 23 November 2011 14:14:03 David Mehler wrote:
> I've got a postfix system running mysql virtual mailbox domains and
> dspam hooked in to it. I've got a test user called test1 and have
> hooked in dspam in to my setup. I'm having an issue with the alias
> addresses.
> 
> To my database I've added:
> 
> INSERT INTO `mail`.`virtual_aliases` (
>   `id`,
>   `domain_id`,
>   `source`,
>   `destination`
> )
> VALUES (
>   '19', '1', 'spam-test1', 'test1'
> );
> 
> and the same for notspam-test1 with an increased ID. In my
> smtpd_recipient_restrictions after permit_mynetworks,
> permit_sasl_authenicated, and reject_unauth_destination I've got
> these two lines:
> 
> check_recipient_access pcre:/etc/postfix/dspam_check_aliases
> check_sender_access pcre:/etc/postfix/dspam_check_aliases
> 
> so that only user's on mynetworks or authenticated via sasl can use
> the spam and notspam addresses. An externally sent email to
> notspam-te...@domain.com

Sounds like this whole issue could have been solved by using as the 
domain name something that only resolves internally, @localhost or 
whatever.

> went through. I'm assuming I have an error in my pcre table. Here
> it is:
> 
> /^.*(spam|notspam)@.*$/ REJECT
--------------------^

Simplified, this expression could be rewritten:
/(not)?spam\@/          REJECT
but it still does not do what you want.

> I thought the * was suppose to catch everything after it. Any
> suggestions on the fix to this line I'd appreciate.

You put the .* in the wrong (useless) place rather than where you 
needed it to be:
/(not)?spam.*\@/                REJECT
between the string and the '\@'.

I like to remind people of Zawinski's famous words about solving a 
problem with regular expressions, thereby yielding two problems! 
Perhaps you really wanted:

main.cf ::
recipient_delimiter = -
smtpd_recipient_restrictions = [ ... ] reject_unauth_destination
  [ ... ]
  check_recipient_access hash:/etc/postfix/dspam_check_aliases
  check_sender_access hash:/etc/postfix/dspam_check_aliases

dspam_check_aliases ::
s...@example.com                        REJECT
nots...@example.com             REJECT

Simpler, and this could be integrated with a general-purpose address 
lookup, if desired.
-- 
    Offlist mail to this address is discarded unless
    "/dev/rob0" or "not-spam" is in Subject: header

Reply via email to