Parcourir la source

[Rules] Blank spam detection

tags/3.7.2
Andrew Lewis il y a 7 mois
Parent
révision
c17ffcd4e5
5 fichiers modifiés avec 43 ajouts et 4 suppressions
  1. 6
    0
      conf/composites.conf
  2. 16
    4
      rules/headers_checks.lua
  3. 9
    0
      rules/misc.lua
  4. 11
    0
      rules/parts.lua
  5. 1
    0
      rules/rspamd.lua

+ 6
- 0
conf/composites.conf Voir le fichier



composites { composites {


SHORT_PART_BAD_HEADERS {
expression = "MISSING_ESSENTIAL_HEADERS & SINGLE_SHORT_PART";
group = "blankspam";
policy = "leave";
score = 7.0;
}
FORGED_RECIPIENTS_MAILLIST { FORGED_RECIPIENTS_MAILLIST {
expression = "FORGED_RECIPIENTS & -MAILLIST"; expression = "FORGED_RECIPIENTS & -MAILLIST";
} }

+ 16
- 4
rules/headers_checks.lua Voir le fichier

['Subject'] = 0.7 ['Subject'] = 0.7
} }


rspamd_config.MULTIPLE_UNIQUE_HEADERS = {
local multiple_unique_headers_id = rspamd_config:register_symbol {
name = 'MULTIPLE_UNIQUE_HEADERS',
callback = function(task) callback = function(task)
local res = 0 local res = 0
local max_mult = 0.0 local max_mult = 0.0
local res_tbl = {} local res_tbl = {}
local found = 0


for hdr, mult in pairs(headers_unique) do for hdr, mult in pairs(headers_unique) do
local hc = task:get_header_count(hdr) local hc = task:get_header_count(hdr)
found = found + hc


if hc > 1 then if hc > 1 then
res = res + 1 res = res + 1
end end


if res > 0 then if res > 0 then
return true, max_mult, table.concat(res_tbl, ',')
task:insert_result('MULTIPLE_UNIQUE_HEADERS', max_mult, table.concat(res_tbl, ','))
elseif found == 0 then
task:insert_result('MISSING_ESSENTIAL_HEADERS', 1.0)
end end

return false
end, end,


score = 7.0, score = 7.0,
description = 'Repeated unique headers' description = 'Repeated unique headers'
} }


rspamd_config:register_symbol {
name = 'MISSING_ESSENTIAL_HEADERS',
score = 7.0,
group = 'blankspam',
parent = multiple_unique_headers_id,
type = 'virtual',
description = 'Common headers were entirely absent',
}

rspamd_config.MISSING_FROM = { rspamd_config.MISSING_FROM = {
callback = function(task) callback = function(task)
local from = task:get_header('From') local from = task:get_header('From')

+ 9
- 0
rules/misc.lua Voir le fichier

score = -2.0, score = -2.0,
one_shot = true one_shot = true
} }

rspamd_config.COMPLETELY_EMPTY = {
callback = function(task)
return (task:get_size() == 0)
end,
flags = 'empty',
group = 'blankspam',
score = 15
}

+ 11
- 0
rules/parts.lua Voir le fichier

rspamd_config.SINGLE_SHORT_PART = {
callback = function(task)
local parts = task:get_parts()
if #parts ~= 1 then return end
local text = parts[1]:get_text()
if not text then return end
if text:get_length() >= 64 then return end
return true
end,
score = 0.0,
}

+ 1
- 0
rules/rspamd.lua Voir le fichier

dofile(local_rules .. '/misc.lua') dofile(local_rules .. '/misc.lua')
dofile(local_rules .. '/forwarding.lua') dofile(local_rules .. '/forwarding.lua')
dofile(local_rules .. '/mid.lua') dofile(local_rules .. '/mid.lua')
dofile(local_rules .. '/parts.lua')
dofile(local_rules .. '/bitcoin.lua') dofile(local_rules .. '/bitcoin.lua')
dofile(local_rules .. '/bounce.lua') dofile(local_rules .. '/bounce.lua')
dofile(local_rules .. '/content.lua') dofile(local_rules .. '/content.lua')

Chargement…
Annuler
Enregistrer