diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-04-25 19:34:38 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-04-25 19:34:38 +0400 |
commit | 1bda9f428a2e4a026641293ef8f90dee71d0adf6 (patch) | |
tree | 75bdd5c0635c290042da5644399fe6498b0d25d2 | |
parent | cca977866939436fa886e49859031631d1de0a22 (diff) | |
download | rspamd-1bda9f428a2e4a026641293ef8f90dee71d0adf6.tar.gz rspamd-1bda9f428a2e4a026641293ef8f90dee71d0adf6.zip |
* Add rules for message's date
-rw-r--r-- | conf/lua/rspamd.lua | 28 | ||||
-rw-r--r-- | rspamd.xml.sample | 4 |
2 files changed, 32 insertions, 0 deletions
diff --git a/conf/lua/rspamd.lua b/conf/lua/rspamd.lua index e85a971d3..203862776 100644 --- a/conf/lua/rspamd.lua +++ b/conf/lua/rspamd.lua @@ -40,6 +40,34 @@ reconf['R_EMPTY_IMAGE'] = function (task) return false end +-- Date issues +reconf['DATE_IN_FUTURE'] = function(task) + if rspamd_config:get_api_version() >= 5 then + local m = task:get_message() + local dm = m:get_date() + local dt = task:get_date() + -- An hour + if dm - dt > 3600 then + return true + end + end + + return false +end +reconf['DATE_IN_PAST'] = function(task) + if rspamd_config:get_api_version() >= 5 then + local m = task:get_message() + local dm = m:get_date() + local dt = task:get_date() + -- A day + if dt - dm > 86400 then + return true + end + end + + return false +end + local function file_exists(filename) local file = io.open(filename) diff --git a/rspamd.xml.sample b/rspamd.xml.sample index 52e497926..1fadb1229 100644 --- a/rspamd.xml.sample +++ b/rspamd.xml.sample @@ -282,6 +282,10 @@ <symbol weight="3.0" description="Invalid Postfix Received">INVALID_POSTFIX_RECEIVED</symbol> <symbol weight="5.0" description="Invalid Exim Received">INVALID_EXIM_RECEIVED</symbol> <symbol weight="3.0" description="Invalid Exim Received">INVALID_EXIM_RECEIVED2</symbol> + + <!-- Date checks --> + <symbol weight="1.5" description="Message date is in future">DATE_IN_FUTURE</symbol> + <symbol weight="1.0" description="Message date is in past">DATE_IN_PAST</symbol> </metric> <!-- End of metrics section --> |