mirror of https://github.com/Icinga/icinga2.git
Fix: "node setup" tries to chown() files before they're created
fixes #11204
This commit is contained in:
parent
5b30c9ed2c
commit
74d1d68893
|
@ -335,16 +335,9 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
|
|||
}
|
||||
|
||||
/* fix permissions: root -> icinga daemon user */
|
||||
std::vector<String> files;
|
||||
files.push_back(ca);
|
||||
files.push_back(key);
|
||||
files.push_back(cert);
|
||||
|
||||
BOOST_FOREACH(const String& file, files) {
|
||||
if (!Utility::SetFileOwnership(file, user, group)) {
|
||||
if (!Utility::SetFileOwnership(key, user, group)) {
|
||||
Log(LogWarning, "cli")
|
||||
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on file '" << file << "'. Verify it yourself!";
|
||||
}
|
||||
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on file '" << key << "'. Verify it yourself!";
|
||||
}
|
||||
|
||||
Log(LogInformation, "cli", "Requesting a signed certificate from the master.");
|
||||
|
@ -354,6 +347,11 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (!Utility::SetFileOwnership(ca, user, group)) {
|
||||
Log(LogWarning, "cli")
|
||||
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on file '" << ca << "'. Verify it yourself!";
|
||||
}
|
||||
|
||||
/* fix permissions (again) when updating the signed certificate */
|
||||
if (!Utility::SetFileOwnership(cert, user, group)) {
|
||||
Log(LogWarning, "cli")
|
||||
|
|
Loading…
Reference in New Issue