MCPcopy Create free account
hub / github.com/Icinga/icinga2 / NewCa

Method NewCa

lib/remote/pkiutility.cpp:27–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using namespace icinga;
26
27int PkiUtility::NewCa()
28{
29 String caDir = ApiListener::GetCaDir();
30 String caCertFile = caDir + "/ca.crt";
31 String caKeyFile = caDir + "/ca.key";
32
33 if (Utility::PathExists(caCertFile) && Utility::PathExists(caKeyFile)) {
34 Log(LogWarning, "cli")
35 << "CA files '" << caCertFile << "' and '" << caKeyFile << "' already exist.";
36 return 1;
37 }
38
39 Utility::MkDirP(caDir, 0700);
40
41 MakeX509CSR("Icinga CA", caKeyFile, String(), caCertFile, 0, ROOT_VALID_FOR, true);
42
43 return 0;
44}
45
46int PkiUtility::NewCert(const String& cn, const String& keyfile, const String& csrfile, const String& certfile)
47{

Callers

nothing calls this directly

Calls 5

PathExistsFunction · 0.85
LogClass · 0.85
MkDirPFunction · 0.85
MakeX509CSRFunction · 0.85
StringClass · 0.50

Tested by

no test coverage detected