From 9d0f15d2c642708f80e6e80b6a6143753c2619c2 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 21 Oct 2014 16:04:20 +0200 Subject: [PATCH] CLI: Add agent setup command refs #7423 --- lib/cli/agentsetupcommand.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/cli/agentsetupcommand.cpp b/lib/cli/agentsetupcommand.cpp index 6d9341d13..17115c29b 100644 --- a/lib/cli/agentsetupcommand.cpp +++ b/lib/cli/agentsetupcommand.cpp @@ -81,10 +81,43 @@ int AgentSetupCommand::Run(const boost::program_options::variables_map& vm, cons bool AgentSetupCommand::SetupMaster(const boost::program_options::variables_map& vm, const std::vector& ap) { + /* 1. Generate a new CA, if not already existing */ + if (PkiUtilility::NewCa() > 0) { + Log(LogWarning, "cli") + << "Found CA, skipping and using the existing one.\n"; + } + + /* 2. Generate a self signed certificate */ + + /* 3. Copy certificates to /etc/icinga2/pki */ + + /* 4. read zones.conf and update with zone + endpoint information */ + + /* 5. enable the ApiListener config (verifiy its data) */ + + /* 5. tell the user to reload icinga2 */ + return true; } bool AgentSetupCommand::SetupAgent(const boost::program_options::variables_map& vm, const std::vector& ap) { + /* 1. require ticket number (generated on master) */ + + /* 2. trusted cert must be passed (retrieved by the user with 'pki save-cert' before) */ + + /* 3. retrieve CN and pass it if requested (defaults to FQDN) */ + + /* 4. pki request a signed certificate from the master */ + + /* 5. get public key signed by the master, private key and ca.crt and copy it to /etc/icinga2/pki */ + + /* 6. generate local zones.conf with zone+endpoint */ + + /* 7. update constants.conf with NodeName = CN */ + + /* 8. tell the user to reload icinga2 */ + + return true; } -- 2.40.0