diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-29 12:13:53 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-29 12:13:53 +0000 |
commit | 2b9ee10f8dd690bfc8c6c244f783d0555de9b0ab (patch) | |
tree | 6b987b8022679438c75b5fea3118705570f21f2b /src/plugins/lua | |
parent | 9fddf731cf2161288d70d50c182831124cbd377b (diff) | |
download | rspamd-2b9ee10f8dd690bfc8c6c244f783d0555de9b0ab.tar.gz rspamd-2b9ee10f8dd690bfc8c6c244f783d0555de9b0ab.zip |
[Feature] DCC: Add bulkness and reputation checks to dcc
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/dcc.lua | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/src/plugins/lua/dcc.lua b/src/plugins/lua/dcc.lua index d82ceda94..32cb6624b 100644 --- a/src/plugins/lua/dcc.lua +++ b/src/plugins/lua/dcc.lua @@ -19,6 +19,7 @@ limitations under the License. local N = 'dcc' local symbol_bulk = "DCC_BULK" +local symbol = "DCC_REJECT" local opts = rspamd_config:get_all_opt(N) local rspamd_logger = require "rspamd_logger" local dcc = require("lua_scanners").filter('dcc').dcc @@ -32,6 +33,9 @@ dcc { socket = "/var/dcc/dccifd"; # Unix socket servers = "127.0.0.1:10045" # OR TCP upstreams timeout = 2s; # Timeout to wait for checks + body_max = 999999; # Bulkness threshold for body + fuz1_max = 999999; # Bulkness threshold for fuz1 + fuz2_max = 999999; # Bulkness threshold for fuz2 } ]]) return @@ -58,21 +62,52 @@ if opts['host'] ~= nil and not opts['port'] then end -- WORKAROUND for deprecated host and port settings -if not opts.symbol then opts.symbol = symbol_bulk end +if not opts.symbol_bulk then opts.symbol_bulk = symbol_bulk end +if not opts.symbol then opts.symbol = symbol end + rule = dcc.configure(opts) if rule then - rspamd_config:register_symbol({ - name = opts.symbol, + local id = rspamd_config:register_symbol({ + name = 'DCC_CHECK', callback = check_dcc }) + rspamd_config:register_symbol{ + type = 'virtual', + parent = id, + name = opts.symbol + } + rspamd_config:register_symbol{ + type = 'virtual', + parent = id, + name = opts.symbol_bulk + } + rspamd_config:register_symbol{ + type = 'virtual', + parent = id, + name = 'DCC_FAIL' + } rspamd_config:set_metric_symbol({ group = N, - score = 2.0, + score = 1.0, description = 'Detected as bulk mail by DCC', one_shot = true, + name = opts.symbol_bulk, + }) + rspamd_config:set_metric_symbol({ + group = N, + score = 2.0, + description = 'Rejected by DCC', + one_shot = true, name = opts.symbol, }) + rspamd_config:set_metric_symbol({ + group = N, + score = 0.0, + description = 'DCC failure', + one_shot = true, + name = 'DCC_FAIL', + }) else lua_util.disable_module(N, "config") rspamd_logger.infox('DCC module not configured'); |