mirror of https://github.com/Icinga/icinga2.git
'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 csr = pki_path + "/" + cn + ".csr";
|
||||
|
||||
if (Utility::PathExists(key)) {
|
||||
Log(LogInformation, "cli")
|
||||
<< "Private key file '" << key << "' already existing, skipping.";
|
||||
return true;
|
||||
}
|
||||
|
||||
Log(LogInformation, "cli")
|
||||
<< "Generating new CSR in '" << csr << "'.";
|
||||
|
||||
|
@ -153,6 +159,12 @@ bool ApiSetupUtility::SetupMasterApiUser(void)
|
|||
String api_password = RandomString(8);
|
||||
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")
|
||||
<< "Adding new ApiUser '" << api_username << "' in '" << apiuserspath << "'.";
|
||||
|
||||
|
|
Loading…
Reference in New Issue