Re: [Exim] Testing $sender_host_address against hostlist?

Top Page
Delete this message
Reply to this message
Author: Marc MERLIN
Date:  
To: Peter N Lewis, Dave C.
CC: exim-users
Subject: Re: [Exim] Testing $sender_host_address against hostlist?
On Sat, Jun 15, 2002 at 02:52:46PM +0800, Peter N Lewis wrote:
> Hi all,
>
> I've added support for spamassassin and razor into Exim. Very cool!


Are you running razor seprately, or inside spamassassin?
If you aren't, you may want to consider running razor inside SA, and setting
razor_timeout (I added that option recently, so you'll want to be running SA
2.30 or newer)

> However, because the spam check is being performed on my users
> (including me), and razor adds a bit of lag, and it all happens
> before the mail is accepted, it means email sending is slowed down
> somewhat.


This shouldn't need to happen.

> spamassassin's local_scan config has a condition to disable running, namely"
>
> SAEximRunCond: ${if and {{def:sender_host_address} {!eq
> {$sender_host_address}{127.0.0.1}} {!eq {$h_Do-Not_Run-SA:}{Yes}} }
> {1}{0}}


Yep, that's the default.

> So basically, the question then boils down to, how can I write an
> exim condition to test $sender_host_address against a hostlist, which
> in this case will be something like:
>
> hostlist   relay_from_hosts = 127.0.0.1:203.8.112.0/24 \
>     :139.130.147.205:203.47.30.60/30


I think you can do something like this (untested):
and {{def:sender_host_address} {!eq {$sender_host_address}{127.0.0.1}} {!eq
{${mask:$sender_host_address/24}}{203.8.112.0/24}} ... }

You can probably also put the IPs and netmask in a file and do a net-lsearch

Actually, please report back because I'll probably have to do something
similar soon :-)

Marc
--
Microsoft is to operating systems & security ....
                                      .... what McDonalds is to gourmet cooking


Home page: http://marc.merlins.org/ | Finger marc_f@??? for PGP key