# HG changeset patch # User Matthew Wild # Date 1646234532 0 # Node ID b4f2027ef917052fedf186baf202bee33fea94e3 # Parent 6bb2f660f689e68543d3a9ce18f266b99eb1eef5 util.prosodyctl: Warn about enabled public registration in 'check config' diff -r 6bb2f660f689 -r b4f2027ef917 util/prosodyctl/check.lua --- a/util/prosodyctl/check.lua Wed Feb 23 20:31:03 2022 +0100 +++ b/util/prosodyctl/check.lua Wed Mar 02 15:22:12 2022 +0000 @@ -403,6 +403,34 @@ ok = false; end + do + local global_modules = set.new(config["*"].modules_enabled); + local registration_enabled_hosts = {}; + for host in enabled_hosts() do + local host_modules = set.new(config[host].modules_enabled) + global_modules; + local allow_registration = config[host].allow_registration; + local mod_register = host_modules:contains("register"); + local mod_register_ibr = host_modules:contains("register_ibr"); + local mod_invites_register = host_modules:contains("invites_register"); + local registration_invite_only = config[host].registration_invite_only; + local is_vhost = not config[host].component_module; + if is_vhost and (mod_register_ibr or (mod_register and allow_registration)) + and not (mod_invites_register and registration_invite_only) then + table.insert(registration_enabled_hosts, host); + end + end + if #registration_enabled_hosts > 0 then + table.sort(registration_enabled_hosts); + print(""); + print(" Public registration is enabled on:"); + print(" "..table.concat(registration_enabled_hosts, ", ")); + print(""); + print(" If this is intentional, review our guidelines on running a public server"); + print(" at https://prosody.im/doc/public_servers - otherwise, consider switching to"); + print(" invite-based registration, which is more secure."); + end + end + print("Done.\n"); end if not what or what == "dns" then