2323import java .util .List ;
2424import java .util .Map ;
2525
26+ import com .trilead .ssh2 .Connection ;
27+
2628import org .apache .cloudstack .framework .ca .CAProvider ;
2729import org .apache .cloudstack .framework .ca .CAService ;
2830import org .apache .cloudstack .framework .ca .Certificate ;
@@ -39,7 +41,10 @@ public interface CAManager extends CAService, Configurable, PluggableService {
3941 ConfigKey <String > CAProviderPlugin = new ConfigKey <>("Advanced" , String .class ,
4042 "ca.framework.provider.plugin" ,
4143 "root" ,
42- "The CA provider plugin that is used for secure CloudStack management server-agent communication for encryption and authentication. Restart management server(s) when changed." , true );
44+ "The CA provider plugin used for CloudStack internal certificate management (MS-agent encryption and authentication). " +
45+ "The default 'root' provider auto-generates a CA on first startup, but also supports user-provided custom CA material " +
46+ "via the ca.plugin.root.private.key, ca.plugin.root.public.key, and ca.plugin.root.ca.certificate settings. " +
47+ "Restart management server(s) when changed." , false );
4348
4449 ConfigKey <Integer > CertKeySize = new ConfigKey <>("Advanced" , Integer .class ,
4550 "ca.framework.cert.keysize" ,
@@ -85,6 +90,12 @@ public interface CAManager extends CAService, Configurable, PluggableService {
8590 "The actual implementation will depend on the configured CA provider." ,
8691 false );
8792
93+ ConfigKey <Boolean > CaInjectDefaultTruststore = new ConfigKey <>("Advanced" , Boolean .class ,
94+ "ca.framework.inject.default.truststore" , "true" ,
95+ "When true, injects the CA provider's certificate into the JVM default truststore on management server startup. " +
96+ "This allows outgoing HTTPS connections from the management server to trust servers with certificates signed by the configured CA. " +
97+ "Restart management server(s) when changed." , false );
98+
8899 /**
89100 * Returns a list of available CA provider plugins
90101 * @return returns list of CAProvider
@@ -130,12 +141,26 @@ public interface CAManager extends CAService, Configurable, PluggableService {
130141 boolean revokeCertificate (final BigInteger certSerial , final String certCn , final String provider );
131142
132143 /**
133- * Provisions certificate for given active and connected agent host
144+ * Provisions certificate for given agent host.
145+ * When forced=true, uses SSH to re-provision bypassing the NIO agent connection (for disconnected agents).
134146 * @param host
147+ * @param reconnect
135148 * @param provider
149+ * @param forced when true, provisions via SSH instead of NIO; supports KVM hosts and SystemVMs
136150 * @return returns success/failure as boolean
137151 */
138- boolean provisionCertificate (final Host host , final Boolean reconnect , final String provider );
152+ boolean provisionCertificate (final Host host , final Boolean reconnect , final String provider , final boolean forced );
153+
154+ /**
155+ * Provisions certificate for a KVM host using an existing SSH connection.
156+ * Runs keystore-setup to generate a CSR, issues a certificate, then runs keystore-cert-import.
157+ * Used during host discovery and for forced re-provisioning when the NIO agent is unreachable.
158+ * @param sshConnection active SSH connection to the KVM host
159+ * @param agentIp IP address of the KVM host agent
160+ * @param agentHostname hostname of the KVM host agent
161+ * @param caProvider optional CA provider plugin name (null uses default)
162+ */
163+ void provisionCertificateViaSsh (Connection sshConnection , String agentIp , String agentHostname , String caProvider );
139164
140165 /**
141166 * Setups up a new keystore and generates CSR for a host
0 commit comments