diff options
author | korgoth1 <vladislav.stakhov@gmail.com> | 2019-12-07 21:29:24 +0300 |
---|---|---|
committer | korgoth1 <vladislav.stakhov@gmail.com> | 2019-12-07 21:29:24 +0300 |
commit | cad261c52f9cc33144edc6c5e09b11c50c294421 (patch) | |
tree | 11bbebddc0f8903f2aa5990146a0c60b50f0b43b | |
parent | def24b4f413443761fa5174e478fe3c98024b95c (diff) | |
parent | f6f3c2dea862e0a503130a668f44152b77619a8e (diff) | |
download | rspamd-cad261c52f9cc33144edc6c5e09b11c50c294421.tar.gz rspamd-cad261c52f9cc33144edc6c5e09b11c50c294421.zip |
[Test] SPF for relay
-rw-r--r-- | src/plugins/lua/spf.lua | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/plugins/lua/spf.lua b/src/plugins/lua/spf.lua index f664661f9..10daa0d2b 100644 --- a/src/plugins/lua/spf.lua +++ b/src/plugins/lua/spf.lua @@ -93,8 +93,8 @@ local function spf_check_callback(task) -- We can use the next header as a source of IP address if rh[i + 1] then local nhdr = rh[i + 1] - lua_util.debugm(N, task, 'found external relay %s at received header %s -> %s', - local_config.external_relay, hdr, nhdr.real_ip) + lua_util.debugm(N, task, 'found external relay %s at received header number %s -> %s', + local_config.external_relay, i, nhdr.real_ip) if nhdr.real_ip then ip = nhdr.real_ip @@ -218,6 +218,19 @@ if local_config.whitelist then "radix", "SPF whitelist map") end +if local_config.external_relay then + local rspamd_ip = require "rspamd_ip" + local ip = rspamd_ip.from_string(local_config.external_relay) + + if not ip or not ip:is_valid() then + rspamd_logger.errx(rspamd_config, "invalid external relay IP: %s", + local_config.external_relay) + local_config.external_relay = nil + else + local_config.external_relay = ip + end +end + for _,sym in pairs(local_config.symbols) do rspamd_config:register_symbol{ name = sym, |