Software /
code /
prosody-modules
Diff
mod_client_management/mod_client_management.lua @ 5601:e9af6abf2b1e
mod_client_management: Add shell command to revoke client access
Could be used if an operator detects a compromised client.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 14 Jul 2023 13:25:30 +0200 |
parent | 5600:6d0574bfbf5d |
child | 5602:eae5599bc0b4 |
line wrap: on
line diff
--- a/mod_client_management/mod_client_management.lua Thu Jul 13 23:26:02 2023 +0200 +++ b/mod_client_management/mod_client_management.lua Fri Jul 14 13:25:30 2023 +0200 @@ -465,4 +465,18 @@ print(string.rep("-", self.session.width)); return true, ("%d clients"):format(#clients); end + + function console_env.user:revoke_client(user_jid, selector) -- luacheck: ignore 212/self + local username, host = jid.split(user_jid); + local mod = prosody.hosts[host] and prosody.hosts[host].modules.client_management; + if not mod then + return false, ("Host does not exist on this server, or does not have mod_client_management loaded"); + end + + local revoked, err = revocation_errors.coerce(mod.revoke_client_access(username, selector)); + if not revoked then + return false, err.text or err; + end + return true, "Client access revoked"; + end end);