summaryrefslogtreecommitdiffstats
path: root/rules/misc.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-26 15:30:23 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-26 15:30:23 +0000
commitb840e3afa41c0e7a53de05e989bc647b08fe842d (patch)
tree07e51cb1e20d764987c08379d4c33b33d0987d19 /rules/misc.lua
parent7e23a61e720b3c26941ccf1542297eb69df98fc8 (diff)
downloadrspamd-b840e3afa41c0e7a53de05e989bc647b08fe842d.tar.gz
rspamd-b840e3afa41c0e7a53de05e989bc647b08fe842d.zip
Add SUBJ_ALL_CAPS rule
Diffstat (limited to 'rules/misc.lua')
-rw-r--r--rules/misc.lua26
1 files changed, 25 insertions, 1 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index f423d014e..256255145 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -27,11 +27,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- This is main lua config file for rspamd
local util = require "rspamd_util"
+local rspamd_regexp = require "rspamd_regexp"
+local rspamd_logger = require "rspamd_logger"
local reconf = config['regexp']
-
-- Uncategorized rules
+local subject_re = rspamd_regexp.create('/^(?:(?:Re|Fwd|Fw|Aw|Antwort|Sv):\\s*)+(.+)$/i')
-- Local rules
local r_bgcolor = '/BGCOLOR=/iP'
@@ -109,3 +111,25 @@ rspamd_config.R_SUSPICIOUS_URL = {
one_shot = true,
description = 'Obfusicated or suspicious URL has been found in a message'
}
+
+rspamd_config.SUBJ_ALL_CAPS = {
+ callback = function(task)
+ local sbj = task:get_header('Subject')
+
+ if sbj then
+ local stripped_subject = subject_re:search(sbj, false, true)
+ if stripped_subject and stripped_subject[1] and stripped_subject[1][2] then
+ sbj = stripped_subject[1][2]
+ end
+
+ if util.is_uppercase(sbj) then
+ return true
+ end
+ end
+
+ return false
+ end,
+ score = 3.0,
+ group = 'headers',
+ description = 'All capital letters in subject'
+}