diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-05-02 20:32:43 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-05-02 20:32:43 +0100 |
commit | a073502b279b5127895f4953702bed54bcc7dbfb (patch) | |
tree | 5b0f4a7b9063a12b349e800c425954993b0a3bc7 /plugins | |
parent | cdefe721448365b25bf3217bbbdd25c04b3a7091 (diff) | |
download | prosody-a073502b279b5127895f4953702bed54bcc7dbfb.tar.gz prosody-a073502b279b5127895f4953702bed54bcc7dbfb.zip |
mod_posix: Don't let the server run as root without the magic run_as_root in config
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_posix.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index b1c7e01b..e6f17cc1 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -14,6 +14,15 @@ local logger_set = require "util.logger".setwriter; 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() |