This commit is contained in:
Tiara Rodney 2026-03-14 05:38:45 +01:00
commit 883f31932e
No known key found for this signature in database
GPG key ID: 5CD8EC1D46106723
169 changed files with 5676 additions and 0 deletions

View file

@ -0,0 +1,16 @@
-- Disconnect c2s sessions after a configurable timeout to force re-authentication.
-- This ensures that expired credentials (e.g. app passwords) are caught promptly.
local timeout = module:get_option_number("session_timeout", 1800); -- default 30 minutes
module:hook("resource-bind", function(event)
local session = event.session;
if not session then return; end
session._timeout_timer = module:add_timer(timeout, function()
if session.type == "c2s" and not session.destroyed then
module:log("info", "Session timeout for %s, forcing re-authentication", session.full_jid);
session:close({ condition = "policy-violation", text = "Session expired, please reconnect" });
end
end);
end);