Код: Выделить всё
CREATE TABLE `Greylist` (
`id` bigint(20) NOT NULL auto_increment,
`relay_ip` char(15) default NULL,
`sender` char(64) default NULL,
`recipient` char(64) default NULL,
`block_expires` int(11) NOT NULL default '0',
`record_expires` int(11) NOT NULL default '0',
`create_time` int(10) unsigned NOT NULL default '0',
`pass_count` int(10) unsigned NOT NULL default '0',
`block_count` int(10) unsigned NOT NULL default '0',
`ehlo` char(64) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `relay_ip` (`relay_ip`,`sender`,`recipient`)
);
Код: Выделить всё
hide mysql_servers = "localhost/privet/exim/1234"
GREYLIST_TEST=SELECT concat("id=",id," ts=",(unix_timestamp()-block_expires)) \
from Greylist \
where relay_ip='${quote_mysql:$sender_host_address}' and \
sender='${quote_mysql:$sender_address}' and \
recipient='${quote_mysql:$local_part}@${quote_mysql:$domain}' limit 1
GREYLIST_ADD=INSERT into Greylist (relay_ip,sender,recipient,\
block_expires,record_expires,create_time,block_count,ehlo) \
values \
('${quote_mysql:$sender_host_address}',\
'${quote_mysql:$sender_address}',\
'${quote_mysql:$local_part}@${quote_mysql:$domain}',\
unix_timestamp()+60*15,unix_timestamp()+60*60*24,unix_timestamp(),1,\
'${quote_mysql:$sender_helo_name}')
GREYLIST_UPD1=UPDATE Greylist set pass_count=pass_count+1,\
record_expires=unix_timestamp()+60*60*24 where id=$acl_m2
GREYLIST_UPD2=UPDATE Greylist set block_count=block_count+1 where id=$acl_m2
.
.
.
.
.
.
.
Это я вставил почти в конце ACL
#Eto otnositsya k greylist
#nachalo
# set variables
warn set acl_m1 = ${lookup mysql{GREYLIST_TEST}{$value}{id=-1 ts=0}}
set acl_m2 = ${extract{id}{$acl_m1}{$value}{unknown}}
set acl_m3 = ${extract{ts}{$acl_m1}{$value}{unknown}}
# defer if first attempt
defer hosts = ! +relay_hosts
condition = ${if < {$acl_m2}{0}{yes}{no}}
set acl_m4 = ${lookup mysql{GREYLIST_ADD}{$value}{0}}
# defer if time < block_time
defer hosts = ! +relay_hosts
condition = ${if > {$acl_m2}{0}{yes}{no}}
condition = ${if < {$acl_m3}{0}{yes}{no}}
set acl_m4 = ${lookup mysql{GREYLIST_UPD2}{$value}{0}}
#pass defers if time > block_time and update count
warn hosts = ! +relay_hosts
set acl_m4 = ${lookup mysql{GREYLIST_UPD1}{$value}{0}}
#konec
acl_check_data:
# Deny if the message contains a virus. Before enabling this check, you
# must install a virus scanner and set the av_scanner option above.
#
deny malware = *
message = This message contains a virus ($malware_name)
Exim не матюкается работает....