aboutsummaryrefslogtreecommitdiffstats
path: root/conf
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-03 18:45:24 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-03 18:45:24 +0100
commitb5e51581d44b11f6362a23ad4c419e9027e71fe4 (patch)
tree5c1aecb6fe6881aa6560b55c80533dee186e1975 /conf
parent111ccfd146c2199e9adca143e2f2fa7836c90f36 (diff)
downloadrspamd-b5e51581d44b11f6362a23ad4c419e9027e71fe4.tar.gz
rspamd-b5e51581d44b11f6362a23ad4c419e9027e71fe4.zip
Fix configuration.
Diffstat (limited to 'conf')
-rw-r--r--conf/lua/hfilter.lua3
-rw-r--r--conf/lua/regexp/headers.lua28
-rw-r--r--conf/lua/rspamd.classifiers.lua20
3 files changed, 22 insertions, 29 deletions
diff --git a/conf/lua/hfilter.lua b/conf/lua/hfilter.lua
index ef0c9cb22..a07c2db19 100644
--- a/conf/lua/hfilter.lua
+++ b/conf/lua/hfilter.lua
@@ -174,9 +174,6 @@ local function hfilter(task)
--HELO--
local helo = task:get_helo()
- --MESSAGE--
- local message = task:get_message()
-
--RULES--RULES--RULES--
-- Check's HELO
diff --git a/conf/lua/regexp/headers.lua b/conf/lua/regexp/headers.lua
index a8fb17906..e2b547e6d 100644
--- a/conf/lua/regexp/headers.lua
+++ b/conf/lua/regexp/headers.lua
@@ -227,16 +227,12 @@ 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'
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 = rspamd_regexp.create_cached(regexp_text)
- local header_msgid = msg:get_header('Message-Id')
+ local header_msgid = task: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
+ local header_from = task:get_header('From')
+ if re:match(header_from.."|"..header_msgid) then return true end
end
return false
end
@@ -371,7 +367,7 @@ local yandex_received = 'Received=/^\\s*from \\S+\\.(yandex\\.ru|yandex\\.net)/m
local yandex = string.format('(%s) & ((%s) | (%s) | (%s))', yandex_received, yandex_from, yandex_x_envelope_from, yandex_return_path)
-- Tabs as delimiters between header names and header values
function check_header_delimiter_tab(task, header_name)
- for _,rh in ipairs(task:get_raw_header(header_name)) do
+ for _,rh in ipairs(task:get_header_full(header_name)) do
if rh['tab_separated'] then return true end
end
return false
@@ -383,7 +379,7 @@ reconf['HEADER_REPLYTO_DELIMITER_TAB'] = string.format('(%s) & !(%s)', 'check_he
reconf['HEADER_DATE_DELIMITER_TAB'] = string.format('(%s) & !(%s)', 'check_header_delimiter_tab(Date)', yandex)
-- Empty delimiters between header names and header values
function check_header_delimiter_empty(task, header_name)
- for _,rh in ipairs(task:get_raw_header(header_name)) do
+ for _,rh in ipairs(task:get_header_full(header_name)) do
if rh['empty_separator'] then return true end
end
return false
@@ -435,7 +431,7 @@ reconf['FORGED_GENERIC_RECEIVED4'] = 'Received=/^\\s*(.+\\n)*from localhost by \
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 = rspamd_regexp.create_cached(regexp_text, 'i')
- local headers_recv = task:get_raw_header('Received')
+ local headers_recv = task:get_header_full('Received')
if headers_recv then
for _,header_r in ipairs(headers_recv) do
if re:match(header_r['value']) then
@@ -450,15 +446,15 @@ reconf['INVALID_POSTFIX_RECEIVED'] = 'Received=/ \\(Postfix\\) with ESMTP id [A-
rspamd_config.INVALID_EXIM_RECEIVED = function (task)
local checked = 0
- local headers_to = task:get_message():get_header('To')
+ local headers_to = task:get_header_full('To')
if headers_to then
- local headers_recv = task:get_raw_header('Received')
+ local headers_recv = task:get_header_full('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 = rspamd_regexp.create_cached(regexp_text, 's')
if headers_recv then
for _,header_to in ipairs(headers_to) do
for _,header_r in ipairs(headers_recv) do
- if re:match(header_to.."|"..header_r['value']) then
+ if re:match(header_to['value'].."|"..header_r['value']) then
return true
end
end
@@ -475,15 +471,15 @@ end
rspamd_config.INVALID_EXIM_RECEIVED2 = function (task)
local checked = 0
- local headers_to = task:get_message():get_header('To')
+ local headers_to = task:get_header_full('To')
if headers_to then
- local headers_recv = task:get_raw_header('Received')
+ local headers_recv = task:get_header_full('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 = rspamd_regexp.create_cached(regexp_text, 's')
if headers_recv then
for _,header_to in ipairs(headers_to) do
for _,header_r in ipairs(headers_recv) do
- if re:match(header_to.."|"..header_r['value']) then
+ if re:match(header_to['value'].."|"..header_r['value']) then
return true
end
end
diff --git a/conf/lua/rspamd.classifiers.lua b/conf/lua/rspamd.classifiers.lua
index d73d08178..4820dd77a 100644
--- a/conf/lua/rspamd.classifiers.lua
+++ b/conf/lua/rspamd.classifiers.lua
@@ -31,26 +31,26 @@ local function get_specific_statfiles(classifier, task)
-- Maillist
local st_maillist = classifier:get_statfile_by_label(list_label)
if st_maillist then
- local unsub_header = task:get_raw_header('List-Unsubscribe')
- if unsub_header and unsub_header[1] then
+ local unsub_header = task:get_header_raw('List-Unsubscribe')
+ if unsub_header then
table.foreach(st_maillist, function(i,v) table.insert(spec_st,v) end)
end
end
-- Long subject
local st_longsubj = classifier:get_statfile_by_label(long_subject_label)
if st_longsubj then
- local subj = task:get_raw_header('Subject')
- if subj and subj[1] and string.len(subj[1]['value']) > 150 then
+ local subj = task:get_header_raw('Subject')
+ if subj and string.len(subj['value']) > 150 then
table.foreach(st_longsubj, function(i,v) table.insert(spec_st,v) end)
end
end
-- Reply-To != To
local st_replyto = classifier:get_statfile_by_label(different_reply_to_label)
if st_replyto then
- local to = task:get_raw_header('To')
- local reply_to = task:get_raw_header('Reply-To')
- if to and to[1] and reply_to and reply_to[1] then
- if string.lower(to[1]['value']) ~= string.lower(reply_to[1]['value']) then
+ local to = task:get_header_raw('To')
+ local reply_to = task:get_header_raw('Reply-To')
+ if to and reply_to then
+ if string.lower(to['value']) ~= string.lower(reply_to['value']) then
table.foreach(st_replyto, function(i,v) table.insert(spec_st,v) end)
end
end
@@ -58,8 +58,8 @@ local function get_specific_statfiles(classifier, task)
-- Has In-Reply-To header
local st_reply = classifier:get_statfile_by_label(has_in_reply_label)
if st_reply then
- local inrep_header = task:get_raw_header('In-Reply-To')
- if inrep_header and inrep_header[1] then
+ local inrep_header = task:get_header_raw('In-Reply-To')
+ if inrep_header then
table.foreach(st_reply, function(i,v) table.insert(spec_st,v) end)
end
end