]> source.dussan.org Git - rspamd.git/commitdiff
Add rule for HELO host FQDN check 14/head
authorAlexey <AlexeySa@users.noreply.github.com>
Tue, 24 Dec 2013 14:59:05 +0000 (06:59 -0800)
committerAlexey <AlexeySa@users.noreply.github.com>
Tue, 24 Dec 2013 14:59:05 +0000 (06:59 -0800)
conf/lua/rspamd.lua

index 822f6447fe617fe2d76c2932c551ce7a95ef3428..16b99cb01e50e32c40a05bb4511b0490ae4d2675 100644 (file)
@@ -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)