diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-04-26 16:12:43 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-04-26 16:21:55 +0200 |
commit | a31d3cddc4e366cbe2489a17cf2a124149e2fa21 (patch) | |
tree | 7d4fb45b98ab625709367825728e0f4e61a37fc8 | |
parent | d3916dab9edae772f3da45159b6aafb54a286c4d (diff) | |
download | rspamd-a31d3cddc4e366cbe2489a17cf2a124149e2fa21.tar.gz rspamd-a31d3cddc4e366cbe2489a17cf2a124149e2fa21.zip |
[Feature] DKIM signing: sign_networks/local address specific use_domain settings
- Issue: #1582
-rw-r--r-- | src/plugins/lua/dkim_signing.lua | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/plugins/lua/dkim_signing.lua b/src/plugins/lua/dkim_signing.lua index ec2f70dc5..3d83c251c 100644 --- a/src/plugins/lua/dkim_signing.lua +++ b/src/plugins/lua/dkim_signing.lua @@ -66,11 +66,11 @@ local function dkim_signing_cb(task) is_local = true end if settings.auth_only and not auser then - if settings.sign_local and is_local then - rspamd_logger.debugm(N, task, 'mail is from local address') - elseif (settings.sign_networks and settings.sign_networks:get_key(ip)) then + if (settings.sign_networks and settings.sign_networks:get_key(ip)) then is_sign_networks = true rspamd_logger.debugm(N, task, 'mail is from address in sign_networks') + elseif settings.sign_local and is_local then + rspamd_logger.debugm(N, task, 'mail is from local address') else rspamd_logger.debugm(N, task, 'ignoring unauthenticated mail') return @@ -96,10 +96,24 @@ local function dkim_signing_cb(task) if edom then edom = edom:lower() end - if settings.use_domain == 'header' then - dkim_domain = hdom + if settings.use_domain_sign_networks and is_sign_networks then + if settings.use_domain_sign_networks == 'header' then + dkim_domain = hdom + else + dkim_domain = edom + end + elseif settings.use_domain_local and is_local then + if settings.use_domain_local == 'header' then + dkim_domain = hdom + else + dkim_domain = edom + end else - dkim_domain = edom + if settings.use_domain == 'header' then + dkim_domain = hdom + else + dkim_domain = edom + end end if not dkim_domain then rspamd_logger.debugm(N, task, 'could not extract dkim domain') |