From 35a4f68f3caeff979c1f7d167a0f8ab8aae33bab Mon Sep 17 00:00:00 2001 From: Alexey Date: Tue, 24 Dec 2013 06:59:05 -0800 Subject: [PATCH] Add rule for HELO host FQDN check --- conf/lua/rspamd.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/conf/lua/rspamd.lua b/conf/lua/rspamd.lua index 822f6447f..16b99cb01 100644 --- a/conf/lua/rspamd.lua +++ b/conf/lua/rspamd.lua @@ -68,6 +68,24 @@ reconf['DATE_IN_PAST'] = function(task) return false end +reconf['HELO_NOT_FQDN'] = function(task) +local helo = task:get_helo() + +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 + if re:match(str) then return true end + return false +end + +if helo then + if not check_regexp(helo, '(?=^.{4,255}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?