# HG changeset patch # User Matthew Wild # Date 1241292763 -3600 # Node ID b547967d87fcc943a43e77f3ef6dc8c315495f86 # Parent 5ca2d3a332698c3c2690bb2cd0070ba9e2e564f7 mod_posix: Don't let the server run as root without the magic run_as_root in config diff -r 5ca2d3a33269 -r b547967d87fc plugins/mod_posix.lua --- a/plugins/mod_posix.lua Sat May 02 20:32:17 2009 +0100 +++ b/plugins/mod_posix.lua Sat May 02 20:32:43 2009 +0100 @@ -14,6 +14,15 @@ module.host = "*"; -- we're a global module +-- Don't even think about it! +module:add_event_hook("server-starting", function () + if pposix.getuid() == 0 and not config_get("*", "core", "run_as_root") then + module:log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); + module:log("error", "For more information on running Prosody as root, see http://prosody.im/doc/root"); + _G.prosody_shutdown("Refusing to run as root"); + end + end); + local pidfile_written; local function remove_pidfile()