aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-08-30 15:56:18 +0600
committerGitHub <noreply@github.com>2024-08-30 15:56:18 +0600
commitb6f21da9a8bb0c5108397a22b797958f73bc6ee5 (patch)
tree3c072b09099bd671df72981944497e60e6458739
parent81f300beedca4ecdac166eb83d5d88fa995f198c (diff)
parentfb774ae9c5b0b4cb6b223764d9702630a1f70052 (diff)
downloadrspamd-b6f21da9a8bb0c5108397a22b797958f73bc6ee5.tar.gz
rspamd-b6f21da9a8bb0c5108397a22b797958f73bc6ee5.zip
Merge pull request #5121 from rspamd/vstakhov-rdns-check-condition
[Fix] Preserve the previous behaviour of RDNS_* checks
-rw-r--r--rules/misc.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index 8785ab4ac..4ddb00dfb 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -863,6 +863,9 @@ rspamd_config.COMPLETELY_EMPTY = {
score = 15
}
+-- Preserve compatibility
+local rdns_auth_and_local_conf = lua_util.config_check_local_or_authed(rspamd_config, 'once_received',
+ false, false)
-- Check for the hostname if it was not set
local rnds_check_id = rspamd_config:register_symbol {
name = 'RDNS_CHECK',
@@ -899,6 +902,15 @@ local rnds_check_id = rspamd_config:register_symbol {
-- TODO: settings might need to use this symbol if they depend on hostname...
priority = lua_util.symbols_priorities.top - 1,
description = 'Check if hostname has been resolved by MTA',
+ condition = function(task)
+ local task_ip = task:get_ip()
+ if ((not rdns_auth_and_local_conf[1] and task:get_user()) or
+ (not rdns_auth_and_local_conf[2] and task_ip and task_ip:is_local())) then
+ return false
+ end
+
+ return true
+ end
}
rspamd_config:register_symbol {