|
| 1 | +.. _orchestrator-cli-cert-management: |
| 2 | + |
| 3 | +======================= |
| 4 | +Certificate Management |
| 5 | +======================= |
| 6 | + |
| 7 | +Introduction |
| 8 | +============ |
| 9 | + |
| 10 | +Cephadm `certmgr` acts as the Root Certificate Authority (CA) for all |
| 11 | +self-signed certificates generated by Cephadm. For services that require |
| 12 | +SSL, admins have the option to either bring their own certificate or allow |
| 13 | +Cephadm to generate a self-signed certificate. This ensures secure communication |
| 14 | +while offering flexibility for deployment preferences. |
| 15 | + |
| 16 | +Certificate Management Behavior |
| 17 | +=============================== |
| 18 | + |
| 19 | +Cephadm `certmgr` automatically detects whether a certificate is self-signed |
| 20 | +(generated by Cephadm) or user-provided. This distinction determines how it |
| 21 | +handles expirations and renewals: |
| 22 | + |
| 23 | +Self-Signed Certificates |
| 24 | +------------------------ |
| 25 | +- `certmgr` can fully automate renewal, ensuring seamless service operation. |
| 26 | +- Automation is controlled by configuration parameters defining certificate |
| 27 | + duration, renewal thresholds, and whether automated rotation is enabled. |
| 28 | + |
| 29 | +User-Provided Certificates |
| 30 | +-------------------------- |
| 31 | +- `certmgr` does not renew these automatically but continuously monitors |
| 32 | + their status. |
| 33 | +- If an issue is detected (e.g., expiration is approaching), it issues |
| 34 | + health warnings/errors `CEPHADM_CERT_ERROR` to alert administrators, |
| 35 | + who must manually replace the certificate. |
| 36 | + |
| 37 | +This proactive approach ensures secure and uninterrupted service operations |
| 38 | +while allowing users to manage certificate policies according to their needs. |
| 39 | + |
| 40 | + |
| 41 | +Configuration |
| 42 | +============= |
| 43 | + |
| 44 | +To manage certificate lifecycles, `certmgr` continuously monitors certificates |
| 45 | +and applies renewal policies based on the certificate type and configured |
| 46 | +parameters. Cephadm provides several configuration options to manage certificate |
| 47 | +lifecycle and renewal: |
| 48 | + |
| 49 | +- **`mgr/cephadm/certificate_automated_rotation_enabled`** (default: `True`): |
| 50 | + Enabled by default, this configuration option controls |
| 51 | + whether Cephadm automatically rotates certificates upon expiration. This helps |
| 52 | + ensure continuity and security without manual intervention. When disabled cephadm will |
| 53 | + still check periodically the certificates but instead of automatically renewing self-signed |
| 54 | + expired ones it will issue a health error/warning when an issue is detected. |
| 55 | + |
| 56 | +- **`mgr/cephadm/certificate_duration_days`** (default: `3 * 365`, min: `90`, max: `10 * |
| 57 | + 365`): Specifies the duration (in days) of self-signed certificates generated |
| 58 | + and signed by the Cephadm root CA. This determines the validity period before |
| 59 | + renewal is required. |
| 60 | + |
| 61 | +- **`mgr/cephadm/certificate_renewal_threshold_days`** (default: `30`, min: `10`, max: |
| 62 | + `90`): Defines the number of days before a certificate's expiration when |
| 63 | + Cephadm should initiate renewal. This ensures timely replacement before |
| 64 | + expiration occurs. This applies to both self-signed and user-provided |
| 65 | + certificates. In the case of user-provided certificates, Cephadm will issue a |
| 66 | + health error or warning alerting administrators about the upcoming renewal |
| 67 | + period proximity. |
| 68 | + |
| 69 | +- **`mgr/cephadm/certificate_check_period`** (default: `1`, min: `0`, max: `30`): |
| 70 | + Specifies how often (in days) the certificate should be checked for validity. |
| 71 | + This ensures timely detection of any issues related to certificate expiration. |
| 72 | + Setting this to `0` disables the certificate check functionality. |
| 73 | + |
| 74 | +Certificate Health Monitoring |
| 75 | +============================= |
| 76 | + |
| 77 | +Cephadm continuously monitors the status of managed certificates. If any |
| 78 | +certificate is found to be invalid or expired, Cephadm will issue a health error |
| 79 | +with the code `CEPHADM_CERT_ERROR`. Additionally, if a certificate is |
| 80 | +approaching its expiration date, Cephadm will generate a health warning. This |
| 81 | +proactive alerting mechanism helps administrators take timely action to renew or |
| 82 | +replace certificates before service disruptions occur. |
| 83 | + |
| 84 | + |
| 85 | +Known Certificates and Keys |
| 86 | +=========================== |
| 87 | + |
| 88 | +The `CertMgr` class maintains a list of known certificates and keys. These are |
| 89 | +automatically documented below: |
| 90 | + |
| 91 | +.. automodule:: mgr.cephadm.certmgr |
| 92 | + :members: known_certs, known_keys |
| 93 | + :undoc-members: |
| 94 | + :show-inheritance: |
| 95 | + |
| 96 | + |
| 97 | +Certificate Scopes |
| 98 | +================== |
| 99 | + |
| 100 | +Cephadm certmgr supports three different scopes for certificate management: |
| 101 | + |
| 102 | +1. **Global Scope:** |
| 103 | + - Certificates in this scope are shared across all service daemons, regardless of which host they are running on. |
| 104 | + - Example: `mgmt-gateway` certificate is a globally shared certificate used by all service daemons. |
| 105 | + |
| 106 | +2. **Per-Host Scope:** |
| 107 | + - Certificates are assigned per host, meaning each host has its own unique certificate. |
| 108 | + - When configuring a custom certificate, the user must specify the host for which the certificate applies. |
| 109 | + - Example: `grafana` service cerificates are configured at the host level and applies specifically to a single machine. |
| 110 | + |
| 111 | +3. **Per-Service Scope:** |
| 112 | + - Certificates are configured per service name, meaning each instance of a service can have its own certificate. |
| 113 | + - When specifying a custom certificate, the user must define the service to which it belongs. |
| 114 | + - Example: an `rgw` service certificate is assigned specifically and only to an RGW service |
| 115 | + |
| 116 | + |
| 117 | +Reloading Certificate Manager |
| 118 | +============================= |
| 119 | + |
| 120 | +Run the following command to reload the certificate manager configuration from the Monitors: |
| 121 | + |
| 122 | +.. prompt:: bash # |
| 123 | + |
| 124 | + ceph orch certmgr reload |
| 125 | + |
| 126 | +This command ensures that any changes made to certificate configurations are |
| 127 | +applied immediately without requiring a service restart. |
| 128 | + |
| 129 | +Listing Certificates |
| 130 | +==================== |
| 131 | + |
| 132 | +To list all available certificates managed by the orchestrator: |
| 133 | + |
| 134 | +.. prompt:: bash # |
| 135 | + |
| 136 | + ceph orch certmgr cert ls [--show-details] |
| 137 | + |
| 138 | +This command displays an overview of all certificates currently managed by |
| 139 | +cephadm. Using ``--show-details`` provides additional information, including issuing |
| 140 | +authorities and certificate extensions. |
| 141 | + |
| 142 | +Listing Entities |
| 143 | +================ |
| 144 | + |
| 145 | +To list all entities associated with certificates: |
| 146 | + |
| 147 | +.. prompt:: bash # |
| 148 | + |
| 149 | + ceph orch certmgr entity ls |
| 150 | + |
| 151 | +Entities represent services that utilize managed certificates. |
| 152 | + |
| 153 | +Checking Certificate Status |
| 154 | +=========================== |
| 155 | + |
| 156 | +To check the status and validity of a specific certificate: |
| 157 | + |
| 158 | +.. prompt:: bash # |
| 159 | + |
| 160 | + ceph orch certmgr cert check |
| 161 | + |
| 162 | +This command verifies the integrity and expiration status of all managed certificates. |
| 163 | + |
| 164 | +Listing Certificate Keys |
| 165 | +======================== |
| 166 | + |
| 167 | +To list all private keys associated with managed certificates: |
| 168 | + |
| 169 | +.. prompt:: bash # |
| 170 | + |
| 171 | + ceph orch certmgr key ls |
| 172 | + |
| 173 | +This command shows which keys are currently managed by cephadm. |
| 174 | + |
| 175 | +Retrieving a Certificate |
| 176 | +======================== |
| 177 | + |
| 178 | +To retrieve the content of a specific certificate: |
| 179 | + |
| 180 | +.. prompt:: bash # |
| 181 | + |
| 182 | + ceph orch certmgr cert get <certificate_name> [--service_name <value>] [--hostname <value>] [--no-exception-when-missing] |
| 183 | + |
| 184 | +Replace `<certificate-name>` with the actual certificate name from `ceph |
| 185 | +orch certmgr cert ls`. For certificates with host or service scope, include |
| 186 | +the `--hostname` or `--service_name` arguments as needed. |
| 187 | + |
| 188 | +Retrieving a Certificate Key |
| 189 | +============================ |
| 190 | + |
| 191 | +To retrieve the private key associated with a specific certificate: |
| 192 | + |
| 193 | +.. prompt:: bash # |
| 194 | + |
| 195 | + ceph orch certmgr key get <key_name> [--service_name <value>] [--hostname <value>] [--no-exception-when-missing] |
| 196 | + |
| 197 | +Replace `<key-name>` with the actual certificate name from `ceph |
| 198 | +orch certmgr key ls`. For certificates with host or service scope, include |
| 199 | +the `--hostname` or `--service_name` arguments as needed. |
| 200 | + |
| 201 | +Setting a Certificate-Key Pair |
| 202 | +============================== |
| 203 | + |
| 204 | +To associate a certificate with a private key: |
| 205 | + |
| 206 | +.. prompt:: bash # |
| 207 | + |
| 208 | + ceph orch certmgr cert-key set <entity> [--cert <value>] [--key <value>] [--service_name <value>] [--hostname <value>] [-i <cert-key-path>] [--force] |
| 209 | + |
| 210 | +Use this command to upload or replace an existing certificate/key pair |
| 211 | +for a certain service. Replace `<entity-name>` with the actual |
| 212 | +certificate name from `ceph orch certmgr entity ls`. The -i option |
| 213 | +can be used to specify a file containing a combined certificate and |
| 214 | +key in PEM format. This file should include both the certificate and |
| 215 | +private key concatenated together. |
| 216 | + |
| 217 | +Setting a Certificate |
| 218 | +===================== |
| 219 | + |
| 220 | +To update or set a new certificate: |
| 221 | + |
| 222 | +.. prompt:: bash # |
| 223 | + |
| 224 | + ceph orch certmgr cert set <certificate_name> [--cert <value>] [--service_name <value>] [--hostname <value>] [-i <cert-path>] |
| 225 | + |
| 226 | +Use this command to add or replace an existing certificate. |
| 227 | + |
| 228 | +Setting a Private Key |
| 229 | +===================== |
| 230 | + |
| 231 | +To update or set a new private key: |
| 232 | + |
| 233 | +.. prompt:: bash # |
| 234 | + |
| 235 | + ceph orch certmgr key set <key-name> [--key <value>] [--service_name <value>] [--hostname <value>] [-i <key-path>] |
| 236 | + |
| 237 | +This command allows administrators to provide new private keys for services. |
| 238 | + |
| 239 | +Removing a Certificate |
| 240 | +====================== |
| 241 | + |
| 242 | +To remove an existing certificate: |
| 243 | + |
| 244 | +.. prompt:: bash # |
| 245 | + |
| 246 | + ceph orch certmgr cert rm <certificate_name> [--service_name <value>] [--hostname <value>] |
| 247 | + |
| 248 | +**Note:** For certificates with host or service scope, use the `--service-name` or `--hostname` option to specify the target. |
| 249 | + |
| 250 | +``<certificate_name>`` must be a valid certificate name. Use ``ceph orch certmgr cert ls`` to list supported certificates. |
| 251 | + |
| 252 | +Removing a Private Key |
| 253 | +====================== |
| 254 | + |
| 255 | +To remove an existing private key: |
| 256 | + |
| 257 | +.. prompt:: bash # |
| 258 | + |
| 259 | + ceph orch certmgr key rm <key-name> [--service_name <value>] [--hostname <value>] |
| 260 | + |
| 261 | +**Note:** For keys with host or service scope, use the `--service-name` or `--hostname` option to specify the target. |
| 262 | + |
| 263 | +``<key_name>`` must be a valid key name. Use ``ceph orch certmgr key ls`` to list supported keys. |
| 264 | + |
| 265 | +Generating Certificates |
| 266 | +======================= |
| 267 | + |
| 268 | +To automatically generate a new certificate and key pair: |
| 269 | + |
| 270 | +.. prompt:: bash # |
| 271 | + |
| 272 | + cehp orch certmgr generate-certificates <module_name> |
| 273 | + |
| 274 | +This command provisions new certificates for specified Manager module. |
0 commit comments