feat: verify custom domains by a CNAME unique to the page
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m28s
ci / test (pull_request) Successful in 12m52s
ci / build (pull_request) Successful in 11m21s
ci / image (pull_request) Successful in 4m38s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m28s
ci / test (pull_request) Successful in 12m52s
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
This commit is contained in:
1 parent
66537f4e65
commit
5934bd74e8
16 files changed
+1132
-307
No files matched your search
@@ -106,9 +106,16 @@ type PageEditor struct {
|
||||
URL string
|
||||
Domain string
|
||||
DomainVerified bool
|
||||
// CNAMETarget is the host of the platform's status page servers that
|
||||
// custom domains point at; empty when unknown.
|
||||
CNAMETarget string
|
||||
// CNAMEValue is the target unique to the page that its domain points
|
||||
// at; empty when the platform's status page host is not known.
|
||||
CNAMEValue string
|
||||
// VerifiedBy is "cname" or "txt", empty for domains verified before
|
||||
// either was recorded.
|
||||
VerifiedBy string
|
||||
// MissingSince and SwitchOffAt are set while the record of a verified
|
||||
// domain cannot be found.
|
||||
MissingSince string
|
||||
SwitchOffAt string
|
||||
// DomainChangesPerDay is how often the domain may be changed a day.
|
||||
DomainChangesPerDay int
|
||||
RecordName string
|
||||
@@ -302,45 +309,63 @@ templ StatusPageEditor(p Page, me Me, e PageEditor) {
|
||||
@submit(i18n.T(ctx, "common.save"))
|
||||
</form>
|
||||
if e.Domain != "" {
|
||||
<ol class="mt-6 space-y-5 border border-rule p-4 text-sm">
|
||||
<li>
|
||||
if e.DomainVerified {
|
||||
<p><span class="text-up">●</span> { i18n.T(ctx, "pages.domain_step_verified") }</p>
|
||||
<div class="mt-6 space-y-4 border border-rule p-4 text-sm">
|
||||
if e.DomainVerified {
|
||||
<p>
|
||||
<span class="text-up">●</span>
|
||||
switch e.VerifiedBy {
|
||||
case "cname":
|
||||
{ i18n.T(ctx, "pages.domain_verified_by_cname") }
|
||||
case "txt":
|
||||
{ i18n.T(ctx, "pages.domain_verified_by_txt") }
|
||||
default:
|
||||
{ i18n.T(ctx, "pages.domain_step_verified") }
|
||||
}
|
||||
</p>
|
||||
if e.MissingSince != "" {
|
||||
<p class="border-l-2 border-down pl-3" role="alert">{ i18n.T(ctx, "pages.domain_missing", "Since", e.MissingSince, "Date", e.SwitchOffAt) }</p>
|
||||
} else if e.VerifiedBy != "" {
|
||||
<p class="text-xs text-muted">{ i18n.T(ctx, "pages.domain_keep") }</p>
|
||||
}
|
||||
} else if e.CNAMEValue != "" && !e.OwnServers {
|
||||
<p>{ i18n.T(ctx, "pages.domain_cname_step") }</p>
|
||||
@dnsRecordList("CNAME", e.Domain, e.CNAMEValue+".")
|
||||
@verifyButton(e.ID, "pages.verify_now")
|
||||
<details>
|
||||
<summary class="cursor-pointer text-xs text-muted hover:text-ink">{ i18n.T(ctx, "pages.domain_alt_summary") }</summary>
|
||||
<p class="mb-3 mt-3 text-xs">{ i18n.T(ctx, "pages.domain_alt", "Target", e.CNAMEValue) }</p>
|
||||
@dnsRecordList("TXT", e.RecordName, e.RecordValue)
|
||||
@verifyButton(e.ID, "pages.verify")
|
||||
</details>
|
||||
} else {
|
||||
<p>{ i18n.T(ctx, "pages.domain_step_verify") }</p>
|
||||
@dnsRecordList("TXT", e.RecordName, e.RecordValue)
|
||||
@verifyButton(e.ID, "pages.verify")
|
||||
if e.OwnServers {
|
||||
<p>{ i18n.T(ctx, "pages.domain_step_cname_own") }</p>
|
||||
} else {
|
||||
<p class="mb-3">{ i18n.T(ctx, "pages.domain_step_verify") }</p>
|
||||
<dl class="mb-4 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 font-mono text-xs">
|
||||
<dt class="text-muted">TXT</dt>
|
||||
<dd class="break-all">{ e.RecordName }</dd>
|
||||
<dt class="text-muted">{ i18n.T(ctx, "pages.value") }</dt>
|
||||
<dd class="break-all">{ e.RecordValue }</dd>
|
||||
</dl>
|
||||
<button type="button" data-post={ "/org/statuspages/" + e.ID + "/domain/verify" } data-ok={ i18n.T(ctx, "pages.domain_verified") } data-reload class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "pages.verify") }</button>
|
||||
<p>{ i18n.T(ctx, "pages.domain_step_cname_unknown") }</p>
|
||||
}
|
||||
</li>
|
||||
<li>
|
||||
switch {
|
||||
case e.OwnServers:
|
||||
<p>{ i18n.T(ctx, "pages.domain_step_cname_own") }</p>
|
||||
case e.CNAMETarget != "":
|
||||
<p class="mb-3">{ i18n.T(ctx, "pages.domain_step_cname") }</p>
|
||||
<dl class="grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 font-mono text-xs">
|
||||
<dt class="text-muted">CNAME</dt>
|
||||
<dd class="break-all">{ e.Domain }</dd>
|
||||
<dt class="text-muted">{ i18n.T(ctx, "pages.value") }</dt>
|
||||
<dd class="break-all">{ e.CNAMETarget + "." }</dd>
|
||||
</dl>
|
||||
default:
|
||||
<p>{ i18n.T(ctx, "pages.domain_step_cname_unknown") }</p>
|
||||
}
|
||||
<p class="mt-2 text-xs text-muted">{ i18n.T(ctx, "pages.domain_apex") }</p>
|
||||
</li>
|
||||
<li>
|
||||
<p class="text-xs text-muted">{ i18n.T(ctx, "pages.domain_step_tls", "Count", e.DomainChangesPerDay) }</p>
|
||||
</li>
|
||||
</ol>
|
||||
<p class="text-xs text-muted">{ i18n.T(ctx, "pages.domain_apex") }</p>
|
||||
}
|
||||
<p class="text-xs text-muted">{ i18n.T(ctx, "pages.domain_step_tls", "Count", e.DomainChangesPerDay) }</p>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ dnsRecordList(kind, name, value string) {
|
||||
<dl class="grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 font-mono text-xs">
|
||||
<dt class="text-muted">{ kind }</dt>
|
||||
<dd class="break-all">{ name }</dd>
|
||||
<dt class="text-muted">{ i18n.T(ctx, "pages.value") }</dt>
|
||||
<dd class="break-all">{ value }</dd>
|
||||
</dl>
|
||||
}
|
||||
|
||||
templ verifyButton(pageID, label string) {
|
||||
<button type="button" data-post={ "/org/statuspages/" + pageID + "/domain/verify" } data-ok={ i18n.T(ctx, "pages.domain_verified") } data-reload class="mt-3 border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, label) }</button>
|
||||
}
|
||||
Reference in new issue
Block a user