Ensure that config files are readable by the daemon

refs #11212
refs #11211
This commit is contained in:
Michael Friedrich 2016-02-24 13:55:25 +01:00
parent 47c5425137
commit 894aaaecb1
8 changed files with 12 additions and 12 deletions

View File

@ -171,7 +171,7 @@ bool ApiSetupUtility::SetupMasterApiUser(void)
NodeUtility::CreateBackupFile(apiUsersPath);
std::fstream fp;
String tempFilename = Utility::CreateTempFile(apiUsersPath + ".XXXXXX", 0640, fp);
String tempFilename = Utility::CreateTempFile(apiUsersPath + ".XXXXXX", 0644, fp);
fp << "/**\n"
<< " * The APIUser objects are used for authentication against the API.\n"

View File

@ -170,7 +170,7 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
NodeUtility::CreateBackupFile(apipath);
std::fstream fp;
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
fp << "/**\n"
<< " * The API listener is used for distributed monitoring setups.\n"
@ -374,7 +374,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
NodeUtility::CreateBackupFile(apipath);
std::fstream fp;
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
fp << "/**\n"
<< " * The API listener is used for distributed monitoring setups.\n"

View File

@ -386,7 +386,7 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt
}
std::fstream fp;
String tempFilename = Utility::CreateTempFile(filename + ".XXXXXX", 0640, fp);
String tempFilename = Utility::CreateTempFile(filename + ".XXXXXX", 0644, fp);
fp << "/*\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::fstream ofp;
String tempFile = Utility::CreateTempFile(constantsFile + ".XXXXXX", 0640, ofp);
String tempFile = Utility::CreateTempFile(constantsFile + ".XXXXXX", 0644, ofp);
bool found = false;

View File

@ -413,7 +413,7 @@ wizard_ticket:
NodeUtility::CreateBackupFile(apipath);
std::fstream fp;
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
fp << "/**\n"
<< " * The API listener is used for distributed monitoring setups.\n"
@ -538,7 +538,7 @@ wizard_ticket:
std::fstream fp;
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0640, fp);
String tempApiPath = Utility::CreateTempFile(apipath + ".XXXXXX", 0644, fp);
fp << "/**\n"
<< " * The API listener is used for distributed monitoring setups.\n"

View File

@ -497,7 +497,7 @@ bool RepositoryUtility::WriteObjectToRepository(const String& path, const String
CreateRepositoryPath(Utility::DirName(path));
std::fstream fp;
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0640, fp);
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
SerializeObject(fp, name, type, item);
fp << std::endl;

View File

@ -539,7 +539,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
String objectsPath = GetObjectsPath();
std::fstream objectfp;
String tempObjectsPath = Utility::CreateTempFile(objectsPath + ".XXXXXX", 0640, objectfp);
String tempObjectsPath = Utility::CreateTempFile(objectsPath + ".XXXXXX", 0644, objectfp);
objectfp << std::fixed;
@ -785,7 +785,7 @@ void StatusDataWriter::StatusTimerHandler(void)
String statusPath = GetStatusPath();
std::fstream statusfp;
String tempStatusPath = Utility::CreateTempFile(statusPath + ".XXXXXX", 0640, statusfp);
String tempStatusPath = Utility::CreateTempFile(statusPath + ".XXXXXX", 0644, statusfp);
statusfp << std::fixed;

View File

@ -724,7 +724,7 @@ Value ClusterEvents::UpdateRepositoryAPIHandler(const MessageOrigin::Ptr& origin
String repositoryFile = GetRepositoryDir() + SHA256(params->Get("endpoint")) + ".repo";
std::fstream fp;
String tempRepositoryFile = Utility::CreateTempFile(repositoryFile + ".XXXXXX", 0640, fp);
String tempRepositoryFile = Utility::CreateTempFile(repositoryFile + ".XXXXXX", 0644, fp);
fp << JsonEncode(params);
fp.close();

View File

@ -175,7 +175,7 @@ void IcingaApplication::DumpModifiedAttributes(void)
String path = GetModAttrPath();
std::fstream fp;
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0640, fp);
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
ConfigObject::Ptr previousObject;
ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3));