blob: 8f7f0939ce9443d26e68142cd43a41ac475cd67d [file] [log] [blame]
Mohammed Nasercd30d442024-05-29 10:32:57 -04001============
2Certificates
3============
4
5Atmosphere simplifies all the management of your SSL certificates for all of
6your API endpoints by automatically issuing and renewing certificates for you
7using `cert-manager <https://cert-manager.io>`_.
8
9Types
10=====
11
12There are two different ways of issuing certificates. It can either issue
13individual certificates for each API endpoint or it can issue a wildcard
14certificate for all of your API endpoints.
15
16Individual Certificates
17-----------------------
18
19If you want to issue individual certificates for each API endpoint, you do not
20need to do anything. This is the default behavior of Atmosphere.
21
22Wildcard Certificate
23--------------------
24
25If you decide to use wildcard certificates, you can either let the certificate
26manager issue and renew the certificate for you or you can use an existing
27wildcard certificate.
28
29Automatically Issued
30~~~~~~~~~~~~~~~~~~~~
31
32If you want to issue a wildcard certificate for all of your API endpoints using
33the certificate manager, you can configure it by setting the the following variable
34in your inventory:
35
36.. code-block:: yaml
37
38 openstack_helm_ingress_wildcard_domain: cloud.atmosphere.dev
39
40This will issue a wildcard certificate for ``*.cloud.atmosphere.dev`` and all
41subdomains. The certificate manager will automatically renew the certificate
42before it expires.
43
44Existing Certificate
45~~~~~~~~~~~~~~~~~~~~
46
47If you want to use an existing wildcard certificate without relying on the
48certificate manager issuing and renewing the certificate, you can use the
49following steps:
50
511. 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
652. 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
723. 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
84Issuers
85=======
86
87In order to be able to automatically issue certificates, you need to configure
88an issuer. There are three different types of issuers that you can use with
89Atmosphere.
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
97ACME
98----
99
100Atmosphere uses the `ACME <https://tools.ietf.org/html/rfc8555>`_ protocol by
101default to request certificates from `LetsEncrypt <https://letsencrypt.org>`_.
102
103There are two different challenge types that can be used to verify ownership of
104the domain to issue the certificate using ACME. Regardless of the challenge
105type, you will need to configure an email address to be used for the ACME
106account.
107
108.. code-block:: yaml
109
110 cluster_issuer_type: acme
111 cluster_issuer_acme_email: user@example.com
112
113If you're running your own internal ACME server, you can configure Atmosphere to
114point 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
121If the ACME server is using certificates signed by a custom CA, you can add the
122following configuration to allow Atmosphere to trust the CA.
123
124.. code-block:: yaml
125
126 cluster_issuer_acme_private_ca: true
127
128HTTP-01 Challenge
129~~~~~~~~~~~~~~~~~
130
131This is configured to work out of the box if your APIs are publicly accessible
132since it uses an HTTP-01 challenge to verify ownership of the domain. You just
133need to configure an email address.
134
135DNS-01 Challenge
136~~~~~~~~~~~~~~~~
137
138Atmosphere uses the ``HTTP-01`` solver by default, which means that as long as
139your ACME server can reach your API, you don't need to do anything else.
140
141If your ACME server cannot reach your API, you will need to use the ``DNS-01``
142challenges which require you to configure your DNS provider.
143
Giovanni Tirloni43722d62024-09-06 13:18:17 -0300144Azure DNS
145*********
146
147To 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 Nasercd30d442024-05-29 10:32:57 -0400160RFC2136
161*******
162
163If you have a DNS server that supports RFC2136, you can use it to solve the DNS
164challenges 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
175Route53
176*******
177
178If you are using Route53 to host the DNS for your domains, you can use the
179following 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 Sutkaitisc3e9b232024-07-18 17:43:13 +0300195Cloudflare
196**********
197
198If you are using Cloudflare to host the DNS for your domains, you can use the
199following 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
207If Cloudflare's account name is different from ACME Issuer's email address
208then also set:
209
210.. code-block:: yaml
211
212 cluster_issuer_acme_cloudflare_email: my-cloudflare-acc@example.com
213
Mohammed Nasercd30d442024-05-29 10:32:57 -0400214GoDaddy
215*******
216
217If you're using GoDaddy for the DNS of your domain, you can use the following
218configuration 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 Sutkaitisc3e9b232024-07-18 17:43:13 +0300228.. 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 Nasercd30d442024-05-29 10:32:57 -0400234Infoblox
235********
236
237If you're using Infoblox for the DNS of your domain, you can use the following
238configuration 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
250Venafi
251------
252
253Venafi is a commercial certificate authority which can be used with Atmosphere
254to issue certificates. Regardless of the way that you authenticate to Venafi,
255you will need to configure the issuer.
256
257.. code-block:: yaml
258
259 cluster_issuer_type: venafi
Mohammed Naserd4af9662024-05-30 18:44:05 -0400260 cluster_issuer_venafi_ca: |
261 -----BEGIN CERTIFICATE-----
262 MIIDBjCCAe4CCQDQ3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC
263 VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x
264 ...
265 -----END CERTIFICATE-----
Mohammed Nasercd30d442024-05-29 10:32:57 -0400266 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 Naserd4af9662024-05-30 18:44:05 -0400275.. 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 Nasercd30d442024-05-29 10:32:57 -0400281Authentication
282~~~~~~~~~~~~~~
283
284There are two different ways to authenticate to Venafi to issue certificates,
285either using a username and password or using an access token. The username and
286password method is phased out in newer versions of Venafi, so it is recommended
287to use the access token method.
288
289Username and Password
290*********************
291
292If you are using a username and password to authenticate to Venafi, you can
293configure it with the following variables:
294
295.. code-block:: yaml
296
297 cluster_issuer_venafi_username: <USERNAME>
298 cluster_issuer_venafi_password: <PASSWORD>
299
300Access Token
301************
302
303If you are using an access token to authenticate to Venafi, you can configure it
304with the following variable:
305
306.. code-block:: yaml
307
308 cluster_issuer_venafi_access_token: <ACCESS_TOKEN>
309
310Certificate fields
311~~~~~~~~~~~~~~~~~~
312
313If your Venafi zone is strict about the fields that are required or their
314values, you can use the `cert-manager supported annotations <https://cert-manager.io/docs/usage/ingress/#supported-annotations>`_
315to configure the certificate values.
316
317In order to apply these annotations to all ingresses managed by Atmosphere, you
Oleksandr K.d49adf82024-07-29 15:54:24 +0200318can use the ``atmosphere_ingress_annotations`` variable in your inventory which will
319apply the annotations to all ingresses. ``ingress_global_annotations`` variable is
320deprecated.
Mohammed Nasercd30d442024-05-29 10:32:57 -0400321
322.. code-block:: yaml
323
Oleksandr K.d49adf82024-07-29 15:54:24 +0200324 atmosphere_ingress_annotations:
Mohammed Nasercd30d442024-05-29 10:32:57 -0400325 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
331Using Pre-existing CA
332---------------------
333
334If you have an existing CA that you'd like to use with Atmosphere, you can
335configure 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
359Self-signed Certificates
360------------------------
361
362If you are in an environment which does not have a trusted certificate authority
363and it does not have access to the internet to be able to use LetsEncrypt, you
364can 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.