[Exim] fgrep-style lookups in filter files

Góra strony
Delete this message
Reply to this message
Autor: Andromeda
Data:  
Dla: exim-users
Temat: [Exim] fgrep-style lookups in filter files
Hi everyone,

I've just printed out the entire filter reference, and I am about to
embark on a quest to build an intelligent filtering system. Now, my
question previously was how I could lookup items in files. I've found that
(using the ${lookup...} expansion item). However, now I have a different
question:

fgrep allows me to use the contents of a file as input to look up in
something else, i.e. each item in the file is tested against the input and
a positive is returned if any item is found.

My question is... can I do the same in Exim with the expansion items? I
want to see if a Received header contains any of the "blacklisted" IP
addresses or address ranges that I specify as illustrated below in rough
steps:

1. Test the contents of /usr/local/exim/filter/$localpart-domains against
$h_Received.
2. Based on the response (either it has found the value or it hasn't),
fail the message (or send a custom response), or let it go through.

If this is not possible, is it possible to have exim use the output from
fgrep (either printed or the return value) invoked via the pipe command
and fail the message, or allow me to send a message of my own using the
mail command as illustrated in rough steps below:

1. Launch fgrep with the correct parameters to do the comparisons
2. Test the return value / test the stdout value
3. Based on step 2, invoke mail command to send off a failure notice and
swallow the original, or pass the message on to the next value.

I've been very successful using procmail in the past, but I cannot get
procmail to do $h_to: and $h_from: comparisons, and I would like to stay
within the Exim framework to do my intelligent filtering.

Regards

Andromeda

P.S. Is it possible at all to set one of the variables that are passed to
user filters to contain the Received headers?