aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_legacyauth.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-05-29 14:33:55 +0100
committerMatthew Wild <mwild1@gmail.com>2009-05-29 14:33:55 +0100
commit4e00f6c8b5552993cdff250aa0946c0e71b136a0 (patch)
tree0a1375a65834d992472f058d35ebf10f8211cd8e /plugins/mod_legacyauth.lua
parentede4cc6e86b9937c0739c42e90fe578865618d9a (diff)
downloadprosody-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_legacyauth.lua')
-rw-r--r--plugins/mod_legacyauth.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/mod_legacyauth.lua b/plugins/mod_legacyauth.lua
index fa14f5e7..f1ffef34 100644
--- a/plugins/mod_legacyauth.lua
+++ b/plugins/mod_legacyauth.lua
@@ -11,6 +11,9 @@
local st = require "util.stanza";
local t_concat = table.concat;
+local config = require "core.configmanager";
+local secure_auth_only = config.get(module:get_host(), "core", "require_encryption");
+
local sessionmanager = require "core.sessionmanager";
local usermanager = require "core.usermanager";
@@ -21,6 +24,11 @@ end);
module:add_iq_handler("c2s_unauthed", "jabber:iq:auth",
function (session, stanza)
+ if secure_auth_only and not session.secure then
+ session.send(st.error_reply(stanza, "modify", "not-acceptable", "Encryption (SSL or TLS) is required to connect to this server"));
+ return true;
+ end
+
local username = stanza.tags[1]:child_with_name("username");
local password = stanza.tags[1]:child_with_name("password");
local resource = stanza.tags[1]:child_with_name("resource");