-- Weight for checks_hellohost and checks_hello: 5 - very hard, 4 - hard, 3 - meduim, 2 - low, 1 - very low.
-- From HFILTER_HELO_* and HFILTER_HOSTNAME_* symbols the maximum weight is selected in case of their actuating.
+
+local rspamd_regexp = require "rspamd_regexp"
local checks_hellohost = {
['[.-]dynamic[.-]'] = 5, ['dynamic[.-][0-9]'] = 5, ['[0-9][.-]?dynamic'] = 5,
['[.-]dyn[.-]'] = 5, ['dyn[.-][0-9]'] = 5, ['[0-9][.-]?dyn'] = 5,
end
local function check_regexp(str, regexp_text)
- local re = regexp.get_cached(regexp_text)
- if not re then re = regexp.create(regexp_text, 'i') end
+ local re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_regexp.create(regexp_text, 'i') end
if re:match(str) then return true end
return false
end
-- Definitions of header regexps
local reconf = config['regexp']
+local rspamd_regexp = require "rspamd_regexp"
-- Subject needs encoding
-- Define encodings types
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 re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_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
rspamd_config.FORGED_GENERIC_RECEIVED5 = function (task)
local regexp_text = '^\\s*from \\[(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\].*\\n(.+\\n)*\\s*from \\1 by \\S+;\\s+\\w{3}, \\d+ \\w{3} 20\\d\\d \\d\\d\\:\\d\\d\\:\\d\\d [+-]\\d\\d\\d0$'
- local re = regexp.get_cached(regexp_text)
- if not re then re = regexp.create(regexp_text, 'i') end
+ local re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_regexp.create(regexp_text, 'i') end
local headers_recv = task:get_raw_header('Received')
if headers_recv then
for _,header_r in ipairs(headers_recv) do
if headers_to then
local headers_recv = task:get_raw_header('Received')
local regexp_text = '^[^\\n]*?<?\\S+?\\@(\\S+)>?\\|.*from \\d+\\.\\d+\\.\\d+\\.\\d+ \\(HELO \\S+\\)[\\s\\r\\n]*by \\1 with esmtp \\(\\S*?[\\?\\@\\(\\)\\s\\.\\+\\*\'\'\\/\\\\,]\\S*\\)[\\s\\r\\n]+id \\S*?[\\)\\(<>\\/\\\\,\\-:=]'
- local re = regexp.get_cached(regexp_text)
- if not re then re = regexp.create(regexp_text, 's') end
+ local re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_regexp.create(regexp_text, 's') end
if headers_recv then
for _,header_to in ipairs(headers_to) do
for _,header_r in ipairs(headers_recv) do
if headers_to then
local headers_recv = task:get_raw_header('Received')
local regexp_text = '^[^\\n]*?<?\\S+?\\@(\\S+)>?\\|.*from \\d+\\.\\d+\\.\\d+\\.\\d+ \\(HELO \\S+\\)[\\s\\r\\n]*by \\1 with esmtp \\([A-Z]{9,12} [A-Z]{5,6}\\)[\\s\\r\\n]+id [a-zA-Z\\d]{6}-[a-zA-Z\\d]{6}-[a-zA-Z\\d]{2}[\\s\\r\\n]+'
- local re = regexp.get_cached(regexp_text)
- if not re then re = regexp.create(regexp_text, 's') end
+ local re = rspamd_regexp.get_cached(regexp_text)
+ if not re then re = rspamd_regexp.create(regexp_text, 's') end
if headers_recv then
for _,header_to in ipairs(headers_to) do
for _,header_r in ipairs(headers_recv) do