Re: [exim] how to set up RelayCountry

Top Page
Delete this message
Reply to this message
Author: Magnus Holmgren
Date:  
To: exim-users
Subject: Re: [exim] how to set up RelayCountry
On Saturday 17 February 2007 09:28, Michael L Griffin wrote:
> Anyone willing to try break this down into English for the rest of us
> noobs who have no clue what this is or what it does. I would love to use
> it as a learning experience and enrich my knowledge of Exim.


>    warn set acl_m3 = ${if eq{$acl_m3}{}{$h_received:}{$acl_m3}}

Initialise $acl_m3 with all Received: lines.

>         set acl_m2 = ${if match{$acl_m3}{\N^[^\[]+\[([^\]]+)\]\N}{$1}{}}

Look for text inside brackets and set $acl_m2 to that.

>         set acl_m3 = ${sg{$acl_m3}{\N^[^\[]+\[([^\]]+)\](.*)\N}{\$2}}

Remove everything up to and including those brackets and their content.

>    warn condition  = ${if match{$acl_m2}{\N^\d{1,3}(\.\d{1,3}){3}$\N}}

Check that a IPv4 address was found.

>         !condition = ${if match_ip{$acl_m2}{+private_networks}}

Check that it's not a private address.

>         set acl_m5 =
> ${sg{$acl_m2}{\N^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$\N}{\$4.\$3.\$2.

\$
> 1.zz.countries.nerd.dk}}

Reverse the components of the address and append ".zz.countries.nerd.dk",
preparing a DNSBL-style query.

>         set acl_m5 = ${lookup dnsdb{txt=<,$acl_m5}{${uc:$value}}{UNKNOWN}}

Perform the query.

>         set acl_m0 = ${if eq{$acl_m0}{}{$acl_m5}{$acl_m0 $acl_m5}}

Append the result of the query to $acl_m0, building a space-delimited list.

>    warn !condition = ${if eq{$acl_m2}{}}
>         acl        = acl_relay_countries
>    accept

If an address was found, go to top to check for the next address, otherwise
return.

Should we implement tail recursion in Exim? :-)

-- 
Magnus Holmgren        holmgren@???
                       (No Cc of list mail needed, thanks)


"Exim is better at being younger, whereas sendmail is better for
Scrabble (50 point bonus for clearing your rack)" -- Dave Evans