Re: [exim] Regex Parsing help

Top Page
Delete this message
Reply to this message
Author: Marc Perkel
Date:  
To: Mike Cardwell
CC: exim-users
Subject: Re: [exim] Regex Parsing help


Mike Cardwell wrote:
> Marc Perkel wrote:
>
>
>>>> Thanks - I have what I need for that step in the process.
>>>>
>>>> parse_uri:
>>>>    warn set acl_c_parse_lookup = ${sg{$acl_c_parse_uri}{\N .*\s\N}{}}
>>>>        set acl_c_parse_lookup = ${sg{$acl_c_parse_lookup}{ }{}}
>>>>         set acl_c_parse_uri = ${sg{$acl_c_parse_uri}{\N^.*?\s\N}{}}
>>>>         acl = uribl_lookup
>>>> #    logwrite = PARSE1 - [$acl_c_parse_lookup]
>>>>    warn !condition = ${if eq{$acl_c_parse_uri}{}}
>>>>         acl = parse_uri
>>>>    accept

>>>>
>>>>
>>> There's a recursion limit in Exim. I can't remember what it is. If the
>>> number of domains you're looking up exceeds that limit, the message
>>> delivery will fail. The number is small, you might want to look it up.
>>>
>> Since there seems to be no other way to do what I want I can live with a
>> recursion limit of 20.
>>
>
> I suspect you probably don't need to use a separate acl for uribl_lookup
> if you use a set of if/else conditions and the dnsbl lookup type, but
> without seeing it I can't be sure (don't show me, I can't be bothered to
> convert it for you). If that is the case, you can use forall/forany. But
> considering the low likelihood of anyone other than you actually using
> your recursive acl config, I suppose it wont do too much damage.
>
> Mike
>
>


Hi Mike,

It might be a little complex to convert. Here's what I'm trying to do.


# Returns list of URIs space separated
warn    set acl_c_parse_uri = ${perl{parse_uri}}



warn    condition = ${if def:acl_c_parse_uri}
    acl = parse_uri


accept    condition = ${if def:acl_c_badlink}
    acl = report_uribl
        add_header = X-No-Abuse-Report: yes
        set acl_c_no_duplicate_report = yes
    set acl_c_spamcount = ${eval:$acl_c_spamcount+2}
    set acl_c_spamtext = $acl_c_spamtext URIBL
    acl = reject



parse_uri:
   warn set acl_c_parse_lookup = ${sg{$acl_c_parse_uri}{\N .*\s\N}{}}
       set acl_c_parse_lookup = ${sg{$acl_c_parse_lookup}{ }{}}
        set acl_c_parse_uri = ${sg{$acl_c_parse_uri}{\N^.*?\s\N}{}}
        acl = uribl_lookup
   warn !condition = ${if eq{$acl_c_parse_uri}{}}
        acl = parse_uri
   accept




uribl_lookup:

accept    condition = ${if isip{$acl_c_parse_lookup}}
    set acl_c_link_to_ip = $acl_c_parse_lookup
    set acl_c_spamsave = URIBL - Message links to IP Address 
[$acl_c_parse_lookup] $dnslist_domain/$dnslist_value


warn    set acl_c_rb_query = $acl_c_parse_lookup
    acl = rb_resolve
    set acl_c_parse_lookup = $acl_c_rb_result


accept    !condition = ${if def:acl_c_parse_lookup}
    set acl_c_link_screwed = true
    add_header = X-Link-screwed: $acl_c_rb_query
    logwrite = FAILED2 - $acl_c_rb_query


accept    dnslists = tld.junkemailfilter.com/$acl_c_parse_lookup


warn    set acl_c_report_domain = $acl_c_parse_lookup
    acl = report_domain


warn    dnslists = hostkarma.junkemailfilter.com/$acl_c_parse_lookup
    set acl_c_parse_lookup_result = $dnslist_value


accept    condition = ${if match 
{$acl_c_parse_lookup_result}{127.0.0.[135]}}


accept    condition = ${if match {$acl_c_parse_lookup_result}{127.0.0.2}}
    set acl_c_badlink = $acl_c_parse_lookup
    set acl_c_spamsave = URIBL - Message links to Blacklisted Site 
[$acl_c_parse_lookup] $dnslist_domain/$dnslist_value


accept    dnslists = multi.surbl.org/$acl_c_parse_lookup
    set acl_c_badlink = $acl_c_parse_lookup
    set acl_c_spamsave = URIBL - Message links to Blacklisted Site 
[$acl_c_parse_lookup] $dnslist_domain/$dnslist_value


accept    dnslists = multi.uribl.com=127.0.0.2/$acl_c_parse_lookup
    set acl_c_badlink = $acl_c_parse_lookup
    set acl_c_spamsave = URIBL - Message links to Blacklisted Site 
[$acl_c_parse_lookup] $dnslist_domain/$dnslist_value


accept    condition = ${if match {$acl_c_parse_lookup_result}{127.0.2.3}}


accept    condition = ${if match {$acl_c_parse_lookup_result}{127.0.2.2}}
    set acl_c_unfamiliar_link = $acl_c_parse_lookup
#    logwrite = UNFAM2 - $acl_c_parse_lookup


accept    condition = ${if match {$acl_c_parse_lookup_result}{127.0.2.1}}
    set acl_c_unfamiliar_link = $acl_c_parse_lookup
#    logwrite = UNFAM1 - $acl_c_parse_lookup


accept    !dnslists = hostkarma.junkemailfilter.com/$acl_c_parse_lookup
    set acl_c_unfamiliar_link = $acl_c_parse_lookup
#    logwrite = UNFAM0 - $acl_c_parse_lookup



accept