[exim] if ... then style ACL?

Top Page
Delete this message
Reply to this message
Author: Stephen Gran
Date:  
To: exim-users
Subject: [exim] if ... then style ACL?
Hello all,

I am presently working on greylisting, and I have it working, but it is
not doing exactly what I would like. I am using this acl fragment:

  warn    set acl_m1 = ${readsocket{/var/run/greylist/exim_sockd.sock}\
                       {GREYLIST ${lc:$sender_address} ${lc:$local_part@$domain} $sender_host_address}{3s}{\n}{0}}
          hosts      = ! +no_check_hosts
          !senders   = :


  defer   domains    = +local_domains : +relay_to_domains
          hosts      = ! +no_check_hosts
          !senders   = :
          condition  = ${if eq {$acl_m1}{0}{0}{1}}
          message    = You have been greylisted. We will accept this mail from you in \
                       ${if >{$acl_m1}{119}{${eval:$acl_m1/60} minutes}{$acl_m1 seconds}}.


Where no_check_hosts is a list of hosts that should be exempted from
greylisting and some other checks (they are trusted hosts on my network,
like my workstation - no need to greylist my own email :)

The problem I am having is that acl_m1 is always run, even for hosts or
senders I don't want it run for. It doesn't end up getting applied, but
it seems inefficient. Is there a way to do something like:

if and ${sender != :} ${hosts != +no_check_hosts} ; then
  warn set acl_m1 = ...
  if eq acl_m1 ...
    defer message = ...


I realize that this is probably not available, but I wanted to see if
someone had come up with any cool tricks that I can't think of, or if
Philip would be willing to wishlist the ability to have conditional
statements like this.

Or maybe, looking back over it, there would be a way to put the
readsocket inside the condition = statement? Not sure how I would
preserve the return output for the message part, though.

TIA,
--
--------------------------------------------------------------------------
|  Stephen Gran                  | Fear is the greatest salesman.   --     |
|  steve@???             | Robert Klein                            |
|  http://www.lobefin.net/~steve |                                         |

--------------------------------------------------------------------------