diff options
author | Andrew Lewis <nerf@judo.za.org> | 2016-09-30 15:13:38 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2016-09-30 15:13:38 +0200 |
commit | b561e9b9cbd86191aec1e51cc776d083b66b14b5 (patch) | |
tree | 75f11a5a2a4d4ea3ed65a8480d47d073395806e7 /src/plugins/lua/once_received.lua | |
parent | 81a01f43d3c1de562273b30025b018d38a5aadf6 (diff) | |
download | rspamd-b561e9b9cbd86191aec1e51cc776d083b66b14b5.tar.gz rspamd-b561e9b9cbd86191aec1e51cc776d083b66b14b5.zip |
[Minor] Allow for re-enabling default-disabled checks
Diffstat (limited to 'src/plugins/lua/once_received.lua')
-rw-r--r-- | src/plugins/lua/once_received.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua index 86ada799a..202041869 100644 --- a/src/plugins/lua/once_received.lua +++ b/src/plugins/lua/once_received.lua @@ -24,6 +24,8 @@ local bad_hosts = {} local good_hosts = {} local whitelist = nil local rspamd_logger = require "rspamd_logger" +local check_local = false +local check_authed = false local function check_quantity_received (task) local recvh = task:get_received_headers() @@ -61,7 +63,9 @@ local function check_quantity_received (task) local task_ip = task:get_ip() - if task:get_user() or (task_ip and task_ip:is_local()) then + if ((not check_user and task:get_user()) or + (not check_local and ip_addr and ip_addr:is_local())) then + rspamd_logger.infox(task, 'Skipping once_received for authenticated user or local network') return end if whitelist and task_ip and whitelist:get_key(task_ip) then @@ -134,6 +138,15 @@ if type(rspamd_config.get_api_version) ~= 'nil' then end end +local opts = rspamd_config:get_all_opt('options') +if opts and type(opts) ~= 'table' then + if type(opts['check_local']) == 'boolean' then + check_local = opts['check_local'] + end + if type(opts['check_authed']) == 'boolean' then + check_authed = opts['check_authed'] + end +end -- Configuration local opts = rspamd_config:get_all_opt('once_received') if opts then |