Re: [exim] how to set up RelayCountry

Startseite
Nachricht löschen
Nachricht beantworten
Autor: John W. Baxter
Datum:  
To: exim-users
Betreff: Re: [exim] how to set up RelayCountry
On 2/15/07 7:22 AM, "Mike Cardwell" <exim-users@???> wrote:

> If you just want to add the header, you can do it natively in exim:
>
> Stick this in your data acl:
>
> warn set acl_m0 =
>      acl        = acl_relay_countries
>      condition  = ${if ! eq{$acl_m0}{}}
>      message    = X-Relay-Countries: $acl_m0

>
> Create a recursive acl as follows:
>
> acl_relay_countries:
>    warn set acl_m3 = ${if eq{$acl_m3}{}{$h_received:}{$acl_m3}}
>         set acl_m2 = ${if match{$acl_m3}{\N^[^\[]+\[([^\]]+)\]\N}{$1}{}}
>         set acl_m3 = ${sg{$acl_m3}{\N^[^\[]+\[([^\]]+)\](.*)\N}{\$2}}
>    warn condition  = ${if match{$acl_m2}{\N^\d{1,3}(\.\d{1,3}){3}$\N}}
>         !condition = ${if match_ip{$acl_m2}{+private_networks}}
>         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}}
>         set acl_m5 = ${lookup dnsdb{txt=<,$acl_m5}{${uc:$value}}{UNKNOWN}}
>         set acl_m0 = ${if eq{$acl_m0}{}{$acl_m5}{$acl_m0 $acl_m5}}
>    warn !condition = ${if eq{$acl_m2}{}}
>         acl        = acl_relay_countries
>    accept

>
> I only briefly tested the above but it seems to work.
>
> There should be an obfuscated exim configuration contest.


Philip, thou hast builded a monster. ;-)

Mike, be grateful for the \N...\N construct (a relatively recent--compared
with my use of Exim--and most welcome addition).

--John