aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-09-27 15:37:10 +0200
committerKim Alvefur <zash@zash.se>2017-09-27 15:37:10 +0200
commit942b98607121833680f9e17ee824d0daafd0a7e6 (patch)
tree9e28d68c3c79dc62c97707def309b8ecde8c298c /prosodyctl
parent28746d6a2e125fd821489923bd95e399c19c6e78 (diff)
downloadprosody-942b98607121833680f9e17ee824d0daafd0a7e6.tar.gz
prosody-942b98607121833680f9e17ee824d0daafd0a7e6.zip
prosodyctl: Abort and warn if the config can't be opened after dropping root privileges (fixes #990)
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl11
1 files changed, 11 insertions, 0 deletions
diff --git a/prosodyctl b/prosodyctl
index 379ccf46..eaccf1d9 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -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