]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add some mime only rules
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 7 Jan 2019 15:41:23 +0000 (15:41 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 7 Jan 2019 15:41:23 +0000 (15:41 +0000)
rules/headers_checks.lua
rules/mid.lua
rules/misc.lua
rules/subject_checks.lua

index 5dc78063a80beb0f21426c7234a835100c1fcbbd..353690b56a89272b153904dd766a50c43022663c 100644 (file)
@@ -25,7 +25,7 @@ local E = {}
 
 local rcvd_cb_id = rspamd_config:register_symbol{
   name = 'CHECK_RECEIVED',
-  type = 'callback',
+  type = 'callback,mime',
   score = 0.0,
   group = 'headers',
   callback = function(task)
@@ -114,7 +114,7 @@ rspamd_config:register_symbol{
 
 local prio_cb_id = rspamd_config:register_symbol {
   name = 'HAS_X_PRIO',
-  type = 'callback',
+  type = 'callback,mime',
   score = 0.0,
   group = 'headers',
   callback = function (task)
@@ -185,7 +185,7 @@ local function get_raw_header(task, name)
 end
 
 local check_replyto_id = rspamd_config:register_symbol({
-  type = 'callback',
+  type = 'callback,mime',
   name = 'CHECK_REPLYTO',
   score = 0.0,
   group = 'headers',
@@ -333,7 +333,7 @@ rspamd_config:register_dependency('CHECK_REPLYTO', 'CHECK_FROM')
 
 local check_mime_id = rspamd_config:register_symbol{
   name = 'CHECK_MIME',
-  type = 'callback',
+  type = 'callback,mime',
   group = 'headers',
   score = 0.0,
   callback = function(task)
@@ -575,6 +575,7 @@ rspamd_config.MISSING_FROM = {
     return false
   end,
   score = 2.0,
+  type = 'mime',
   group = 'headers',
   description = 'Missing From: header'
 }
@@ -596,6 +597,7 @@ rspamd_config.MULTIPLE_FROM = {
   end,
   score = 9.0,
   group = 'headers',
+  type = 'mime',
   description = 'Multiple addresses in From'
 }
 
@@ -607,6 +609,7 @@ rspamd_config.MV_CASE = {
   description = 'Mime-Version .vs. MIME-Version',
   score = 0.5,
   group = 'headers',
+  type = 'mime',
 }
 
 rspamd_config.FAKE_REPLY = {
@@ -621,12 +624,13 @@ rspamd_config.FAKE_REPLY = {
   end,
   description = 'Fake reply',
   score = 1.0,
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 local check_from_id = rspamd_config:register_symbol{
   name = 'CHECK_FROM',
-  type = 'callback',
+  type = 'callback,mime',
   score = 0.0,
   group = 'headers',
   callback = function(task)
@@ -753,7 +757,7 @@ local check_to_cc_id = rspamd_config:register_symbol{
   name = 'CHECK_TO_CC',
   type = 'callback',
   score = 0.0,
-  group = 'headers',
+  group = 'headers,mime',
   callback = function(task)
     local rcpts = task:get_recipients(1)
     local to = task:get_recipients(2)
@@ -976,6 +980,7 @@ rspamd_config.CTYPE_MISSING_DISPOSITION = {
   end,
   description = 'Binary content-type not specified as an attachment',
   score = 4.0,
+  type = 'mime',
   group = 'headers'
 }
 
@@ -1004,6 +1009,7 @@ rspamd_config.CTYPE_MIXED_BOGUS = {
   end,
   description = 'multipart/mixed without non-textual part',
   score = 1.0,
+  type = 'mime',
   group = 'headers'
 }
 
@@ -1040,7 +1046,8 @@ rspamd_config.MIME_BASE64_TEXT = {
   end,
   description = 'Has text part encoded in base64',
   score = 0.1,
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 local function is_8bit_addr(addr)
@@ -1061,7 +1068,8 @@ rspamd_config.INVALID_FROM_8BIT = {
   end,
   description = 'Invalid 8bit character in From header',
   score = 6.0,
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 rspamd_config.INVALID_RCPT_8BIT = {
@@ -1076,7 +1084,8 @@ rspamd_config.INVALID_RCPT_8BIT = {
   end,
   description = 'Invalid 8bit character in recipients headers',
   score = 6.0,
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 rspamd_config.XM_CASE = {
@@ -1087,4 +1096,5 @@ rspamd_config.XM_CASE = {
   description = 'X-mailer .vs. X-Mailer',
   score = 0.5,
   group = 'headers',
+  type = 'mime',
 }
index b04a8bb46e9c01fc44fdd7e43ce4d186b20687eb..b74ff13df3f4255531b921719a3746bb78ad12c4 100644 (file)
@@ -71,7 +71,7 @@ local check_mid_id = rspamd_config:register_symbol({
   name = 'CHECK_MID',
   score = 0.0,
   group = 'mid',
-  type = 'callback',
+  type = 'callback,mime',
   callback = mid_check_func
 })
 rspamd_config:register_virtual_symbol('MID_BARE_IP', 1.0, check_mid_id)
index 3494d26cab609bf1a27d8ac5a41175aa746fffb7..f6d1c81b95e8a868179a2a915ffb76469275c571 100644 (file)
@@ -65,7 +65,8 @@ rspamd_config.MISSING_DATE = {
   end,
   score = 1.0,
   description = 'Message date is missing',
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 rspamd_config.DATE_IN_FUTURE = {
@@ -80,7 +81,8 @@ rspamd_config.DATE_IN_FUTURE = {
   end,
   score = 4.0,
   description = 'Message date is in future',
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 rspamd_config.DATE_IN_PAST = {
@@ -95,7 +97,8 @@ rspamd_config.DATE_IN_PAST = {
   end,
   score = 1.0,
   description = 'Message date is in past',
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 rspamd_config.R_SUSPICIOUS_URL = {
@@ -157,7 +160,8 @@ rspamd_config.ENVFROM_PRVS = {
   end,
   score = 0.0,
   description = "Envelope From is a PRVS address that matches the From address",
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 rspamd_config.ENVFROM_VERP = {
@@ -185,7 +189,8 @@ rspamd_config.ENVFROM_VERP = {
   end,
   score = 0.0,
   description = "Envelope From is a VERP address",
-  group = "headers"
+  group = "headers",
+  type = 'mime',
 }
 
 local check_rcvd = rspamd_config:register_symbol{
@@ -224,7 +229,8 @@ local check_rcvd = rspamd_config:register_symbol{
     if auth then
       task:insert_result('RCVD_VIA_SMTP_AUTH', 1.0)
     end
-  end
+  end,
+  type = 'callback,mime',
 }
 
 rspamd_config:register_symbol{
@@ -282,6 +288,7 @@ rspamd_config.RCVD_HELO_USER = {
   end,
   description = 'HELO User spam pattern',
   group = 'headers',
+  type = 'mime',
   score = 3.0
 }
 
@@ -415,6 +422,7 @@ rspamd_config.URL_IN_SUBJECT = {
   end,
   score = 4.0,
   group = 'subject',
+  type = 'mime',
   description = 'URL found in Subject'
 
 }
@@ -486,7 +494,7 @@ rspamd_config:register_symbol{
 }
 
 local check_from_display_name = rspamd_config:register_symbol{
-  type = 'callback',
+  type = 'callback,mime',
   name = 'FROM_DISPLAY_CALLBACK',
   callback = function (task)
     local from = task:get_from(2)
@@ -582,6 +590,7 @@ rspamd_config.SPOOF_REPLYTO = {
     return false
   end,
   group = 'headers',
+  type = 'mime',
   description = 'Reply-To is being used to spoof and trick the recipient to send an off-domain reply',
   score = 6.0
 }
@@ -607,7 +616,8 @@ rspamd_config.INFO_TO_INFO_LU = {
   end,
   description = 'info@ From/To address with List-Unsubscribe headers',
   group = 'headers',
-  score = 2.0
+  score = 2.0,
+  type = 'mime',
 }
 
 -- Detects bad content-transfer-encoding for text parts
@@ -639,7 +649,8 @@ rspamd_config.R_BAD_CTE_7BIT = {
   end,
   score = 3.5,
   description = 'Detects bad content-transfer-encoding for text parts',
-  group = 'headers'
+  group = 'headers',
+  type = 'mime',
 }
 
 
@@ -696,7 +707,7 @@ local check_encrypted_name = rspamd_config:register_symbol{
   end,
   score = 10.0,
   description = 'Bogus mix of encrypted and text/html payloads',
-  group = 'mime_types'
+  group = 'mime_types',
 }
 
 rspamd_config:register_symbol{
index d5760ed25df80b1b3a2c2c2767ef2b4a2e454aac..c1492815f38770ee072dd3952db19c6e57e860b9 100644 (file)
@@ -52,6 +52,7 @@ rspamd_config.SUBJ_ALL_CAPS = {
   end,
   score = 3.0,
   group = 'subject',
+  type = 'mime',
   description = 'All capital letters in subject'
 }
 
@@ -64,5 +65,6 @@ rspamd_config.LONG_SUBJ = {
   end,
   score = 3.0,
   group = 'subject',
+  type = 'mime',
   description = 'Subject is too long'
 }
\ No newline at end of file