"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/cli/pkisavecertcommand.cpp" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

pkisavecertcommand.cpp  (icinga2-2.11.5):pkisavecertcommand.cpp  (icinga2-2.12.0)
skipping to change at line 29 skipping to change at line 29
String PKISaveCertCommand::GetShortDescription() const String PKISaveCertCommand::GetShortDescription() const
{ {
return "saves another Icinga 2 instance's certificate"; return "saves another Icinga 2 instance's certificate";
} }
void PKISaveCertCommand::InitParameters(boost::program_options::options_descript ion& visibleDesc, void PKISaveCertCommand::InitParameters(boost::program_options::options_descript ion& visibleDesc,
boost::program_options::options_description& hiddenDesc) const boost::program_options::options_description& hiddenDesc) const
{ {
visibleDesc.add_options() visibleDesc.add_options()
("key", po::value<std::string>(), "Key file path (input), obsolet
e")
("cert", po::value<std::string>(), "Certificate file path (input)
, obsolete")
("trustedcert", po::value<std::string>(), "Trusted certificate fi le path (output)") ("trustedcert", po::value<std::string>(), "Trusted certificate fi le path (output)")
("host", po::value<std::string>(), "Icinga 2 host") ("host", po::value<std::string>(), "Parent Icinga instance to fet ch the public TLS certificate from")
("port", po::value<std::string>()->default_value("5665"), "Icinga 2 port"); ("port", po::value<std::string>()->default_value("5665"), "Icinga 2 port");
hiddenDesc.add_options()
("key", po::value<std::string>())
("cert", po::value<std::string>());
} }
std::vector<String> PKISaveCertCommand::GetArgumentSuggestions(const String& arg ument, const String& word) const std::vector<String> PKISaveCertCommand::GetArgumentSuggestions(const String& arg ument, const String& word) const
{ {
if (argument == "key" || argument == "cert" || argument == "trustedcert") if (argument == "trustedcert")
return GetBashCompletionSuggestions("file", word); return GetBashCompletionSuggestions("file", word);
else if (argument == "host") else if (argument == "host")
return GetBashCompletionSuggestions("hostname", word); return GetBashCompletionSuggestions("hostname", word);
else if (argument == "port") else if (argument == "port")
return GetBashCompletionSuggestions("service", word); return GetBashCompletionSuggestions("service", word);
else else
return CLICommand::GetArgumentSuggestions(argument, word); return CLICommand::GetArgumentSuggestions(argument, word);
} }
/** /**
skipping to change at line 69 skipping to change at line 71
if (!vm.count("trustedcert")) { if (!vm.count("trustedcert")) {
Log(LogCritical, "cli", "Trusted certificate output file path (-- trustedcert) must be specified."); Log(LogCritical, "cli", "Trusted certificate output file path (-- trustedcert) must be specified.");
return 1; return 1;
} }
String host = vm["host"].as<std::string>(); String host = vm["host"].as<std::string>();
String port = vm["port"].as<std::string>(); String port = vm["port"].as<std::string>();
Log(LogInformation, "cli") Log(LogInformation, "cli")
<< "Retrieving X.509 certificate for '" << host << ":" << port << "'."; << "Retrieving TLS certificate for '" << host << ":" << port << " '.";
std::shared_ptr<X509> cert = PkiUtility::FetchCert(host, port); std::shared_ptr<X509> cert = PkiUtility::FetchCert(host, port);
if (!cert) { if (!cert) {
Log(LogCritical, "cli", "Failed to fetch certificate from host.") ; Log(LogCritical, "cli", "Failed to fetch certificate from host.") ;
return 1; return 1;
} }
std::cout << PkiUtility::GetCertificateInformation(cert) << "\n"; std::cout << PkiUtility::GetCertificateInformation(cert) << "\n";
std::cout << ConsoleColorTag(Console_ForegroundRed) std::cout << ConsoleColorTag(Console_ForegroundRed)
 End of changes. 5 change blocks. 
7 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)