Software /
code /
prosody
Comparison
plugins/mod_posix.lua @ 1092:b547967d87fc
mod_posix: Don't let the server run as root without the magic run_as_root in config
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 02 May 2009 20:32:43 +0100 |
parent | 1062:f9a1ac50782b |
child | 1100:05d209ef9661 |
child | 1118:239d4362a040 |
comparison
equal
deleted
inserted
replaced
1091:5ca2d3a33269 | 1092:b547967d87fc |
---|---|
11 | 11 |
12 local config_get = require "core.configmanager".get; | 12 local config_get = require "core.configmanager".get; |
13 local logger_set = require "util.logger".setwriter; | 13 local logger_set = require "util.logger".setwriter; |
14 | 14 |
15 module.host = "*"; -- we're a global module | 15 module.host = "*"; -- we're a global module |
16 | |
17 -- Don't even think about it! | |
18 module:add_event_hook("server-starting", function () | |
19 if pposix.getuid() == 0 and not config_get("*", "core", "run_as_root") then | |
20 module:log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); | |
21 module:log("error", "For more information on running Prosody as root, see http://prosody.im/doc/root"); | |
22 _G.prosody_shutdown("Refusing to run as root"); | |
23 end | |
24 end); | |
16 | 25 |
17 local pidfile_written; | 26 local pidfile_written; |
18 | 27 |
19 local function remove_pidfile() | 28 local function remove_pidfile() |
20 if pidfile_written then | 29 if pidfile_written then |