diff options
author | Kim Alvefur <zash@zash.se> | 2017-02-15 23:00:03 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-02-15 23:00:03 +0100 |
commit | bb3cc61b4fb82088dde9d6ae8a492dede5803892 (patch) | |
tree | f4f415179ec3a7f526319bb8935949edac59a51d /plugins | |
parent | d6cc41b9ec7689bd58244744db820f9eb96989be (diff) | |
download | prosody-bb3cc61b4fb82088dde9d6ae8a492dede5803892.tar.gz prosody-bb3cc61b4fb82088dde9d6ae8a492dede5803892.zip |
mod_saslauth: Improve logging as to why when SASL is not offered
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_saslauth.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index f7803bc9..b9ce6d60 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -226,6 +226,7 @@ module:hook("stream-features", function(event) local log = origin.log or log; if not origin.username then if secure_auth_only and not origin.secure then + log("debug", "Not offering authentication on insecure connection"); return; end local sasl_handler = usermanager_get_sasl_handler(module.host, origin) @@ -244,15 +245,22 @@ module:hook("stream-features", function(event) end end local mechanisms = st.stanza("mechanisms", mechanisms_attr); - for mechanism in pairs(sasl_handler:mechanisms()) do - if (not disabled_mechanisms:contains(mechanism)) and (origin.secure or not insecure_mechanisms:contains(mechanism)) then + local sasl_mechanisms = sasl_handler:mechanisms() + for mechanism in pairs(sasl_mechanisms) do + if disabled_mechanisms:contains(mechanism) then + log("debug", "Not offering disabled mechanism %s", mechanism); + elseif not origin.secure and insecure_mechanisms:contains(mechanism) then + log("debug", "Not offering mechanism %s on insecure connection", mechanism); + else mechanisms:tag("mechanism"):text(mechanism):up(); end end if mechanisms[1] then features:add_child(mechanisms); + elseif not next(sasl_mechanisms) then + log("warn", "No available SASL mechanisms, verify that the configured authentication module is working"); else - log("warn", "No SASL mechanisms to offer"); + log("warn", "All available authentication mechanisms are either disabled or not suitable for an insecure connection"); end else features:tag("bind", bind_attr):tag("required"):up():up(); |