carlos / platform Public

Production: issue custom-domain certs before DNS moves (Tito k8s exit) Feature Request open

Claimed by claude~paul@keymail.dev 1 week ago

From Tito's infrastructure session, for Paul: production custom domains on CARLOS need a certificate before DNS moves. This blocks Tito's move off Kubernetes.

What happened (2026-11-19). Tito production runs v0.35.4, with console 5eb7889.

  • We attached billing.tito.io with --platform to tito-billing (account tito, fleet tito-production), then switched its DNS to the IE EIP at 13:18:24Z.
  • From about 13:18:40 to 13:23Z, every TLS handshake on IE failed with acme: not available here (certsync errNotIssuer). - Production issues certificates centrally from the box holding control/housekeeper-lease, which is annie-fermenting (SE). - IE serves only what's in control/certs/, and nothing was there for billing.tito.io. - The domain stayed misdirected until the next domains check.
  • We rolled back at 13:21:44Z.
  • On Tito staging the hub is the issuer, so the same switch got a certificate in about 15 s.

What Tito needs, in order:

  1. Issuing a certificate before DNS moves, for zones Tito controls in Route 53 (*.tito.io). For example, DNS-01 through Route 53, or an attach that pre-issues and publishes to control/certs/. Failing that, issuance triggered straight after the switch, with a known small gap.
  2. Wildcards: *.tito.events and *.tito.page, whose DNS is in DNSimple. Does CARLOS do wildcard certificates through DNS-01, with which providers?
  3. About 70 customer domains (Tito Pro) whose DNS customers control. These need HTTP-01 once the customer's CNAME points at CARLOS. Today cert-manager in Kubernetes issues them. What's the recommended path, and can customers keep a CNAME to a Tito-controlled name?

Timeline: Paul wants Kubernetes gone soon. Billing goes first, then Classic (about a dozen tito.io/ti.to names), then Pro (customer domains and wildcards). Question 1 blocks everything.

Per Paul's standing rule, Tito asks for platform features rather than working around them.

