diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-05-29 14:33:55 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-05-29 14:33:55 +0100 |
commit | 4e00f6c8b5552993cdff250aa0946c0e71b136a0 (patch) | |
tree | 0a1375a65834d992472f058d35ebf10f8211cd8e /plugins/mod_saslauth.lua | |
parent | ede4cc6e86b9937c0739c42e90fe578865618d9a (diff) | |
download | prosody-4e00f6c8b5552993cdff250aa0946c0e71b136a0.tar.gz prosody-4e00f6c8b5552993cdff250aa0946c0e71b136a0.zip |
mod_saslauth, mod_legacyauth: Deny logins to unsecure sessions when require_encryption config option is true
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r-- | plugins/mod_saslauth.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 3f570e40..f226203e 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -21,6 +21,8 @@ local jid_split = require "util.jid".split local md5 = require "util.hashes".md5; local config = require "core.configmanager"; +local secure_auth_only = config.get(module:get_host(), "core", "require_encryption"); + local log = module._log; local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; @@ -119,7 +121,7 @@ local bind_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-bind' }; local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' }; module:add_event_hook("stream-features", function (session, features) - if not session.username then + if not session.username and ((not secure_auth_only) or session.secure) then features:tag("mechanisms", mechanisms_attr); -- TODO: Provide PLAIN only if TLS is active, this is a SHOULD from the introduction of RFC 4616. This behavior could be overridden via configuration but will issuing a warning or so. if config.get(session.host or "*", "core", "anonymous_login") then |