Merge pull request #7838 from Icinga/bugfix/catch-exception-in-node-setup

Catch exception when trusted cert is not readable during node setup on agent/satellite
This commit is contained in:
Michael Friedrich 2020-02-14 09:51:17 +01:00 committed by GitHub
commit cfd9b80027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -373,7 +373,15 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
return 1; return 1;
} }
trustedParentCert = GetX509Certificate(vm["trustedcert"].as<std::string>()); String trustedCert = vm["trustedcert"].as<std::string>();
try{
trustedParentCert = GetX509Certificate(trustedCert);
} catch (const std::exception&) {
Log(LogCritical, "cli")
<< "Can't read trusted cert at '" << trustedCert << "'.";
return 1;
}
try { try {
if (IsCa(trustedParentCert)) { if (IsCa(trustedParentCert)) {