aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-10-21 14:35:32 +0200
committerKim Alvefur <zash@zash.se>2014-10-21 14:35:32 +0200
commit73979a83fdb1a17f4ed04c1ca979ac4ca74f7dc6 (patch)
treed898fddc4c0539aa6d4d9530aefc5ef044ffa5d9 /plugins/mod_saslauth.lua
parent371d996a7d0b32e617611b40faa9f2d8988dbd53 (diff)
downloadprosody-73979a83fdb1a17f4ed04c1ca979ac4ca74f7dc6.tar.gz
prosody-73979a83fdb1a17f4ed04c1ca979ac4ca74f7dc6.zip
mod_saslauth: Use a configurable set of mechanisms to not allow over unencrypted connections
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 1820dce3..edc151a6 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -18,6 +18,7 @@ local tostring = tostring;
local secure_auth_only = module:get_option_boolean("c2s_require_encryption", module:get_option_boolean("require_encryption", false));
local allow_unencrypted_plain_auth = module:get_option_boolean("allow_unencrypted_plain_auth", false)
+local insecure_mechanisms = module:get_option_set("allow_unencrypted_sasl", allow_unencrypted_plain_auth and {} or {"PLAIN"});
local log = module._log;
@@ -183,7 +184,7 @@ module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function(event)
session.sasl_handler = usermanager_get_sasl_handler(module.host, session);
end
local mechanism = stanza.attr.mechanism;
- if not session.secure and (secure_auth_only or (mechanism == "PLAIN" and not allow_unencrypted_plain_auth)) then
+ if not session.secure and (secure_auth_only or insecure_mechanisms:contains(mechanism)) then
session.send(build_reply("failure", "encryption-required"));
return true;
end
@@ -231,7 +232,7 @@ module:hook("stream-features", function(event)
end
local mechanisms = st.stanza("mechanisms", mechanisms_attr);
for mechanism in pairs(origin.sasl_handler:mechanisms()) do
- if mechanism ~= "PLAIN" or origin.secure or allow_unencrypted_plain_auth then
+ if (origin.secure or not insecure_mechanisms:contains(mechanism)) then
mechanisms:tag("mechanism"):text(mechanism):up();
end
end