[exim] conditional greylisting according to users wishes

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Mark J Elkins
Dátum:  
Címzett: exim-users
Tárgy: [exim] conditional greylisting according to users wishes
I'm running Exim version 4.67 on a Linux (Gentoo) box.
My users are in a Mysql Database.
I'm happily running the "built-in" greylisting based on SQL - ie...

Greylisting Definitions are:
# are they in the database already ?
GREYLIST_TEST = SELECT CASE \
WHEN now() - block_expires > 0 THEN 2 \
ELSE 1 \
END \
FROM greylist \
WHERE relay_ip = '${quote_mysql:$sender_host_address}' \
AND sender = '${quote_mysql:$sender_address}' \
AND recipient = '${quote_mysql:$local_part@$domain}'

# add them in, with 10 minute block
GREYLIST_ADD = INSERT INTO greylist (relay_ip, sender, recipient,
block_expires) \
VALUES ( '${quote_mysql:$sender_host_address}', \
'${quote_mysql:$sender_address}', \
'${quote_mysql:$local_part@$domain}', \
DATE_ADD(now(), INTERVAL 10 MINUTE) \
)

# keep the entry fresh.
GREYLIST_UPDATE = UPDATE greylist SET \
  block_expires = DATE_SUB(now(), INTERVAL 5 MINUTE) \
  WHERE relay_ip = '${quote_mysql:$sender_host_address}' \
    AND sender = '${quote_mysql:$sender_address}' \
    AND recipient = '${quote_mysql:$local_part@$domain}'


-----------
And:
# set a variable marking whether they were in the database
warn set acl_m2 = ${lookup mysql{GREYLIST_TEST}{$value}{0}}

# new entry in database - defer, and add them
# Disable Greylisting
  # warn message = Greylisted - please try again a little later.
# Enable Greylisting
  defer message = Greylisted - please try again in 15 minutes.
      condition = ${if eq{$acl_m2}{0}{1}}
      condition = ${lookup mysql{GREYLIST_ADD}{yes}{no}}


# they are listed, but it is still too early
# Disable Greylisting
  # warn message = Greylisted - please try again shortly.
# Enable Greylisting
  defer message = Still Greylisted - please wait a full 15 minutes 
before retrying.
      condition = ${if eq{$acl_m2}{1}{1}}


# freshen entry
warn condition = ${lookup mysql{GREYLIST_UPDATE}{yes}{no}}


---------------
I have requests from some user to *not* do Greylisting. I've added a
field 'dogrey' which can have a 'Y' or 'N' value which is under user
control. The idea is if the user wants Greylisting switched off - they
change this from the Default of 'Y' to 'N'.

What I'd ideally like is to still populate the greylisting table
regardless of the users settings - but also honour the users wish if
they don't want their e-mail delayed by greylisting.

I'm looking for "Net Wisdom" as to the best way to do this.

-- 
  .  .     ___. .__      Posix Systems - Sth Africa
 /| /|       / /__       mje@???  -  Mark J Elkins, SCO ACE, Cisco CCIE
/ |/ |ARK \_/ /__ LKINS  Tel: +27 12 807 0590  Cell: +27 82 601 0496