mirror of https://github.com/Icinga/icinga2.git
Ensure that config files are readable by the daemon
refs #11212 refs #11211
This commit is contained in:
parent
a79ea88fff
commit
e4b99ca87e
|
@ -171,7 +171,7 @@ bool ApiSetupUtility::SetupMasterApiUser(void)
|
||||||
NodeUtility::CreateBackupFile(apiUsersPath);
|
NodeUtility::CreateBackupFile(apiUsersPath);
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempFilename = Utility::CreateTempFile(apiUsersPath + ".XXXXXX", 0640, fp);
|
String tempFilename = Utility::CreateTempFile(apiUsersPath + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
fp << "/**\n"
|
fp << "/**\n"
|
||||||
<< " * The APIUser objects are used for authentication against the API.\n"
|
<< " * The APIUser objects are used for authentication against the API.\n"
|
||||||
|
|
|
@ -170,7 +170,7 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
|
||||||
NodeUtility::CreateBackupFile(apipath);
|
NodeUtility::CreateBackupFile(apipath);
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
|
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
fp << "/**\n"
|
fp << "/**\n"
|
||||||
<< " * The API listener is used for distributed monitoring setups.\n"
|
<< " * The API listener is used for distributed monitoring setups.\n"
|
||||||
|
@ -375,7 +375,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
|
||||||
NodeUtility::CreateBackupFile(apipath);
|
NodeUtility::CreateBackupFile(apipath);
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
|
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
fp << "/**\n"
|
fp << "/**\n"
|
||||||
<< " * The API listener is used for distributed monitoring setups.\n"
|
<< " * The API listener is used for distributed monitoring setups.\n"
|
||||||
|
|
|
@ -386,7 +386,7 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt
|
||||||
}
|
}
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempFilename = Utility::CreateTempFile(filename + ".XXXXXX", 0640, fp);
|
String tempFilename = Utility::CreateTempFile(filename + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
fp << "/*\n";
|
fp << "/*\n";
|
||||||
fp << " * Generated by Icinga 2 node setup commands\n";
|
fp << " * Generated by Icinga 2 node setup commands\n";
|
||||||
|
@ -640,7 +640,7 @@ void NodeUtility::UpdateConstant(const String& name, const String& value)
|
||||||
|
|
||||||
std::ifstream ifp(constantsFile.CStr());
|
std::ifstream ifp(constantsFile.CStr());
|
||||||
std::fstream ofp;
|
std::fstream ofp;
|
||||||
String tempFile = Utility::CreateTempFile(constantsFile + ".XXXXXX", 0640, ofp);
|
String tempFile = Utility::CreateTempFile(constantsFile + ".XXXXXX", 0644, ofp);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
|
|
@ -413,7 +413,7 @@ wizard_ticket:
|
||||||
NodeUtility::CreateBackupFile(apipath);
|
NodeUtility::CreateBackupFile(apipath);
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
|
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
fp << "/**\n"
|
fp << "/**\n"
|
||||||
<< " * The API listener is used for distributed monitoring setups.\n"
|
<< " * The API listener is used for distributed monitoring setups.\n"
|
||||||
|
@ -538,7 +538,7 @@ wizard_ticket:
|
||||||
|
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
|
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
fp << "/**\n"
|
fp << "/**\n"
|
||||||
<< " * The API listener is used for distributed monitoring setups.\n"
|
<< " * The API listener is used for distributed monitoring setups.\n"
|
||||||
|
|
|
@ -497,7 +497,7 @@ bool RepositoryUtility::WriteObjectToRepository(const String& path, const String
|
||||||
CreateRepositoryPath(Utility::DirName(path));
|
CreateRepositoryPath(Utility::DirName(path));
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0640, fp);
|
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
SerializeObject(fp, name, type, item);
|
SerializeObject(fp, name, type, item);
|
||||||
fp << std::endl;
|
fp << std::endl;
|
||||||
|
|
|
@ -539,7 +539,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
||||||
String objectsPath = GetObjectsPath();
|
String objectsPath = GetObjectsPath();
|
||||||
|
|
||||||
std::fstream objectfp;
|
std::fstream objectfp;
|
||||||
String tempObjectsPath = Utility::CreateTempFile(objectsPath + ".XXXXXX", 0640, objectfp);
|
String tempObjectsPath = Utility::CreateTempFile(objectsPath + ".XXXXXX", 0644, objectfp);
|
||||||
|
|
||||||
objectfp << std::fixed;
|
objectfp << std::fixed;
|
||||||
|
|
||||||
|
@ -785,7 +785,7 @@ void StatusDataWriter::StatusTimerHandler(void)
|
||||||
String statusPath = GetStatusPath();
|
String statusPath = GetStatusPath();
|
||||||
|
|
||||||
std::fstream statusfp;
|
std::fstream statusfp;
|
||||||
String tempStatusPath = Utility::CreateTempFile(statusPath + ".XXXXXX", 0640, statusfp);
|
String tempStatusPath = Utility::CreateTempFile(statusPath + ".XXXXXX", 0644, statusfp);
|
||||||
|
|
||||||
statusfp << std::fixed;
|
statusfp << std::fixed;
|
||||||
|
|
||||||
|
|
|
@ -724,7 +724,7 @@ Value ClusterEvents::UpdateRepositoryAPIHandler(const MessageOrigin::Ptr& origin
|
||||||
String repositoryFile = GetRepositoryDir() + SHA256(params->Get("endpoint")) + ".repo";
|
String repositoryFile = GetRepositoryDir() + SHA256(params->Get("endpoint")) + ".repo";
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempRepositoryFile = Utility::CreateTempFile(repositoryFile + ".XXXXXX", 0640, fp);
|
String tempRepositoryFile = Utility::CreateTempFile(repositoryFile + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
fp << JsonEncode(params);
|
fp << JsonEncode(params);
|
||||||
fp.close();
|
fp.close();
|
||||||
|
|
|
@ -175,7 +175,7 @@ void IcingaApplication::DumpModifiedAttributes(void)
|
||||||
String path = GetModAttrPath();
|
String path = GetModAttrPath();
|
||||||
|
|
||||||
std::fstream fp;
|
std::fstream fp;
|
||||||
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0640, fp);
|
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
|
||||||
|
|
||||||
ConfigObject::Ptr previousObject;
|
ConfigObject::Ptr previousObject;
|
||||||
ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3));
|
ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3));
|
||||||
|
|
Loading…
Reference in New Issue