feat: custom domains by a unique CNAME, limited certificate orders #156

Merged
Sebi merged 3 commits from feat/custom-domain-abuse into main 2026-11-25 22:03:12 +00:00
3 Commits
Author SHA1 Message Date
Sebastian UnterschützandClaude Opus 5.5 5934bd74e8 feat: verify custom domains by a CNAME unique to the page
ci / test (push) Skipped
ci / test (pull_request) Successful in 12m52s
ci / lint (push) Skipped
ci / lint (pull_request) Successful in 7m28s
ci / build (push) Skipped
ci / image (push) Skipped
ci / build (pull_request) Successful in 11m21s
ci / image (pull_request) Successful in 4m38s
A custom domain now needs a single record: a CNAME to
<label>.<status page host>, where the label is derived from the page's
domain token. The wildcard record of the status page host routes it, and
since the target belongs to one page alone it also proves who set it up;
a CNAME to the shared host would not, as any organization could then
claim a domain pointing at the platform. The TXT record stays for domains
whose CNAME cannot be seen, behind a proxy or without a subdomain.

- The domain watch looks for the records of a new domain every minute for
  a quarter of an hour, then every ten minutes for two days, and verifies
  it on its own; "Check now" still works.
- Verified domains are checked daily. When the record is gone the owners
  are told, and a week later the domain is switched off, so a record left
  behind cannot be taken over. Domains verified before keep working
  without checks.
- The editor shows the CNAME record first, the TXT way for proxies and
  apex domains, how the domain was verified and when a missing record will
  switch it off. The API returns cname_record and domain_missing_since.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-25 22:58:54 +01:00
Sebastian UnterschützandClaude Opus 5.5 66537f4e65 fix: keep Redis timeouts below a second exact
A checker's long poll ends with BLPOP waiting the rest of it, often below
a second, which go-redis rounded up to one second with a warning in the
log; the poll then ran up to a second too long. Such waits now pass BLPOP
a fraction of a second, which Redis takes since 6.0. A session's sliding
expiry, which can be below a second near its absolute end, uses PEXPIRE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-25 22:58:54 +01:00
Sebastian UnterschützandClaude Opus 5.5 db36d918fe feat: guard certificate orders for custom domains and explain the setup
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / test (pull_request) Successful in 8m21s
ci / lint (pull_request) Successful in 11m0s
ci / build (pull_request) Canceled after 8m49s
ci / image (pull_request) Canceled after 0s
Status page servers order certificates on demand. Verified domains were
already the only ones they would order for, but nothing bounded how many:
an organization switching domains, or many organizations at once, could use
up the CA's rate limits that all servers sharing an ACME account depend on,
and every handshake or request for a made-up name was passed on to the API.

- Before a new order (not a renewal) the server asks the API
  (POST /agent/v1/certificates). It allows verified domains of pages that
  server serves, within limits per domain and day, per organization and
  day, and per ACME account owner and hour (UPTIME_CERTS_*), counted
  across all instances.
- An organization can set a new custom domain at most 10 times a day.
- The server remembers names without a page for a minute and passes at
  most 20 unknown names a second on to the API; pages the sync cached are
  not affected. Only real pages are recorded as visited.
- The page editor explains the three steps: the TXT record, the CNAME
  record with the platform's status page host as its target (or the
  organization's own servers), apex domains, and when HTTPS follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-25 22:39:01 +01:00