Change directory layout to /var/lib/icinga2/{ca,certs,certificate_requests}

refs #5450
This commit is contained in:
Michael Friedrich 2017-09-06 12:11:48 +02:00 committed by Gunnar Beutner
parent 88b4a54e6b
commit 8040bda2e1
8 changed files with 18 additions and 18 deletions

View File

@ -69,7 +69,7 @@ bool ApiSetupUtility::SetupMasterCertificates(const String& cn)
if (PkiUtility::NewCa() > 0)
Log(LogWarning, "cli", "Found CA, skipping and using the existing one.");
String pki_path = ApiListener::GetPkiDir();
String pki_path = ApiListener::GetCertsDir();
Utility::MkDirP(pki_path, 0700);
String user = ScriptGlobal::Get("RunAsUser");

View File

@ -54,7 +54,7 @@ ImpersonationLevel CASignCommand::GetImpersonationLevel(void) const
*/
int CASignCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
{
String requestFile = ApiListener::GetPkiRequestsDir() + "/" + ap[0] + ".json";
String requestFile = ApiListener::GetCertificateRequestsDir() + "/" + ap[0] + ".json";
if (!Utility::PathExists(requestFile)) {
Log(LogCritical, "cli")

View File

@ -131,7 +131,7 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
cn = vm["cn"].as<std::string>();
/* check whether the user wants to generate a new certificate or not */
String existing_path = ApiListener::GetPkiDir() + "/" + cn + ".crt";
String existing_path = ApiListener::GetCertsDir() + "/" + cn + ".crt";
Log(LogInformation, "cli")
<< "Checking for existing certificates for common name '" << cn << "'...";
@ -306,7 +306,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
/* pki request a signed certificate from the master */
String pki_path = ApiListener::GetPkiDir();
String pki_path = ApiListener::GetCertsDir();
Utility::MkDirP(pki_path, 0700);
String user = ScriptGlobal::Get("RunAsUser");
@ -441,7 +441,7 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
NodeUtility::UpdateConstant("NodeName", cn);
NodeUtility::UpdateConstant("ZoneName", vm["zone"].as<std::string>());
String ticketPath = ApiListener::GetPkiDir() + "/ticket";
String ticketPath = ApiListener::GetCertsDir() + "/ticket";
String tempTicketPath = Utility::CreateTempFile(ticketPath + ".XXXXXX", 0600, fp);

View File

@ -230,7 +230,7 @@ wizard_endpoint_loop_start:
}
/* workaround for fetching the master cert */
String pki_path = ApiListener::GetPkiDir();
String pki_path = ApiListener::GetCertsDir();
Utility::MkDirP(pki_path, 0700);
String user = ScriptGlobal::Get("RunAsUser");
@ -498,7 +498,7 @@ wizard_ticket:
cn = cn.Trim();
/* check whether the user wants to generate a new certificate or not */
String existing_path = ApiListener::GetPkiDir() + "/" + cn + ".crt";
String existing_path = ApiListener::GetCertsDir() + "/" + cn + ".crt";
std::cout << ConsoleColorTag(Console_Normal)
<< "Checking for existing certificates for common name '" << cn << "'...\n";

View File

@ -60,9 +60,9 @@ String ApiListener::GetApiDir(void)
return Application::GetLocalStateDir() + "/lib/icinga2/api/";
}
String ApiListener::GetPkiDir(void)
String ApiListener::GetCertsDir(void)
{
return Application::GetLocalStateDir() + "/lib/icinga2/pki/";
return Application::GetLocalStateDir() + "/lib/icinga2/certs/";
}
String ApiListener::GetCaDir(void)
@ -70,9 +70,9 @@ String ApiListener::GetCaDir(void)
return Application::GetLocalStateDir() + "/lib/icinga2/ca/";
}
String ApiListener::GetPkiRequestsDir(void)
String ApiListener::GetCertificateRequestsDir(void)
{
return Application::GetLocalStateDir() + "/lib/icinga2/pki-requests/";
return Application::GetLocalStateDir() + "/lib/icinga2/certificate-requests/";
}
void ApiListener::OnConfigLoaded(void)
@ -519,8 +519,8 @@ void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoi
JsonRpcConnection::SendCertificateRequest(aclient, MessageOrigin::Ptr(), String());
if (Utility::PathExists(ApiListener::GetPkiRequestsDir()))
Utility::Glob(ApiListener::GetPkiRequestsDir() + "/*.json", boost::bind(&JsonRpcConnection::SendCertificateRequest, aclient, MessageOrigin::Ptr(), _1), GlobFile);
if (Utility::PathExists(ApiListener::GetCertificateRequestsDir()))
Utility::Glob(ApiListener::GetCertificateRequestsDir() + "/*.json", boost::bind(&JsonRpcConnection::SendCertificateRequest, aclient, MessageOrigin::Ptr(), _1), GlobFile);
}
/* Make sure that the config updates are synced

View File

@ -60,9 +60,9 @@ public:
ApiListener(void);
static String GetApiDir(void);
static String GetPkiDir(void);
static String GetCertsDir(void);
static String GetCaDir(void);
static String GetPkiRequestsDir(void);
static String GetCertificateRequestsDir(void);
void UpdateSSLContext(void);

View File

@ -91,7 +91,7 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona
result->Set("fingerprint_request", certFingerprint);
String requestDir = ApiListener::GetPkiRequestsDir();
String requestDir = ApiListener::GetCertificateRequestsDir();
String requestPath = requestDir + "/" + certFingerprint + ".json";
result->Set("ca", CertificateToString(cacert));
@ -271,7 +271,7 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar
return Empty;
}
String requestDir = ApiListener::GetPkiRequestsDir();
String requestDir = ApiListener::GetCertificateRequestsDir();
String requestPath = requestDir + "/" + certFingerprint + ".json";
std::cout << requestPath << "\n";

View File

@ -419,7 +419,7 @@ Dictionary::Ptr PkiUtility::GetCertificateRequests(void)
{
Dictionary::Ptr requests = new Dictionary();
String requestDir = ApiListener::GetPkiRequestsDir();
String requestDir = ApiListener::GetCertificateRequestsDir();
if (Utility::PathExists(requestDir))
Utility::Glob(requestDir + "/*.json", boost::bind(&CollectRequestHandler, requests, _1), GlobFile);