This guide is for operators maintaining HTTPS on a public installation. The certificate manager discovers Worker, repository, and tenant storage hostnames, requests certificates through Certbot, and publishes them to HAProxy. Public hosting covers initial setup. Local HTTPS covers the separate development CA and rehearsal.
Operate the certificate lifecycle
The certificate_manager Ansible role is disabled by default. When enabled it:
- installs a pinned Certbot and the configured DNS provider plugin;
- discovers non-deleting organizations and active Worker routes from authenticated internal APIs, then maintains exact Worker hostnames plus each tenant’s R2 endpoint;
- discovers repository hostnames from the authenticated repository service and maintains one exact certificate per repository, retiring it after deletion;
- maintains explicitly configured platform certificates such as Access;
- reconciles desired certificates on a short timer and runs ordinary Certbot renewal twice daily;
- treats the unexpired Certbot lineage and its SAN coverage as authoritative: reconciliation does not contact the CA when an existing certificate covers every desired hostname, even if the cached requirements manifest changed;
- permits a certificate to retain removed Worker hostnames until a future necessary issuance or lineage retirement, while requesting issuance when a newly added hostname is not covered;
- publishes a renewed full chain and private key atomically, validates the full HAProxy configuration, and reloads HAProxy only after validation succeeds;
- restores the previously served bundle if validation or reload fails and keeps working certificates in place when identity, DNS, or the CA is unavailable;
- retires only publications recorded in its own manifest after an organization reaches the deleting state, then removes the corresponding Certbot lineage so deleted tenants are not renewed forever.
Disabling the role stops its timers but deliberately preserves Certbot state, private keys, and published bundles. Disabling automation is not certificate revocation and must not be used as an uninstall shortcut on live ingress.
The manager serializes reconciliation, explicit issuance, and renewal. Certbot
deploy hooks remain separate so a successful issuance can publish while the
parent operation owns that lock. Root-only state lives under
/var/lib/ermahgerd-certificates; the latest reconciliation result is
status.json, and detailed client logs live under
/var/log/ermahgerd-certificates.
requirements.json is an inventory record, not permission to replace a
certificate. If a published bundle is missing but its valid Certbot lineage
still covers the desired names, reconciliation republishes that lineage locally
without creating an ACME order.
For manual inspection on the ingress host:
sudo systemctl list-timers 'ermahgerd-certificates*'
sudo systemctl start ermahgerd-certificates.service
sudo /usr/local/sbin/ermahgerd-certificate-manager reconcile
sudo cat /var/lib/ermahgerd-certificates/status.jsonDo not run Certbot directly against the managed directories. The configured wrapper supplies the protected environment and the deploy hook performs safe publication.
Use the public single-node path
The latitude profile is the tested hosted path for ermahgerd.io. Public DNS
points the apex, portal names, *.workers, *.git, and *.r2 to the ingress address.
Those wildcard DNS records route arbitrarily nested names but do not imply
wildcard TLS certificates. The certificate manager requests exact names for
deployed Workers, repositories, and tenant R2 endpoints, so the authoritative DNS service does
not need an API token and the public CA can validate every order through
HTTP-01.
make up PROFILE=latitude
make status PROFILE=latitude
make test PROFILE=latitudeThe first run begins on HTTP, issues exact platform certificates, and switches public origins to HTTPS. Later Wrangler deployments and repository creations are discovered by certificate reconciliation. A newly introduced hostname can have a short issuance window before it accepts TLS; existing names remain served.
The reference DNS set is:
| Name | Type | Value |
|---|---|---|
@ |
A | ingress public IP |
access, api, console, status |
A | ingress public IP |
admin |
A | ingress public IP; routed only when public administration is enabled |
*.workers |
A | ingress public IP |
*.git |
A | ingress public IP |
*.r2 |
A | ingress public IP |
The Latitude profile publishes admin.ermahgerd.io only after trusted TLS is
active. HAProxy routes that exact hostname to the separate administrator service,
rate-limits sign-in attempts, and denies its internal, readiness, and metrics
paths. Its backing services are not public. Self-hosted operators can leave
admin_public_enabled false and use a private listener or VPN instead.
Configure another hosted TLS listener
The control-plane renderer supports haproxy_tls_port,
haproxy_tls_address, and haproxy_tls_certificate_dir in Ansible inventory.
TLS is disabled when the port is null. Enabling it requires existing PEM
certificate/key bundles and platform_external_scheme: https; public URL
generation also uses control_api_external_port and worker_base_domain.
HAProxy loads the bundles, requires a matching SNI certificate, enforces TLS 1.2 or newer, redirects plain HTTP, and preserves the public HTTPS scheme through Access to the Worker. An externally reachable listener, firewall rules, portal origins, and secure portal cookies require separate operator configuration. Changing the scheme alone does not enable TLS or provision certificates.
For environments where HTTP-01 cannot reach ingress, put a provider plugin and credentials in encrypted inventory and enable both the manager and listener. This Cloudflare DNS example shows the alternative shape; pin the plugin version selected for the deployment and store credentials in Ansible Vault or an external secret source:
worker_base_domain: workers.example.com
platform_external_scheme: https
control_api_external_port: 443
haproxy_tls_port: 443
haproxy_tls_address: 0.0.0.0
haproxy_tls_certificate_dir: /var/lib/ermahgerd-certificates/published
certificate_manager_enabled: true
certificate_manager_email: operations@example.com
certificate_manager_certbot_packages:
- certbot==5.8.0
- certbot-dns-cloudflare==<validated-version>
certificate_manager_dns_credentials: !vault |
<encrypted dns_cloudflare_api_token INI content>
certificate_manager_authenticator_args:
- --dns-cloudflare
- --dns-cloudflare-credentials
- /etc/ermahgerd/certbot-dns-credentials.ini
certificate_manager_platform_certificates:
access: [access.example.com]
landing: [example.com]
certificate_manager_reconcile_on_install: trueConverge first against the CA’s staging directory by overriding
certificate_manager_acme_server. Promote to the production directory only
after issuance, renewal, publication, traffic, and recovery checks succeed.
Provider credentials should be restricted to TXT changes in the platform’s
validation zone; they do not need general account or application privileges.
The role handles software installation, root-only provider credentials, organization discovery, issuance, renewal, and HAProxy publication. Inventory still owns public addresses, DNS records, portal origins, firewall policy, and whether the administrator portal is public or restricted to a VPN/private listener. Portal TLS termination supports the public landing, tenant console, status, Access, and explicitly enabled administrator origins. Administrative ingress remains an operator policy decision.
What remains before broader public hosting
The nested hostname scheme works with the exact-host certificates issued by
the current manager. If you choose wildcard certificates instead, each tenant
needs a name such as *.t-tenant.workers.example.com; a certificate for
*.workers.example.com cannot cover its nested Worker names. A customer name such as blog.customer.example
requires its own certificate and an authorized mapping to the tenant’s Worker.
A CNAME alone neither changes the browser’s requested hostname nor grants
permission to serve it.
The remaining gates before treating the reference installation as a broader multi-tenant service are:
- Expiry/renewal alerting and operational backup/recovery for protected certificate state.
- A private administrator listener and operational backup/recovery planning.
Customer hostnames
Tenants manage exact hostnames from Networking → Domains, also linked from each HTTP Worker’s header; see Custom domains for the DNS workflow. The control plane owns durable, organization-scoped claims and TXT verification. It checks every resolved A/AAAA address against the configured ingress addresses. Verified claims are globally unique; pending claims do not reserve someone else’s name.
Set custom_domains_enabled: true and custom_domain_addresses to the actual
ingress IP addresses in inventory. TLS must already be configured. Latitude
enables this with its persistent HTTPS state. Reserved administrator origins are
passed explicitly, including private administration hostnames.
The existing certificate manager discovers verified claims through its private API and requests one exact certificate per custom hostname using HTTP-01. It publishes through the normal validated HAProxy deploy hook, then acknowledges certificate coverage and expiry to the control plane before route activation. Each custom-host failure is isolated, with an hour before another issuance attempt. Certificate renewal and retirement use the same managed Certbot directories as platform certificates. Do not invoke a second unmanaged Certbot installation for customer domains.
Ingress preserves the requested hostname and selects the same tenant, Worker, version, metering, and Access backend as the platform address. Access verifies custom callback origins with the control plane and binds its one-time code to the browser state and originating hostname. Protected gateway traffic also requires the private ingress credential; client-supplied route headers are removed at public ingress.
The local certificate harness exercises private TXT verification, real HTTP-01
issuance and renewal, verified TLS, routing, protected application login, and
certificate retirement. Its temporary customer.test mappings and records are
removed afterwards. The console Playwright coverage checks setup, refresh-safe
selection, and deletion confirmation. Run these developer harnesses directly
from infra/ansible/ and apps/console/; they are intentionally not separate
root lifecycle commands. No public DNS is modified by these tests.
Public DNS-01 validation can be tested while the application remains private: the CA checks a public TXT record rather than contacting the application. See Let’s Encrypt challenge types and its staging environment. These are future public validation steps, not claims made by the local harness.
The local check uses Pebble, a test-only ACME server, with the role’s pinned upstream Certbot client. Pebble is deliberately ephemeral and does not reproduce public CA rate limits or every validation policy. Its DNS challenge server is a fixture, not a production authoritative DNS service. Passing locally is meaningful protocol and application evidence, not certification that the platform is ready for public multi-tenant hosting.
The current manager groups exact tenant names into bounded certificates. Public CA registered-domain and duplicate-certificate limits still affect how quickly many organizations and routes can be created. Use staging during development, pace production onboarding, monitor the CA’s current published limits, and revisit certificate grouping or issuer choice before high-volume signup. Do not encode a historical Let’s Encrypt number as a permanent platform quota.