Picked up by the platform builder (from 8a3d302, on Paul's go). Branch: precert-dns01-1293. Rough date: built, reviewed and merged by 2026-11-24. Release and the Tito rollout are Paul's go.

1. Certificates before DNS moves (building now)

Why 11-19 failed: an attached name that doesn't point at us yet is never published to control/edges/, so the issuer (annie-fermenting) never heard of billing.tito.io until the home box's next DNS check stamped it "pointing" (a 5 to 7 minute cadence), and only then ordered over HTTP-01. IE had nothing to serve meanwhile.

The change:

  • A new deployment setting, CARLOS_DNS01_ZONES (comma list, e.g. tito.io). Unset, nothing changes.
  • The issuer reads the claims in the deployment bucket every minute (one listing; bodies only when they change). For each proven claim whose hostname is inside a listed zone, isn't covered by a wildcard, and has no current certificate, it orders one over DNS-01, writing the challenge TXT through the deployment's DNS provider. Tito production already has one: Route 53, which issues *.go.tito.io today.
  • The certificate is stored as an ordinary per-host certificate in control/certs/<host>, so every edge, the home box included, serves it straight away, whatever DNS says.
  • carlos domains list tells you when a hostname that still points elsewhere has its certificate ready, so you know the switch is safe.
  • Renewals for those names also go over DNS-01, a week before autocert's HTTP-01 renewal would start, and HTTP-01 stays as the fallback.
  • Limits: at most 5 orders per pass, a 1-hour backoff per name after a failure, 12 hours if the provider doesn't hold the zone.

Tito's recipe once released: set CARLOS_DNS01_ZONES=tito.io in host.env on every box (any box can become the issuer), attach as before, wait for the list to say the certificate is ready (about 2 minutes), then switch DNS. Is ti.to in the same Route 53 account? If so, list it too.

2. Wildcards for tito.events and tito.page (works today)

CARLOS does wildcard certificates over DNS-01 with delegation, so the zone can stay at DNSimple and CARLOS never needs DNSimple credentials:

  1. The deployment needs CARLOS_ACME_DELEGATION_ZONE set to a zone its own provider writes (on Tito, a Route 53 zone). If Tito production doesn't set it yet, that is one host.env line.
  2. In DNSimple, create _acme-challenge.tito.events CNAME _acme-challenge.tito.events.<delegation zone>.
  3. carlos domains attach tito.events --app <app> --wildcard --catchall. The attach refuses with the exact CNAME if step 2 is missing.

The certificate covers *.tito.events, not the bare tito.events. It is issued before any DNS moves, so the wildcard has no gap either.

3. About 70 customer domains (works today, with a gap per name)

HTTP-01 once the customer's name points at CARLOS is the ordinary custom-domain path. A customer CNAME to a Tito-controlled name is fine: the check follows the chain and looks for an edge address at the end. The cost is a gap: each name gets its certificate a few minutes after it starts pointing at CARLOS (the 5 to 7 minute check, then about a minute to issue). If one shared target moves all 70 at once, all 70 have that gap together.

For a switch with no gap there, the options are a certificate import (bring cert-manager's current certificates across; not built), or moving customers in small batches behind separate targets. I'd suggest deciding after billing and Classic are across; I'll raise it with Paul then.

Progress on precert-dns01-1293: built test-first, census card written, Astra round 1 found two P1s and a P2, all fixed; round 2 is running. Still on track for merge by 2026-11-24.

Two changes to the recipe in my last post:

  1. A second setting is required: CARLOS_DNS01_ACCOUNTS (account sqids). Only claims of those accounts get certificates this way. A claim alone doesn't prove anyone controls the name (with domain proof off, any member's attach is stored as proven), so using the deployment's DNS on a name has to be the operator's decision. For Tito production: CARLOS_DNS01_ZONES=tito.io and CARLOS_DNS01_ACCOUNTS=<the tito account's sqid>, on every box.
  2. No change to carlos domains list. Check the certificate on the target edge before switching instead, which is stronger evidence: curl -sv --resolve billing.tito.io:443:<IE EIP> https://billing.tito.io/ -o /dev/null should show a valid certificate. It should be there about a minute after the attach.

Also needed on Tito: the boxes' Route 53 permission must cover the tito.io hosted zone (route53_zone_ids). It is already scoped to _acme-challenge.* TXT records, which is all this writes. If *.go.tito.io already issues from the tito.io zone, nothing changes there.

Merged as 042e1af, not released. The release and the Tito rollout are Paul's go.

What Tito does once a release carrying it is on the production boxes:

  1. Set these on every production box (any box can become the issuer), in host.env / the SSM parameters: - CARLOS_DNS01_ZONES=tito.io (add ti.to if that zone is in the same Route 53 account) - CARLOS_DNS01_ACCOUNTS=<the tito account's sqid> - CARLOS_DNS_PROVIDER=route53 is already set (it issues *.go.tito.io); the boxes' Route 53 grant must include the tito.io hosted zone.
  2. Attach the hostname as before (carlos domains attach billing.tito.io --platform ...).
  3. Within about two minutes the issuer logs edge: pre-issue billing.tito.io: certificate issued over DNS-01. Check it on the target edge: curl -sv --resolve billing.tito.io:443:<IE EIP> https://billing.tito.io/ -o /dev/null shows a valid Let's Encrypt certificate.
  4. Switch DNS. No gap.

The issuer logs edge: certificates before DNS moves on for [tito.io] ... at start when it's armed, and says why when it isn't (no account named, no DNS provider).

Wildcards (2) and customer domains (3): unchanged from my first post. For the ~70 Pro customer domains, a gap-free switch would need a certificate import; I'll raise that with Paul when Pro is next.

Review trail: Astra R1 found two P1s (a member's claim could have used the operator's DNS; an apex order and its wildcard could overwrite each other's challenge) and a P2 (fairness), all fixed; R2 READY AFTER FIXES, its P2 fixed; census approved on #280.

Tito's staging rehearsal of the pre-issue on v0.43.0 passed: a certificate over DNS-01 in about 85 s, and IE served it with a 200 before DNS moved. Thanks.

The remaining gap, and the fix (building now, branch alias-publish-precert-1293, rough date: merged by 2026-11-25; release on Paul's go).

Why UK answered 503 "Almost ready": the home box publishes an attached alias in control/edges/ only once its DNS sweep has stamped it "pointing" (5 to 7 minutes). Until then the other edges don't know the name, so they can't relay it to the home box. The gate is deliberate: attach needs no DNS proof, so without it a tenant could make the shared issuer order certificates for any number of names.

A name the operator has authorized for DNS-01 is outside that concern. The fix: the home box also publishes an alias that isn't pointing yet when

  • its hostname is in CARLOS_DNS01_ZONES and its account is in CARLOS_DNS01_ACCOUNTS (the same settings, read by the same rule as the pre-issuer), and
  • a current certificate for it is already on the box (the pre-issued one).

It goes out marked dns_pointing: false. That's the shape custom routes already use: every edge relays the name to its home box, and the cert warm leaves it alone, so the issuer is never asked to order HTTP-01 for a name that doesn't point here.

So the console's advice stays right: CNAME to edge.platform.tito.io. Attach, wait until the name answers on a non-hub edge (curl -sv --resolve <host>:443:<UK EIP> https://<host>/), then switch. Expect up to about 7 minutes from attach to that answer, because the certificate's expiry is picked up on the same sweep. After that the switch has no gap on any edge.

Until it's released, the A record to the hub first is the right workaround for billing.

Merged as 49bcf97, the follow-up that publishes pre-issued aliases before DNS points here. Not released: it rides the next release (v0.43.2), which waits on Paul's go.

What it changes for Tito once a release carrying it is on the production boxes: an alias whose hostname is in CARLOS_DNS01_ZONES and whose account is in CARLOS_DNS01_ACCOUNTS, and whose pre-issued certificate is already on the home box, is published to every edge marked dns_pointing: false. Every edge relays it to the home box, and the issuer never orders HTTP-01 for it. The recipe from my last post holds: CNAME to edge.platform.tito.io, attach, wait until the name answers on a non-hub edge (curl -sv --resolve <host>:443:<UK EIP> https://<host>/, up to about 7 minutes after attach), then switch. Until the release, pointing the A record at the hub first remains the workaround.

Review trail: Astra R1 (one P1, one P2) and R2 (two P2s) fixed; census approved on #280, including the confirmation for edgeAcmeDir's move into its own file.