List Info

Thread: getting regular expressions into local_domains_maps?




getting regular expressions into local_domains_maps?
country flaguser name
United States
2007-05-18 22:45:58
I'm trying to use amavis + postfix with virtual users, with
an extra twist:
a wildcard virtual domain. This is configured in postfix
with a regexp file:

 virtual_mailbox_domains =
regexp:/etc/postfix/vhosts/domains

which looks like this:

 /customer1.com/                       virtual:
 /customer2.org/                       virtual:
 /.*.customer3.org/                   virtual:

What I want to do is stuff this file into
local_domains_maps, so that I can
get spam headers added. Looking at the code, I see that the
lookup function
will call lookup_re for isa('Amavis::Lookup::RE'), but not
being a perl
person, I have no idea how to create such a beast.

I see functions for read_hash and read_array... A
read_regexp function that
would take the above file and stuff it into
local_domains_maps would be just
what I'm looking for... but other suggestions (_besides_
"don't use
wildcards") would be greatly appreciated!

------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
AMaViS-userlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user

AMaViS-FAQ:http://www.amav
is.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/ho
wto/

Re: getting regular expressions into local_domains_maps?
country flaguser name
Slovenia
2007-05-21 14:31:30
rsamavis.spam.futz.org,

> I'm trying to use amavis + postfix with virtual users,
with an extra twist:
> a wildcard virtual domain. This is configured in
postfix with a regexp
> file:
>  virtual_mailbox_domains =
regexp:/etc/postfix/vhosts/domains
> which looks like this:
>
>  /customer1.com/                       virtual:
>  /customer2.org/                       virtual:
>  /.*.customer3.org/                   virtual:

You should anchor regular expressions as appropriate!

   /customer1.com$/
   /customer2.org$/
   /.customer3.org$/

There is no need for using regular expressions in above
examples,
both the Postfix hash and the amavisd-new hash or lists
handle
cases like the above just fine. See README.lookups.

> What I want to do is stuff this file into
local_domains_maps, so that I can
> get spam headers added. Looking at the code, I see that
the lookup function
> will call lookup_re for isa('Amavis::Lookup::RE'), but
not being a perl
> person, I have no idea how to create such a beast.
>
> I see functions for read_hash and read_array... A
read_regexp function that
> would take the above file and stuff it into
local_domains_maps would be
> just what I'm looking for...

There are several examples of regexp use in
amavisd.conf-sample.

local_domains_maps = (
  new_RE(
    qr'[.]example.com$'i,
    qr'mx.customers-d+.example.com$'i,
    qr'sub.[^]*.example.org$'i,
  ),
);

> but other suggestions (_besides_ "don't use 
> wildcards") would be greatly appreciated!

Don't use wildcards  

  Mark

------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
AMaViS-userlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user

AMaViS-FAQ:http://www.amav
is.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/ho
wto/

Re: getting regular expressions into local_domains_maps?
country flaguser name
United States
2007-05-22 12:13:43
On Mon, 21 May 2007 21:31:30 +0200 Mark wrote:
MM> rsamavis.spam.futz.org,
MM> 
MM> > I'm trying to use amavis + postfix with virtual
users, with an extra twist:
MM> > a wildcard virtual domain. This is configured in
postfix with a regexp
MM> > file:

MM> There is no need for using regular expressions in
above examples,
MM> both the Postfix hash and the amavisd-new hash or
lists handle
MM> cases like the above just fine. See README.lookups.

I would love to use a hash file with postfix, so I could use
read_hash for
local_domains_maps. But I tried

  virtual_mailbox_domains =
hash:/etc/postfix/vhosts/domains.hash 

with the hash file:

  .customer3.org                 virtual:
  customer3.org                  virtual:

After postmap of the file and a postfix reload, sending a
test message to
testtest.customer3.org is rejected:

454 4.7.1 <testtest.customer3.org>: Relay access
denied; from=<rsexample.com> to=<testtest.cstomer3.org> proto=ESMTP
helo=<example.com>


MM> You should anchor regular expressions as
appropriate!

Thanks, fixed.

MM> There are several examples of regexp use in
amavisd.conf-sample.

Yes, and all are hardcoded. I'm hoping to avoid having to
configure virtual
domains in multiple places.

MM> > but other suggestions (_besides_ "don't use

MM> > wildcards") would be greatly appreciated!
MM> 
MM> Don't use wildcards  

Well, at least the rest of your message was helpful. 

------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
AMaViS-userlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user

AMaViS-FAQ:http://www.amav
is.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/ho
wto/

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )