From: Alexey Date: Tue, 24 Dec 2013 14:59:05 +0000 (-0800) Subject: Add rule for HELO host FQDN check X-Git-Tag: 0.6.6~20^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F14%2Fhead;p=thirdparty%2Frspamd.git Add rule for HELO host FQDN check --- diff --git a/conf/lua/rspamd.lua b/conf/lua/rspamd.lua index 822f6447fe..16b99cb01e 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}(?