aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_tls.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_tls.lua')
-rw-r--r--plugins/mod_tls.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua
index 85dc6bba..dc291278 100644
--- a/plugins/mod_tls.lua
+++ b/plugins/mod_tls.lua
@@ -12,6 +12,9 @@ local st = require "util.stanza";
local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls';
+local config = require "core.configmanager";
+local secure_auth_only = config.get("*", "core", "require_encryption");
+
module:add_handler("c2s_unauthed", "starttls", xmlns_starttls,
function (session, stanza)
if session.conn.starttls then
@@ -30,6 +33,11 @@ local starttls_attr = { xmlns = xmlns_starttls };
module:add_event_hook("stream-features",
function (session, features)
if session.conn.starttls then
- features:tag("starttls", starttls_attr):up();
+ features:tag("starttls", starttls_attr);
+ if secure_auth_only then
+ features:tag("required"):up():up();
+ else
+ features:up();
+ end
end
end);