SSL
Generating Wildcard SSL Certificate
Section titled “Generating Wildcard SSL Certificate”A wildcard certificate (*.example.com) will be the default.
To change this, see Changing SSL Certificate SANs. Note that an individual certificate for each container will not be generated due to Let’s Encrypts rate limit of 5 exact hostnames every 7 days.
Requirements
Section titled “Requirements”- A supported DNS provider (e.g. Cloudflare), you can find supported providers here along with their settings
- You will need to click on your provider and retrieve the
Code:at the top and the correctEnvironment Variable Names
- You will need to click on your provider and retrieve the
- A valid Top-Level Domain (TLD), such as
.comor.net, that Let’s Encrypt is able to issue certificates for - API keys for the DNS provider with the correct permissions
- If using Cloudflare, it needs
Zone.DNS:Editpermissions for the correct zone. This can be the same key for Cloudflare DDNS in this project
- If using Cloudflare, it needs
Configuration
Section titled “Configuration”Settings mentioned below should already exist in your inventory/group_vars/all/traefik.yml:
traefik_ssl_enabled: true # whether or not to generate a wildcard SSL certificatetraefik_ssl_dns_provider_zone: # the zone of the DNS provider (e.g. `example.com`, this will default to the `hms_docker_domain` if not modified)traefik_ssl_dns_provider_code: # the "Provider Code" of the DNS provider (e.g. `cloudflare`, found at link above)traefik_ssl_dns_provider_environment_vars: [ # the "Environment Variables", along with their values, of the DNS provider you're using (e.g. `"CF_DNS_API_TOKEN": "<token>"` if using `cloudflare`, found at link above) "ENVIRONMENT_VARIABLE_NAME": "ENVIRONMENT_VARIABLE_VALUE", ...]traefik_ssl_letsencrypt_email: # the email address to use for Let's Encrypttraefik_ssl_use_letsencrypt_staging_url: true # whether or not to use the Let's Encrypt staging URL for initial testing (`yes` or `no`) (default: `yes`)First Time Test
Section titled “First Time Test”For the first time generating a certificate, it is recommended to use the staging URL (by configuring above) so you do not encounter Rate-Limiting from Let’s Encrypt
The certificate will say it is invalid within a browser, but if you check the issuer, it should come from the “Staging” server, meaning it worked successfully and you then change this value to no to use the production server and get a valid certificate.
Changing SSL Certificate SANs
Section titled “Changing SSL Certificate SANs”To change/add the SANs (Subject Alternative Name) used for the certificate, in inventory/group_vars/all/traefik.yml modify the traefik_ssl_sans variable.
By default, it will generate a wildcard certificate for the domain set in hms_docker_domain.
Here’s an example of adding an additional *.dev.<domain> SAN to the certificate:
traefik_ssl_sans: [ '*.{{ hms_docker_domain }}', '*.dev.{{ hms_docker_domain }}']