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)
<symbol weight="3.00" description="Message pretends to be send from The Bat! but has forged Message-ID">FORGED_MUA_THEBAT_MSGID_UNKNOWN</symbol>
<!-- Message pretends to be send from KMail but has forged Message-ID -->
- <symbol weight="3.00" description="Message pretends to be send from KMail but has forged Message-ID">FORGED_MUA_KMIL_MSGID</symbol>
+ <symbol weight="3.00" description="Message pretends to be send from KMail but has forged Message-ID">FORGED_MUA_KMAIL_MSGID</symbol>
<!-- Message pretends to be send from KMail but has forged Message-ID -->
<symbol weight="2.50" description="Message pretends to be send from KMail but has forged Message-ID">FORGED_MUA_KMAIL_MSGID_UNKNOWN</symbol>