Mohammed Naser | cd30d44 | 2024-05-29 10:32:57 -0400 | [diff] [blame] | 1 | ============ |
| 2 | Certificates |
| 3 | ============ |
| 4 | |
| 5 | Atmosphere simplifies all the management of your SSL certificates for all of |
| 6 | your API endpoints by automatically issuing and renewing certificates for you |
| 7 | using `cert-manager <https://cert-manager.io>`_. |
| 8 | |
| 9 | Types |
| 10 | ===== |
| 11 | |
| 12 | There are two different ways of issuing certificates. It can either issue |
| 13 | individual certificates for each API endpoint or it can issue a wildcard |
| 14 | certificate for all of your API endpoints. |
| 15 | |
| 16 | Individual Certificates |
| 17 | ----------------------- |
| 18 | |
| 19 | If you want to issue individual certificates for each API endpoint, you do not |
| 20 | need to do anything. This is the default behavior of Atmosphere. |
| 21 | |
| 22 | Wildcard Certificate |
| 23 | -------------------- |
| 24 | |
| 25 | If you decide to use wildcard certificates, you can either let the certificate |
| 26 | manager issue and renew the certificate for you or you can use an existing |
| 27 | wildcard certificate. |
| 28 | |
| 29 | Automatically Issued |
| 30 | ~~~~~~~~~~~~~~~~~~~~ |
| 31 | |
| 32 | If you want to issue a wildcard certificate for all of your API endpoints using |
| 33 | the certificate manager, you can configure it by setting the the following variable |
| 34 | in your inventory: |
| 35 | |
| 36 | .. code-block:: yaml |
| 37 | |
| 38 | openstack_helm_ingress_wildcard_domain: cloud.atmosphere.dev |
| 39 | |
| 40 | This will issue a wildcard certificate for ``*.cloud.atmosphere.dev`` and all |
| 41 | subdomains. The certificate manager will automatically renew the certificate |
| 42 | before it expires. |
| 43 | |
| 44 | Existing Certificate |
| 45 | ~~~~~~~~~~~~~~~~~~~~ |
| 46 | |
| 47 | If you want to use an existing wildcard certificate without relying on the |
| 48 | certificate manager issuing and renewing the certificate, you can use the |
| 49 | following steps: |
| 50 | |
| 51 | 1. Create a Kubernetes TLS secret using your wildcard certificate, you can refer |
| 52 | to the `Kubernetes documentation <https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets>`_ |
| 53 | for more details. |
| 54 | |
| 55 | .. code-block:: shell |
| 56 | |
| 57 | kubectl -n openstack create secret tls wildcard-certs --key=/path/to/tls.key --cert=/path/to/tls.crt |
| 58 | |
| 59 | .. note:: |
| 60 | |
| 61 | If you have a certificate that needs to be combined with an intermediate |
| 62 | certificate, you can combine them all to a single file with the certificate |
| 63 | first, followed by the intermediate certificate, followed by the root. |
| 64 | |
| 65 | 2. Update the ``openstack_helm_ingress_secret_name`` to point towards the name |
| 66 | of the secret you created in step 1. |
| 67 | |
| 68 | .. code-block:: yaml |
| 69 | |
| 70 | openstack_helm_ingress_secret_name: wildcard-certs |
| 71 | |
| 72 | 3. Set ``cluster_issuer_type`` to ``none``, this is required for other roles |
| 73 | like for example Horizon. |
| 74 | |
| 75 | .. code-block:: yaml |
| 76 | |
| 77 | cluster_issuer_type: none |
| 78 | |
| 79 | .. warning:: |
| 80 | |
| 81 | If you decide to use an existing wildcard certificate, you will need to |
| 82 | manually renew the certificate before it expires. |
| 83 | |
| 84 | Issuers |
| 85 | ======= |
| 86 | |
| 87 | In order to be able to automatically issue certificates, you need to configure |
| 88 | an issuer. There are three different types of issuers that you can use with |
| 89 | Atmosphere. |
| 90 | |
| 91 | .. note:: |
| 92 | |
| 93 | If you decide to change the certificate issuer after deployment, you will |
| 94 | need to delete the existing certificate secret in order for the new issuer |
| 95 | to be able to issue a new certificate. |
| 96 | |
| 97 | ACME |
| 98 | ---- |
| 99 | |
| 100 | Atmosphere uses the `ACME <https://tools.ietf.org/html/rfc8555>`_ protocol by |
| 101 | default to request certificates from `LetsEncrypt <https://letsencrypt.org>`_. |
| 102 | |
| 103 | There are two different challenge types that can be used to verify ownership of |
| 104 | the domain to issue the certificate using ACME. Regardless of the challenge |
| 105 | type, you will need to configure an email address to be used for the ACME |
| 106 | account. |
| 107 | |
| 108 | .. code-block:: yaml |
| 109 | |
| 110 | cluster_issuer_type: acme |
| 111 | cluster_issuer_acme_email: user@example.com |
| 112 | |
| 113 | If you're running your own internal ACME server, you can configure Atmosphere to |
| 114 | point towards it by setting the ``cluster_issuer_acme_server`` variable. |
| 115 | |
| 116 | .. code-block:: yaml |
| 117 | |
| 118 | cluster_issuer_acme_server: https://acme.example.com |
| 119 | cluster_issuer_acme_email: user@example.com |
| 120 | |
| 121 | If the ACME server is using certificates signed by a custom CA, you can add the |
| 122 | following configuration to allow Atmosphere to trust the CA. |
| 123 | |
| 124 | .. code-block:: yaml |
| 125 | |
| 126 | cluster_issuer_acme_private_ca: true |
| 127 | |
| 128 | HTTP-01 Challenge |
| 129 | ~~~~~~~~~~~~~~~~~ |
| 130 | |
| 131 | This is configured to work out of the box if your APIs are publicly accessible |
| 132 | since it uses an HTTP-01 challenge to verify ownership of the domain. You just |
| 133 | need to configure an email address. |
| 134 | |
| 135 | DNS-01 Challenge |
| 136 | ~~~~~~~~~~~~~~~~ |
| 137 | |
| 138 | Atmosphere uses the ``HTTP-01`` solver by default, which means that as long as |
| 139 | your ACME server can reach your API, you don't need to do anything else. |
| 140 | |
| 141 | If your ACME server cannot reach your API, you will need to use the ``DNS-01`` |
| 142 | challenges which require you to configure your DNS provider. |
| 143 | |
Giovanni Tirloni | 43722d6 | 2024-09-06 13:18:17 -0300 | [diff] [blame] | 144 | Azure DNS |
| 145 | ********* |
| 146 | |
| 147 | To configure cert-manager with Azure DNS, create a `Service Principal |
| 148 | <https://cert-manager.io/docs/configuration/acme/dns01/azuredns/#service-principal>`_ and set the following variables: |
| 149 | |
| 150 | .. code-block:: yaml |
| 151 | |
| 152 | cluster_issuer_acme_solver: azuredns |
| 153 | cluster_issuer_acme_azuredns_client_id: <CLIENT_ID> |
| 154 | cluster_issuer_acme_azuredns_client_secret: <CLIENT_SECRET> |
| 155 | cluster_issuer_acme_azuredns_subscription_id: <SUBSCRIPTION_ID> |
| 156 | cluster_issuer_acme_azuredns_tenant_id: <TENANT_ID> |
| 157 | cluster_issuer_acme_azuredns_resourcegroup_name: <RESOURCEGROUP_NAME> |
| 158 | cluster_issuer_acme_azuredns_hostedzone_name: <HOSTEDZONE_NAME> |
| 159 | |
Mohammed Naser | cd30d44 | 2024-05-29 10:32:57 -0400 | [diff] [blame] | 160 | RFC2136 |
| 161 | ******* |
| 162 | |
| 163 | If you have a DNS server that supports RFC2136, you can use it to solve the DNS |
| 164 | challenges with the following configuration: |
| 165 | |
| 166 | .. code-block:: yaml |
| 167 | |
| 168 | cluster_issuer_acme_email: user@example.com |
| 169 | cluster_issuer_acme_solver: rfc2136 |
| 170 | cluster_issuer_acme_rfc2136_nameserver: <NAMESERVER>:<PORT> |
| 171 | cluster_issuer_acme_rfc2136_tsig_algorithm: <ALGORITHM> |
| 172 | cluster_issuer_acme_rfc2136_tsig_key_name: <KEY_NAME> |
| 173 | cluster_issuer_acme_rfc2136_tsig_secret_key: <SECRET_KEY> |
| 174 | |
| 175 | Route53 |
| 176 | ******* |
| 177 | |
| 178 | If you are using Route53 to host the DNS for your domains, you can use the |
| 179 | following configuration: |
| 180 | |
| 181 | .. code-block:: yaml |
| 182 | |
| 183 | cluster_issuer_acme_email: user@example.com |
| 184 | cluster_issuer_acme_solver: route53 |
| 185 | cluster_issuer_acme_route53_region: <REGION> |
| 186 | cluster_issuer_acme_route53_hosted_zone_id: <HOSTED_ZONE_ID> |
| 187 | cluster_issuer_acme_route53_access_key_id: <AWS_ACCESS_KEY_ID> |
| 188 | cluster_issuer_acme_route53_secret_access_key: <AWS_SECRET_ACCESS_KEY> |
| 189 | |
| 190 | .. note:: |
| 191 | |
| 192 | You'll need to make sure that your AWS credentials have the correct |
| 193 | permissions to update the Route53 zone. |
| 194 | |
Tadas Sutkaitis | c3e9b23 | 2024-07-18 17:43:13 +0300 | [diff] [blame] | 195 | Cloudflare |
| 196 | ********** |
| 197 | |
| 198 | If you are using Cloudflare to host the DNS for your domains, you can use the |
| 199 | following configuration: |
| 200 | |
| 201 | .. code-block:: yaml |
| 202 | |
| 203 | cluster_issuer_acme_email: user@example.com |
| 204 | cluster_issuer_acme_solver: cloudflare |
| 205 | cluster_issuer_acme_cloudflare_api_token: <CLOUDFLARE_API_TOKEN> |
| 206 | |
| 207 | If Cloudflare's account name is different from ACME Issuer's email address |
| 208 | then also set: |
| 209 | |
| 210 | .. code-block:: yaml |
| 211 | |
| 212 | cluster_issuer_acme_cloudflare_email: my-cloudflare-acc@example.com |
| 213 | |
Mohammed Naser | cd30d44 | 2024-05-29 10:32:57 -0400 | [diff] [blame] | 214 | GoDaddy |
| 215 | ******* |
| 216 | |
| 217 | If you're using GoDaddy for the DNS of your domain, you can use the following |
| 218 | configuration which depends on |
| 219 | `cert-manager-webhook-godaddy <https://github.com/snowdrop/godaddy-webhook>`_. |
| 220 | |
| 221 | .. code-block:: yaml |
| 222 | |
| 223 | cluster_issuer_acme_email: user@example.com |
| 224 | cluster_issuer_acme_solver: godaddy |
| 225 | cluster_issuer_acme_godaddy_api_key: <GODADDY_API_KEY> |
| 226 | cluster_issuer_acme_godaddy_secret_key: <GODADDY_SECRET_KEY> |
| 227 | |
Tadas Sutkaitis | c3e9b23 | 2024-07-18 17:43:13 +0300 | [diff] [blame] | 228 | .. note:: |
| 229 | |
| 230 | GoDaddy DNS API has some limitations. To use it you need: |
| 231 | - Accounts with 10 or more domains |
| 232 | - Accounts with a Discount Domain Club subscription |
| 233 | |
Mohammed Naser | cd30d44 | 2024-05-29 10:32:57 -0400 | [diff] [blame] | 234 | Infoblox |
| 235 | ******** |
| 236 | |
| 237 | If you're using Infoblox for the DNS of your domain, you can use the following |
| 238 | configuration which depends on |
| 239 | `cert-manager-webhook-infoblox-wapi <https://github.com/luisico/cert-manager-webhook-infoblox-wapi>`_. |
| 240 | |
| 241 | .. code-block:: yaml |
| 242 | |
| 243 | cluster_issuer_acme_email: user@example.com |
| 244 | cluster_issuer_acme_solver: infoblox |
| 245 | cluster_issuer_acme_infoblox_view: <VIEW> |
| 246 | cluster_issuer_acme_infoblox_host: <HOST> |
| 247 | cluster_issuer_acme_infoblox_username: <USERNAME> |
| 248 | cluster_issuer_acme_infoblox_password: <PASSWORD> |
| 249 | |
| 250 | Venafi |
| 251 | ------ |
| 252 | |
| 253 | Venafi is a commercial certificate authority which can be used with Atmosphere |
| 254 | to issue certificates. Regardless of the way that you authenticate to Venafi, |
| 255 | you will need to configure the issuer. |
| 256 | |
| 257 | .. code-block:: yaml |
| 258 | |
| 259 | cluster_issuer_type: venafi |
Mohammed Naser | d4af966 | 2024-05-30 18:44:05 -0400 | [diff] [blame] | 260 | cluster_issuer_venafi_ca: | |
| 261 | -----BEGIN CERTIFICATE----- |
| 262 | MIIDBjCCAe4CCQDQ3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC |
| 263 | VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x |
| 264 | ... |
| 265 | -----END CERTIFICATE----- |
Mohammed Naser | cd30d44 | 2024-05-29 10:32:57 -0400 | [diff] [blame] | 266 | cluster_issuer_venafi_zone: <ZONE> |
| 267 | cluster_issuer_venafi_tpp_url: <URL> |
| 268 | cluster_issuer_venafi_tpp_ca_bundle: | |
| 269 | -----BEGIN CERTIFICATE----- |
| 270 | MIIDBjCCAe4CCQDQ3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC |
| 271 | VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x |
| 272 | ... |
| 273 | -----END CERTIFICATE----- |
| 274 | |
Mohammed Naser | d4af966 | 2024-05-30 18:44:05 -0400 | [diff] [blame] | 275 | .. note:: |
| 276 | |
| 277 | If your issuer is an intermediate certificate, you will need to ensure that |
| 278 | the ``certificate`` key includes the full chain in the correct order of issuer, |
| 279 | intermediate(s), then root. |
| 280 | |
Mohammed Naser | cd30d44 | 2024-05-29 10:32:57 -0400 | [diff] [blame] | 281 | Authentication |
| 282 | ~~~~~~~~~~~~~~ |
| 283 | |
| 284 | There are two different ways to authenticate to Venafi to issue certificates, |
| 285 | either using a username and password or using an access token. The username and |
| 286 | password method is phased out in newer versions of Venafi, so it is recommended |
| 287 | to use the access token method. |
| 288 | |
| 289 | Username and Password |
| 290 | ********************* |
| 291 | |
| 292 | If you are using a username and password to authenticate to Venafi, you can |
| 293 | configure it with the following variables: |
| 294 | |
| 295 | .. code-block:: yaml |
| 296 | |
| 297 | cluster_issuer_venafi_username: <USERNAME> |
| 298 | cluster_issuer_venafi_password: <PASSWORD> |
| 299 | |
| 300 | Access Token |
| 301 | ************ |
| 302 | |
| 303 | If you are using an access token to authenticate to Venafi, you can configure it |
| 304 | with the following variable: |
| 305 | |
| 306 | .. code-block:: yaml |
| 307 | |
| 308 | cluster_issuer_venafi_access_token: <ACCESS_TOKEN> |
| 309 | |
| 310 | Certificate fields |
| 311 | ~~~~~~~~~~~~~~~~~~ |
| 312 | |
| 313 | If your Venafi zone is strict about the fields that are required or their |
| 314 | values, you can use the `cert-manager supported annotations <https://cert-manager.io/docs/usage/ingress/#supported-annotations>`_ |
| 315 | to configure the certificate values. |
| 316 | |
| 317 | In order to apply these annotations to all ingresses managed by Atmosphere, you |
Oleksandr K. | d49adf8 | 2024-07-29 15:54:24 +0200 | [diff] [blame] | 318 | can use the ``atmosphere_ingress_annotations`` variable in your inventory which will |
| 319 | apply the annotations to all ingresses. ``ingress_global_annotations`` variable is |
| 320 | deprecated. |
Mohammed Naser | cd30d44 | 2024-05-29 10:32:57 -0400 | [diff] [blame] | 321 | |
| 322 | .. code-block:: yaml |
| 323 | |
Oleksandr K. | d49adf8 | 2024-07-29 15:54:24 +0200 | [diff] [blame] | 324 | atmosphere_ingress_annotations: |
Mohammed Naser | cd30d44 | 2024-05-29 10:32:57 -0400 | [diff] [blame] | 325 | cert-manager.io/subject-organizations: VEXXHOST, Inc. |
| 326 | cert-manager.io/subject-organizationalunits: Cloud Infrastructure |
| 327 | cert-manager.io/subject-localities: Montreal |
| 328 | cert-manager.io/subject-provinces: Quebec |
| 329 | cert-manager.io/subject-countries: CA |
| 330 | |
| 331 | Using Pre-existing CA |
| 332 | --------------------- |
| 333 | |
| 334 | If you have an existing CA that you'd like to use with Atmosphere, you can |
| 335 | configure it by including the certificate and private key: |
| 336 | |
| 337 | .. code-block:: yaml |
| 338 | |
| 339 | cluster_issuer_type: ca |
| 340 | cluster_issuer_ca_certificate: | |
| 341 | -----BEGIN CERTIFICATE----- |
| 342 | MIIDBjCCAe4CCQDQ3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC |
| 343 | VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x |
| 344 | ... |
| 345 | -----END CERTIFICATE----- |
| 346 | cluster_issuer_ca_private_key: | |
| 347 | -----BEGIN RSA PRIVATE KEY----- |
| 348 | MIIEpAIBAAKCAQEAw3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC |
| 349 | VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x |
| 350 | ... |
| 351 | -----END RSA PRIVATE KEY----- |
| 352 | |
| 353 | .. note:: |
| 354 | |
| 355 | If your issuer is an intermediate certificate, you will need to ensure that |
| 356 | the ``certificate`` key includes the full chain in the correct order of issuer, |
| 357 | intermediate(s), then root. |
| 358 | |
| 359 | Self-signed Certificates |
| 360 | ------------------------ |
| 361 | |
| 362 | If you are in an environment which does not have a trusted certificate authority |
| 363 | and it does not have access to the internet to be able to use LetsEncrypt, you |
| 364 | can use self-signed certificates by adding the following to your inventory: |
| 365 | |
| 366 | .. code-block:: yaml |
| 367 | |
| 368 | cluster_issuer_type: self-signed |
| 369 | |
| 370 | .. warning:: |
| 371 | |
| 372 | Self-signed certificates are not recommended for production environments. |
| 373 | They are only recommended for development and testing environments. |