From: Vsevolod Stakhov Date: Tue, 22 Feb 2011 12:55:44 +0000 (+0300) Subject: Rules update. X-Git-Tag: 0.3.7~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5492467747da01e72fe8b9e80ebee28121c68dc6;p=rspamd.git Rules update. Submitted by: Victor Ustugov --- diff --git a/conf/lua/regexp/headers.lua b/conf/lua/regexp/headers.lua index 69b239d85..cad6eca6b 100644 --- a/conf/lua/regexp/headers.lua +++ b/conf/lua/regexp/headers.lua @@ -208,23 +208,23 @@ reconf['FORGED_MUA_THEBAT_MSGID_UNKNOWN'] = string.format('(%s) & !(%s) & !(%s) local kmail_mua = 'User-Agent=/^\\s*KMail\\/1\\.\\d+\\.\\d+/H' -- KMail common Message-ID template local kmail_msgid_common = 'Message-Id=/^\\s*\\d+\\.\\d+\\.\\S+\\@\\S+$/mH' --- local kmail_msgid = function (task) --- rspamd_logger.info("test kmail_msgid") --- local msg = task:get_message() --- local regexp_text = '<(\\S+)>\\|<(19[789]\\d|20\\d\\d)(0\\d|1[012])([012]\\d|3[01])([0-5]\\d)([0-5]\\d)\\.\\d+\\.\\1>$' --- local re = regexp.get_cached(regexp_text) --- if not re then re = regexp.create(regexp_text, '') end --- local header_msgid = msg:get_header('Message-Id') --- for _,header_from in ipairs(msg:get_header('From')) do --- if re:match(header_from.."|"..header_msgid) then --- return true --- end --- end --- return false --- end -local kmail_msgid = 'Message-Id=/^(19[789]\\d|20\\d\\d)(0\\d|1[012])([012]\\d|3[01])([0-5]\\d)([0-5]\\d)\\.\\d+\\.\\S+\\@\\S+$/mH' +function kmail_msgid (task) + local msg = task:get_message() + local regexp_text = '<(\\S+)>\\|(19[789]\\d|20\\d\\d)(0\\d|1[012])([012]\\d|3[01])([0-5]\\d)([0-5]\\d)\\.\\d+\\.\\1$' + local re = regexp.get_cached(regexp_text) + if not re then re = regexp.create(regexp_text, '') end + local header_msgid = msg:get_header('Message-Id') + if header_msgid then + for _,header_from in ipairs(msg:get_header('From')) do + if re:match(header_from.."|"..header_msgid[1]) then + return true + end + end + end + return false +end -- Summary rule for forged KMail Message-ID header -reconf['FORGED_MUA_KMAIL_MSGID'] = string.format('(%s) & (%s) & !(%s) & !(%s)', kmail_mua, kmail_msgid_common, kmail_msgid, unusable_msgid) +reconf['FORGED_MUA_KMAIL_MSGID'] = string.format('(%s) & (%s) & !(%s) & !(%s)', kmail_mua, kmail_msgid_common, 'kmail_msgid', unusable_msgid) -- Summary rule for forged KMail Message-ID header with unknown template reconf['FORGED_MUA_KMAIL_MSGID_UNKNOWN'] = string.format('(%s) & !(%s) & !(%s)', kmail_mua, kmail_msgid_common, unusable_msgid) diff --git a/rspamd.xml.sample b/rspamd.xml.sample index 610e60b8c..1048da2ca 100644 --- a/rspamd.xml.sample +++ b/rspamd.xml.sample @@ -85,7 +85,7 @@ FORGED_MUA_THEBAT_MSGID_UNKNOWN - FORGED_MUA_KMIL_MSGID + FORGED_MUA_KMAIL_MSGID FORGED_MUA_KMAIL_MSGID_UNKNOWN