Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: users

Postfix regex map to Exim ACL

 

 

exim users RSS feed   Index | Next | Previous | View Threaded


stesasso at gmail

Jun 7, 2010, 2:33 AM

Post #1 of 3 (451 views)
Permalink
Postfix regex map to Exim ACL

Hi *,
is there a quick way to convert a postfix regex/pcre map for use with
an exim acl?

I have some regex files like this:
(header_checks)
/^X-Mailer: .*EVAMAIL/ REJECT Sorry, your mailer was identified as
mass mailer program.
...
/^X-Mailer: .*Avalanche/ REJECT Sorry, your mailer was identified
as mass mailer program.
...
/^Date: .* 19[0-9][0-9]/ REJECT Past Date
/^From: <>/ REJECT You need to specify a return address,
otherwise we will not accept your email.

(host_blacklist)
/[Dd]ynamic/ REJECT
/[Dd][Hh][Cc][Pp]/ REJECT
/\.dsl\.brasiltelecom\.net\.br$/ REJECT
...


The only idea I had is to use the embedded perl interpreter (condition
= perl{xxxxx}{yyyy}) and a subroutine that loads the "map file" and
checks the parameter with =~/<file_loaded_expression>/.


any other hint?
thanks,
bye

--
Stefano Sasso
http://stefano.dscnet.org/

--
## List details at http://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


dwmw2 at infradead

Jun 7, 2010, 4:39 AM

Post #2 of 3 (425 views)
Permalink
Re: Postfix regex map to Exim ACL [In reply to]

On Mon, 2010-06-07 at 11:33 +0200, Stefano Sasso wrote:
> Hi *,
> is there a quick way to convert a postfix regex/pcre map for use with
> an exim acl?
>
> I have some regex files like this:
> (header_checks)
> /^X-Mailer: .*EVAMAIL/ REJECT Sorry, your mailer was identified as
> mass mailer program.
> ...
> /^X-Mailer: .*Avalanche/ REJECT Sorry, your mailer was identified
> as mass mailer program.
> ...
> /^Date: .* 19[0-9][0-9]/ REJECT Past Date
> /^From: <>/ REJECT You need to specify a return address,
> otherwise we will not accept your email.
>
> (host_blacklist)
> /[Dd]ynamic/ REJECT
> /[Dd][Hh][Cc][Pp]/ REJECT
> /\.dsl\.brasiltelecom\.net\.br$/ REJECT
> ...
>
>
> The only idea I had is to use the embedded perl interpreter (condition
> = perl{xxxxx}{yyyy}) and a subroutine that loads the "map file" and
> checks the parameter with =~/<file_loaded_expression>/.

Do you really have to load the file more than once, or would it be
sufficient just to convert it to Exim ACL as a one-off and then maintain
it in that form?

Even if it really does have to be maintained in the original form, it
shouldn't be particularly hard to do an automated transform into Exim
ACL language...

s%^/^\(.*\): \(.*\)/[[:space:]]*REJECT \(.*\)\$%reject condition = ${if
match {{$h_\1} {\2}} {1}}\n message = \3%

s%^/\(.*\)/[[:space:]]*REJECT \(.*\)\$%reject condition = ${if match
{{$message_headers}{\1}} {1}}\n message = \2%

I typed that into my mailer without testing it at all, but you get the
idea.

Mildly confused by the 'From: <>' one -- do you really see messages with
an empty From: header? You _will_ see messages with an empty SMTP
reverse-path, of course, and it would be stupidly broken to reject
those.

--
David Woodhouse Open Source Technology Centre
David.Woodhouse [at] intel Intel Corporation


--
## List details at http://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


exim-users-20081202 at djce

Jun 7, 2010, 5:37 AM

Post #3 of 3 (426 views)
Permalink
Re: Postfix regex map to Exim ACL [In reply to]

On Mon, Jun 07, 2010 at 11:33:14AM +0200, Stefano Sasso wrote:
> Hi *,
> is there a quick way to convert a postfix regex/pcre map for use with
> an exim acl?
>
> I have some regex files like this:
> (header_checks)
> /^X-Mailer: .*EVAMAIL/ REJECT Sorry, your mailer was identified as
> mass mailer program.
> ...
> /^X-Mailer: .*Avalanche/ REJECT Sorry, your mailer was identified
> as mass mailer program.
> ...
> /^Date: .* 19[0-9][0-9]/ REJECT Past Date
> /^From: <>/ REJECT You need to specify a return address,
> otherwise we will not accept your email.
>
> (host_blacklist)
> /[Dd]ynamic/ REJECT
> /[Dd][Hh][Cc][Pp]/ REJECT
> /\.dsl\.brasiltelecom\.net\.br$/ REJECT

A single "nwildlsearch" lookup using $message_headers (against a file
containing the above data more or less as-is) would do it, wouldn't it? Not
sure that it's a /good/ way, but it should be /quick/ I think.

Then again, I didn't get much sleep last night, so I could be waaaay off the
mark today :-)

--
Dave Evans
http://djce.org.uk/
http://djce.org.uk/pgpkey
Attachments: signature.asc (0.19 KB)

exim users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.