| 25 | using namespace icinga; |
| 26 | |
| 27 | int 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 | |
| 46 | int PkiUtility::NewCert(const String& cn, const String& keyfile, const String& csrfile, const String& certfile) |
| 47 | { |
nothing calls this directly
no test coverage detected