diff options
author | Alexey <AlexeySa@users.noreply.github.com> | 2013-12-24 06:59:05 -0800 |
---|---|---|
committer | Alexey <AlexeySa@users.noreply.github.com> | 2013-12-24 06:59:05 -0800 |
commit | 35a4f68f3caeff979c1f7d167a0f8ab8aae33bab (patch) | |
tree | 36ba19bb280cccf5666a28dbe07d1b07ba1f71f4 | |
parent | 3de23ef38c9151c765fea9f368b09d53adfe1e2c (diff) | |
download | rspamd-35a4f68f3caeff979c1f7d167a0f8ab8aae33bab.tar.gz rspamd-35a4f68f3caeff979c1f7d167a0f8ab8aae33bab.zip |
Add rule for HELO host FQDN check
-rw-r--r-- | conf/lua/rspamd.lua | 18 |
1 files changed, 18 insertions, 0 deletions
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}(?<!-)\\.)+[a-zA-Z]{2,63}$)') then + return true + end +end + +return false +end local function file_exists(filename) local file = io.open(filename) |