mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-01 10:54:32 +02:00
'api setup' must not override existing certificate and api-users.conf file
fixes #10560
This commit is contained in:
parent
e6159ca86a
commit
b7f923dd01
@ -83,6 +83,12 @@ bool ApiSetupUtility::SetupMasterCertificates(const String& cn)
|
|||||||
String key = pki_path + "/" + cn + ".key";
|
String key = pki_path + "/" + cn + ".key";
|
||||||
String csr = pki_path + "/" + cn + ".csr";
|
String csr = pki_path + "/" + cn + ".csr";
|
||||||
|
|
||||||
|
if (Utility::PathExists(key)) {
|
||||||
|
Log(LogInformation, "cli")
|
||||||
|
<< "Private key file '" << key << "' already existing, skipping.";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Log(LogInformation, "cli")
|
Log(LogInformation, "cli")
|
||||||
<< "Generating new CSR in '" << csr << "'.";
|
<< "Generating new CSR in '" << csr << "'.";
|
||||||
|
|
||||||
@ -153,6 +159,12 @@ bool ApiSetupUtility::SetupMasterApiUser(void)
|
|||||||
String api_password = RandomString(8);
|
String api_password = RandomString(8);
|
||||||
String apiuserspath = GetConfdPath() + "/api-users.conf";
|
String apiuserspath = GetConfdPath() + "/api-users.conf";
|
||||||
|
|
||||||
|
if (Utility::PathExists(apiuserspath)) {
|
||||||
|
Log(LogInformation, "cli")
|
||||||
|
<< "API user config file '" << apiuserspath << "' already existing, skipping.";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Log(LogInformation, "cli")
|
Log(LogInformation, "cli")
|
||||||
<< "Adding new ApiUser '" << api_username << "' in '" << apiuserspath << "'.";
|
<< "Adding new ApiUser '" << api_username << "' in '" << apiuserspath << "'.";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user