blob: 2e04abbafe92aaa46614aac950c7a7bb9e90d138 [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
144RFC2136
145*******
146
147If you have a DNS server that supports RFC2136, you can use it to solve the DNS
148challenges with the following configuration:
149
150.. code-block:: yaml
151
152 cluster_issuer_acme_email: user@example.com
153 cluster_issuer_acme_solver: rfc2136
154 cluster_issuer_acme_rfc2136_nameserver: <NAMESERVER>:<PORT>
155 cluster_issuer_acme_rfc2136_tsig_algorithm: <ALGORITHM>
156 cluster_issuer_acme_rfc2136_tsig_key_name: <KEY_NAME>
157 cluster_issuer_acme_rfc2136_tsig_secret_key: <SECRET_KEY>
158
159Route53
160*******
161
162If you are using Route53 to host the DNS for your domains, you can use the
163following configuration:
164
165.. code-block:: yaml
166
167 cluster_issuer_acme_email: user@example.com
168 cluster_issuer_acme_solver: route53
169 cluster_issuer_acme_route53_region: <REGION>
170 cluster_issuer_acme_route53_hosted_zone_id: <HOSTED_ZONE_ID>
171 cluster_issuer_acme_route53_access_key_id: <AWS_ACCESS_KEY_ID>
172 cluster_issuer_acme_route53_secret_access_key: <AWS_SECRET_ACCESS_KEY>
173
174.. note::
175
176 You'll need to make sure that your AWS credentials have the correct
177 permissions to update the Route53 zone.
178
vexxhost-bot9b4caa42024-07-19 02:17:57 +0200179Cloudflare
180**********
181
182If you are using Cloudflare to host the DNS for your domains, you can use the
183following configuration:
184
185.. code-block:: yaml
186
187 cluster_issuer_acme_email: user@example.com
188 cluster_issuer_acme_solver: cloudflare
189 cluster_issuer_acme_cloudflare_api_token: <CLOUDFLARE_API_TOKEN>
190
191If Cloudflare's account name is different from ACME Issuer's email address
192then also set:
193
194.. code-block:: yaml
195
196 cluster_issuer_acme_cloudflare_email: my-cloudflare-acc@example.com
197
Mohammed Nasercd30d442024-05-29 10:32:57 -0400198GoDaddy
199*******
200
201If you're using GoDaddy for the DNS of your domain, you can use the following
202configuration which depends on
203`cert-manager-webhook-godaddy <https://github.com/snowdrop/godaddy-webhook>`_.
204
205.. code-block:: yaml
206
207 cluster_issuer_acme_email: user@example.com
208 cluster_issuer_acme_solver: godaddy
209 cluster_issuer_acme_godaddy_api_key: <GODADDY_API_KEY>
210 cluster_issuer_acme_godaddy_secret_key: <GODADDY_SECRET_KEY>
211
vexxhost-bot9b4caa42024-07-19 02:17:57 +0200212.. note::
213
214 GoDaddy DNS API has some limitations. To use it you need:
215 - Accounts with 10 or more domains
216 - Accounts with a Discount Domain Club subscription
217
Mohammed Nasercd30d442024-05-29 10:32:57 -0400218Infoblox
219********
220
221If you're using Infoblox for the DNS of your domain, you can use the following
222configuration which depends on
223`cert-manager-webhook-infoblox-wapi <https://github.com/luisico/cert-manager-webhook-infoblox-wapi>`_.
224
225.. code-block:: yaml
226
227 cluster_issuer_acme_email: user@example.com
228 cluster_issuer_acme_solver: infoblox
229 cluster_issuer_acme_infoblox_view: <VIEW>
230 cluster_issuer_acme_infoblox_host: <HOST>
231 cluster_issuer_acme_infoblox_username: <USERNAME>
232 cluster_issuer_acme_infoblox_password: <PASSWORD>
233
234Venafi
235------
236
237Venafi is a commercial certificate authority which can be used with Atmosphere
238to issue certificates. Regardless of the way that you authenticate to Venafi,
239you will need to configure the issuer.
240
241.. code-block:: yaml
242
243 cluster_issuer_type: venafi
Mohammed Naserd4af9662024-05-30 18:44:05 -0400244 cluster_issuer_venafi_ca: |
245 -----BEGIN CERTIFICATE-----
246 MIIDBjCCAe4CCQDQ3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC
247 VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x
248 ...
249 -----END CERTIFICATE-----
Mohammed Nasercd30d442024-05-29 10:32:57 -0400250 cluster_issuer_venafi_zone: <ZONE>
251 cluster_issuer_venafi_tpp_url: <URL>
252 cluster_issuer_venafi_tpp_ca_bundle: |
253 -----BEGIN CERTIFICATE-----
254 MIIDBjCCAe4CCQDQ3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC
255 VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x
256 ...
257 -----END CERTIFICATE-----
258
Mohammed Naserd4af9662024-05-30 18:44:05 -0400259.. note::
260
261 If your issuer is an intermediate certificate, you will need to ensure that
262 the ``certificate`` key includes the full chain in the correct order of issuer,
263 intermediate(s), then root.
264
Mohammed Nasercd30d442024-05-29 10:32:57 -0400265Authentication
266~~~~~~~~~~~~~~
267
268There are two different ways to authenticate to Venafi to issue certificates,
269either using a username and password or using an access token. The username and
270password method is phased out in newer versions of Venafi, so it is recommended
271to use the access token method.
272
273Username and Password
274*********************
275
276If you are using a username and password to authenticate to Venafi, you can
277configure it with the following variables:
278
279.. code-block:: yaml
280
281 cluster_issuer_venafi_username: <USERNAME>
282 cluster_issuer_venafi_password: <PASSWORD>
283
284Access Token
285************
286
287If you are using an access token to authenticate to Venafi, you can configure it
288with the following variable:
289
290.. code-block:: yaml
291
292 cluster_issuer_venafi_access_token: <ACCESS_TOKEN>
293
294Certificate fields
295~~~~~~~~~~~~~~~~~~
296
297If your Venafi zone is strict about the fields that are required or their
298values, you can use the `cert-manager supported annotations <https://cert-manager.io/docs/usage/ingress/#supported-annotations>`_
299to configure the certificate values.
300
301In order to apply these annotations to all ingresses managed by Atmosphere, you
Oleksandr K.80943392024-07-29 21:10:10 +0200302can use the ``atmosphere_ingress_annotations`` variable in your inventory which will
303apply the annotations to all ingresses. ``ingress_global_annotations`` variable is
304deprecated.
Mohammed Nasercd30d442024-05-29 10:32:57 -0400305
306.. code-block:: yaml
307
Oleksandr K.80943392024-07-29 21:10:10 +0200308 atmosphere_ingress_annotations:
Mohammed Nasercd30d442024-05-29 10:32:57 -0400309 cert-manager.io/subject-organizations: VEXXHOST, Inc.
310 cert-manager.io/subject-organizationalunits: Cloud Infrastructure
311 cert-manager.io/subject-localities: Montreal
312 cert-manager.io/subject-provinces: Quebec
313 cert-manager.io/subject-countries: CA
314
315Using Pre-existing CA
316---------------------
317
318If you have an existing CA that you'd like to use with Atmosphere, you can
319configure it by including the certificate and private key:
320
321.. code-block:: yaml
322
323 cluster_issuer_type: ca
324 cluster_issuer_ca_certificate: |
325 -----BEGIN CERTIFICATE-----
326 MIIDBjCCAe4CCQDQ3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC
327 VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x
328 ...
329 -----END CERTIFICATE-----
330 cluster_issuer_ca_private_key: |
331 -----BEGIN RSA PRIVATE KEY-----
332 MIIEpAIBAAKCAQEAw3Z0Z2Z0Z0jANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC
333 VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28x
334 ...
335 -----END RSA PRIVATE KEY-----
336
337.. note::
338
339 If your issuer is an intermediate certificate, you will need to ensure that
340 the ``certificate`` key includes the full chain in the correct order of issuer,
341 intermediate(s), then root.
342
343Self-signed Certificates
344------------------------
345
346If you are in an environment which does not have a trusted certificate authority
347and it does not have access to the internet to be able to use LetsEncrypt, you
348can use self-signed certificates by adding the following to your inventory:
349
350.. code-block:: yaml
351
352 cluster_issuer_type: self-signed
353
354.. warning::
355
356 Self-signed certificates are not recommended for production environments.
357 They are only recommended for development and testing environments.