diff options
author | Kim Alvefur <zash@zash.se> | 2017-09-27 15:37:10 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-09-27 15:37:10 +0200 |
commit | 3e2f632da3f520c894058f571c0911f3aa15cc71 (patch) | |
tree | 9e28d68c3c79dc62c97707def309b8ecde8c298c /prosodyctl | |
parent | c2484808b3f3e9c14e44ff3554d31e5ef22e50b7 (diff) | |
download | prosody-3e2f632da3f520c894058f571c0911f3aa15cc71.tar.gz prosody-3e2f632da3f520c894058f571c0911f3aa15cc71.zip |
prosodyctl: Abort and warn if the config can't be opened after dropping root privileges (fixes #990)
Diffstat (limited to 'prosodyctl')
-rwxr-xr-x | prosodyctl | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -164,6 +164,17 @@ if have_pposix and pposix then if not switched_user then -- Boo! print("Warning: Couldn't switch to Prosody user/group '"..tostring(desired_user).."'/'"..tostring(desired_group).."': "..tostring(err)); + else + -- Make sure the Prosody user can read the config + local conf, err, errno = io.open(ENV_CONFIG); + if conf then + conf:close(); + else + print("The config file is not readable by the '"..desired_user.."' user."); + print("Prosody will not be able to read it."); + print("Error was "..err); + os.exit(1); + end end end |