feat: custom domains by a unique CNAME, limited certificate orders #156
No files matched your search
@@ -93,6 +93,7 @@ func run(log *slog.Logger, level *slog.LevelVar, args []string) error {
|
||||
go srv.RunNotifier(ctx)
|
||||
go srv.RunHousekeeping(ctx)
|
||||
go srv.RunRegionWatch(ctx)
|
||||
go srv.RunDomainWatch(ctx)
|
||||
go srv.RunHeartbeats(ctx)
|
||||
|
||||
return platform.Serve(ctx, log, platform.NewHTTPServer(cfg.Listen, r), health, 5*time.Second, cfg.ShutdownTimeout)
|
||||
|
||||
@@ -49,7 +49,7 @@ func TestCertificateOrdersAreLimited(t *testing.T) {
|
||||
// The editor explains the records, with the platform's servers as the
|
||||
// CNAME target.
|
||||
_, _, html := owner.page("/statuspages/" + id1)
|
||||
for _, want := range []string{"Prove the domain is yours", "status.platform.test.", "ALIAS or ANAME", "at most 10 times a day"} {
|
||||
for _, want := range []string{"Create this CNAME record", ".status.platform.test.", "Prove the domain with this TXT record", "ALIAS or ANAME", "at most 10 times a day"} {
|
||||
if !strings.Contains(html, want) {
|
||||
t.Errorf("the editor lacks %q", want)
|
||||
}
|
||||
|
||||
@@ -1142,7 +1142,7 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v := viewStatusPage(row)
|
||||
v := s.viewStatusPage(row)
|
||||
e := web.PageEditor{
|
||||
ID: row.ID.String(), Title: row.Title, Slug: row.Slug, Description: row.Description,
|
||||
Published: row.Published, ShowDetails: row.ShowComponentDetails,
|
||||
@@ -1155,8 +1155,13 @@ func (s *Server) statusPageEditor(c *gin.Context, p *principal, page web.Page, m
|
||||
e.RecordName, e.RecordValue = v.DomainRecord.Name, v.DomainRecord.Value
|
||||
}
|
||||
e.DomainChangesPerDay = domainChangesPerDay
|
||||
if !own {
|
||||
e.CNAMETarget = s.cnameTarget()
|
||||
if v.CNAMERecord != nil {
|
||||
e.CNAMEValue = v.CNAMERecord.Value
|
||||
}
|
||||
e.VerifiedBy = deref(row.DomainVerifyMethod)
|
||||
if f := row.DomainFailingSince; f != nil {
|
||||
e.MissingSince = f.Local().Format("2006-01-02 15:04")
|
||||
e.SwitchOffAt = f.Add(domainGrace).Local().Format("2006-01-02 15:04")
|
||||
}
|
||||
newPageGroupTree(pageGroups).walk(func(g store.StatusPageGroup, depth int) {
|
||||
var parentID string
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/base32"
|
||||
"net"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/notify"
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/store"
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/tenant"
|
||||
)
|
||||
|
||||
// A custom domain proves it belongs to its page in one of two ways:
|
||||
//
|
||||
// - a CNAME to <label>.<status page host>, where the label is unique to
|
||||
// the page. The platform's status page host has a wildcard record, so
|
||||
// the CNAME also routes the domain; one record does both. A CNAME to
|
||||
// the shared host alone would not do: it proves the domain points at
|
||||
// the platform, not which organization put it there.
|
||||
// - the TXT record _uptimesebi.<domain>, for domains whose CNAME cannot be
|
||||
// seen: behind a proxy such as Cloudflare's, or a domain without a
|
||||
// subdomain using ALIAS or CNAME flattening.
|
||||
//
|
||||
// The domain watch looks for them on its own after a domain is set, and
|
||||
// checks verified domains daily. One whose record has been missing for
|
||||
// domainGrace is switched off, so a record left behind after a page is
|
||||
// gone or moved cannot be claimed by anybody else.
|
||||
|
||||
const (
|
||||
domainWatchEvery = time.Minute
|
||||
domainGrace = 7 * 24 * time.Hour
|
||||
keyDomainWatch = "domainwatch:lock"
|
||||
)
|
||||
|
||||
// lookupCNAME is replaced in tests.
|
||||
var lookupCNAME = net.DefaultResolver.LookupCNAME
|
||||
|
||||
var labelEncoding = base32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567").WithPadding(base32.NoPadding)
|
||||
|
||||
// cnameLabel is the page's label below the status page host, derived from
|
||||
// its domain token.
|
||||
func cnameLabel(token string) string {
|
||||
sum := sha256.Sum256([]byte("cname\x00" + token))
|
||||
return "p" + labelEncoding.EncodeToString(sum[:10])
|
||||
}
|
||||
|
||||
// cnameFor is the CNAME target of the page with token, or empty when the
|
||||
// platform's status page host is not known.
|
||||
func (s *Server) cnameFor(token string) string {
|
||||
host := s.cnameTarget()
|
||||
if host == "" {
|
||||
return ""
|
||||
}
|
||||
return cnameLabel(token) + "." + host
|
||||
}
|
||||
|
||||
// checkDomain looks for the records proving domain belongs to the page
|
||||
// with token and returns "cname", "txt" or "" for neither.
|
||||
func (s *Server) checkDomain(ctx context.Context, domain, token string) string {
|
||||
if target := s.cnameFor(token); target != "" {
|
||||
if c, err := lookupCNAME(ctx, domain); err == nil && strings.EqualFold(strings.TrimSuffix(c, "."), target) {
|
||||
return "cname"
|
||||
}
|
||||
}
|
||||
if records, err := lookupTXT(ctx, verifyPrefix+domain); err == nil && slices.Contains(records, token) {
|
||||
return "txt"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// RunDomainWatch checks custom domains until ctx ends. Replicas take
|
||||
// turns through a lock in Redis.
|
||||
func (s *Server) RunDomainWatch(ctx context.Context) {
|
||||
tick := time.NewTicker(domainWatchEvery)
|
||||
defer tick.Stop()
|
||||
for {
|
||||
if ok, err := s.rdb.SetNX(ctx, keyDomainWatch, 1, domainWatchEvery-5*time.Second).Result(); err == nil && ok {
|
||||
if err := s.WatchDomains(ctx, time.Now()); err != nil && ctx.Err() == nil {
|
||||
s.log.WarnContext(ctx, "checking custom domains failed", "error", err)
|
||||
}
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-tick.C:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WatchDomains checks the domains that are due once.
|
||||
func (s *Server) WatchDomains(ctx context.Context, now time.Time) error {
|
||||
return s.watchDomains(ctx, now, nil)
|
||||
}
|
||||
|
||||
// watchDomains is WatchDomains limited to the page only, unless it is nil.
|
||||
func (s *Server) watchDomains(ctx context.Context, now time.Time, only *uuid.UUID) error {
|
||||
var due []store.DomainsToCheckRow
|
||||
if err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||
var err error
|
||||
due, err = q.DomainsToCheck(ctx, store.DomainsToCheckParams{Now: now, PageID: only})
|
||||
return err
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, d := range due {
|
||||
if err := s.watchDomain(ctx, d, now); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) watchDomain(ctx context.Context, d store.DomainsToCheckRow, now time.Time) error {
|
||||
method := s.checkDomain(ctx, d.Domain, d.DomainToken)
|
||||
var (
|
||||
failing *time.Time
|
||||
off bool
|
||||
)
|
||||
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||
if method != "" {
|
||||
return q.MarkDomainVerified(ctx, store.MarkDomainVerifiedParams{ID: d.ID, Now: now, Method: method})
|
||||
}
|
||||
var err error
|
||||
if failing, err = q.MarkDomainUnconfirmed(ctx, store.MarkDomainUnconfirmedParams{ID: d.ID, Now: now}); err != nil || failing == nil {
|
||||
return err
|
||||
}
|
||||
if now.Sub(*failing) >= domainGrace {
|
||||
off = true
|
||||
return q.UnverifyDomain(ctx, d.ID)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch {
|
||||
case method != "" && d.DomainVerifiedAt == nil:
|
||||
s.log.InfoContext(ctx, "custom domain verified", "page", d.ID, "domain", d.Domain, "method", method)
|
||||
case off:
|
||||
s.log.InfoContext(ctx, "custom domain switched off: its record is gone", "page", d.ID, "domain", d.Domain)
|
||||
s.mailDomain(ctx, d, "email.domain_off", now)
|
||||
case failing != nil && d.DomainFailingSince == nil:
|
||||
s.log.InfoContext(ctx, "custom domain record missing", "page", d.ID, "domain", d.Domain)
|
||||
s.mailDomain(ctx, d, "email.domain_missing", now.Add(domainGrace))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// mailDomain tells the organization's owners about d.
|
||||
func (s *Server) mailDomain(ctx context.Context, d store.DomainsToCheckRow, kind string, at time.Time) {
|
||||
if s.smtp == nil {
|
||||
return
|
||||
}
|
||||
var to []string
|
||||
if err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||
var err error
|
||||
to, err = q.OrgOwnerEmails(ctx, d.OrgID)
|
||||
return err
|
||||
}); err != nil || len(to) == 0 {
|
||||
return
|
||||
}
|
||||
l := s.catalog.Match("")
|
||||
data := map[string]any{
|
||||
"Domain": d.Domain, "Page": d.Title, "Link": s.ticketLink("/statuspages/" + d.ID.String()),
|
||||
"Date": at.UTC().Format("2006-01-02 15:04 MST"),
|
||||
}
|
||||
if err := s.smtp.Send(ctx, notify.Mail{To: to, Subject: l.T(kind+".subject", data), Body: l.T(kind+".body", data)}); err != nil {
|
||||
s.log.WarnContext(ctx, "mail about a custom domain failed", "page", d.ID, "error", err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package api_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5"
|
||||
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/api"
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/config"
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/notify/notifytest"
|
||||
)
|
||||
|
||||
// fakeDNS answers CNAME lookups from a map, and TXT lookups with nothing.
|
||||
type fakeDNS struct {
|
||||
mu sync.Mutex
|
||||
cname map[string]string
|
||||
}
|
||||
|
||||
func (d *fakeDNS) set(name, target string) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if target == "" {
|
||||
delete(d.cname, name)
|
||||
} else {
|
||||
d.cname[name] = target
|
||||
}
|
||||
}
|
||||
|
||||
func useFakeDNS(t *testing.T) *fakeDNS {
|
||||
d := &fakeDNS{cname: map[string]string{}}
|
||||
savedC, savedT := *api.LookupCNAME, *api.LookupTXT
|
||||
t.Cleanup(func() { *api.LookupCNAME, *api.LookupTXT = savedC, savedT })
|
||||
*api.LookupCNAME = func(_ context.Context, name string) (string, error) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if c, ok := d.cname[name]; ok {
|
||||
return c, nil
|
||||
}
|
||||
return "", errors.New("no such host")
|
||||
}
|
||||
*api.LookupTXT = func(context.Context, string) ([]string, error) { return nil, errors.New("no such record") }
|
||||
return d
|
||||
}
|
||||
|
||||
func TestCustomDomainByCNAME(t *testing.T) {
|
||||
mail := notifytest.NewSMTP(t)
|
||||
e := newEnvWith(t, func(c *config.API) {
|
||||
c.SMTPURL, c.SignupVerify = mail.URL(), "off"
|
||||
c.StatusPageURL = "https://status.platform.test"
|
||||
})
|
||||
ctx := context.Background()
|
||||
dns := useFakeDNS(t)
|
||||
platform := e.statuspageClient(t, nil)
|
||||
|
||||
newPage := func(b *browser) uuid.UUID {
|
||||
slug := uniq("cn-")
|
||||
_, p := b.do("POST", "/api/v1/org/statuspages", map[string]any{"slug": slug, "title": "Shop status"})
|
||||
b.do("PUT", "/api/v1/org/statuspages/"+p["id"].(string), map[string]any{"slug": slug, "title": "Shop status", "published": true})
|
||||
return uuid.MustParse(p["id"].(string))
|
||||
}
|
||||
setDomain := func(b *browser, id uuid.UUID, domain string) string {
|
||||
t.Helper()
|
||||
st, body := b.do("PUT", "/api/v1/org/statuspages/"+id.String()+"/domain", map[string]any{"domain": domain})
|
||||
if st != http.StatusOK {
|
||||
t.Fatalf("set domain = %d %v", st, body)
|
||||
}
|
||||
rec, _ := body["cname_record"].(map[string]any)
|
||||
if rec == nil || rec["name"] != domain {
|
||||
t.Fatalf("cname_record = %v", body["cname_record"])
|
||||
}
|
||||
return rec["value"].(string)
|
||||
}
|
||||
served := func(domain string) bool {
|
||||
_, err := platform.Page(ctx, domain, "")
|
||||
return err == nil
|
||||
}
|
||||
|
||||
a := e.browser(t)
|
||||
aEmail := "a@" + uniq("cn") + ".test"
|
||||
a.signup(aEmail, uniq("cn-"))
|
||||
pageA := newPage(a)
|
||||
domain := uniq("status") + ".shop.test"
|
||||
target := setDomain(a, pageA, domain)
|
||||
if !strings.HasSuffix(target, ".status.platform.test") || len(target) < 30 {
|
||||
t.Errorf("CNAME target %q is not unique to the page below the status host", target)
|
||||
}
|
||||
if _, _, html := a.page("/statuspages/" + pageA.String()); !strings.Contains(html, target+".") || !strings.Contains(html, "Check now") {
|
||||
t.Error("the editor does not show the page's CNAME record")
|
||||
}
|
||||
|
||||
// A CNAME to the shared host alone proves nothing.
|
||||
now := time.Now()
|
||||
dns.set(domain, "status.platform.test.")
|
||||
if err := e.api.WatchDomainOf(ctx, now, pageA); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if served(domain) {
|
||||
t.Fatal("a CNAME to the shared host verified the domain")
|
||||
}
|
||||
// The page's own target verifies it, without anybody pressing a button.
|
||||
dns.set(domain, strings.ToUpper(target)+".")
|
||||
if err := e.api.WatchDomainOf(ctx, now.Add(time.Minute), pageA); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !served(domain) {
|
||||
t.Fatal("the watch did not verify the domain by its CNAME")
|
||||
}
|
||||
if _, _, html := a.page("/statuspages/" + pageA.String()); !strings.Contains(html, "verified by its CNAME record") {
|
||||
t.Error("the editor does not say how the domain was verified")
|
||||
}
|
||||
|
||||
// Another organization taking the domain over, while the CNAME still
|
||||
// points at the first page, gets nowhere.
|
||||
a.do("PUT", "/api/v1/org/statuspages/"+pageA.String()+"/domain", map[string]any{"domain": ""})
|
||||
b := e.browser(t)
|
||||
b.signup("b@"+uniq("cn")+".test", uniq("cn-"))
|
||||
pageB := newPage(b)
|
||||
setDomain(b, pageB, domain)
|
||||
if err := e.api.WatchDomainOf(ctx, now.Add(2*time.Minute), pageB); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if st, _ := b.do("POST", "/api/v1/org/statuspages/"+pageB.String()+"/domain/verify", nil); st != http.StatusUnprocessableEntity || served(domain) {
|
||||
t.Fatalf("a record left by another page verified the domain (verify = %d)", st)
|
||||
}
|
||||
b.do("PUT", "/api/v1/org/statuspages/"+pageB.String()+"/domain", map[string]any{"domain": ""})
|
||||
|
||||
// Once verified, the record is checked daily. Gone, the owners are told
|
||||
// and, a week later, the domain is switched off.
|
||||
setDomain(a, pageA, domain)
|
||||
if st, body := a.do("POST", "/api/v1/org/statuspages/"+pageA.String()+"/domain/verify", nil); st != http.StatusNoContent {
|
||||
t.Fatalf("verify = %d %v", st, body)
|
||||
}
|
||||
dns.set(domain, "")
|
||||
day := now.Add(25 * time.Hour)
|
||||
if err := e.api.WatchDomainOf(ctx, day, pageA); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
waitFor(t, 5*time.Second, "a mail that the record is gone", func() bool {
|
||||
return mailedTo(mail, aEmail, "is gone", domain)
|
||||
})
|
||||
if !served(domain) {
|
||||
t.Error("the domain was switched off at once")
|
||||
}
|
||||
if _, _, html := a.page("/statuspages/" + pageA.String()); !strings.Contains(html, "has not been found since") {
|
||||
t.Error("the editor does not warn about the missing record")
|
||||
}
|
||||
if err := e.api.WatchDomainOf(ctx, day.Add(8*24*time.Hour), pageA); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if served(domain) {
|
||||
t.Error("the domain is still served a week after its record went")
|
||||
}
|
||||
waitFor(t, 5*time.Second, "a mail that the domain was switched off", func() bool {
|
||||
return mailedTo(mail, aEmail, "switched off", domain)
|
||||
})
|
||||
}
|
||||
|
||||
func TestDomainsVerifiedBeforeAreNotCheckedAgain(t *testing.T) {
|
||||
e := newEnvWith(t, func(c *config.API) { c.StatusPageURL = "https://status.platform.test" })
|
||||
ctx := context.Background()
|
||||
useFakeDNS(t)
|
||||
owner := e.browser(t)
|
||||
owner.signup("o@"+uniq("old")+".test", uniq("old-"))
|
||||
slug := uniq("old-")
|
||||
_, p := owner.do("POST", "/api/v1/org/statuspages", map[string]any{"slug": slug, "title": "Status"})
|
||||
id := p["id"].(string)
|
||||
owner.do("PUT", "/api/v1/org/statuspages/"+id, map[string]any{"slug": slug, "title": "Status", "published": true})
|
||||
domain := uniq("old") + ".example.test"
|
||||
owner.do("PUT", "/api/v1/org/statuspages/"+id+"/domain", map[string]any{"domain": domain})
|
||||
if err := e.asSystem(t, func(tx pgx.Tx) error {
|
||||
_, err := tx.Exec(ctx, `UPDATE status_pages SET domain_verified_at = now() - interval '1 year', domain_set_at = now() - interval '1 year' WHERE id = $1`, id)
|
||||
return err
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := e.api.WatchDomainOf(ctx, time.Now().Add(30*24*time.Hour), uuid.MustParse(id)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := e.statuspageClient(t, nil).Page(ctx, domain, ""); err != nil {
|
||||
t.Errorf("a domain verified before the checks was switched off: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func mailedTo(mail *notifytest.SMTP, to string, want ...string) bool {
|
||||
for _, m := range mail.Messages() {
|
||||
if !strings.Contains(strings.Join(m.To, ","), to) {
|
||||
continue
|
||||
}
|
||||
ok := true
|
||||
for _, w := range want {
|
||||
ok = ok && strings.Contains(m.Data, w)
|
||||
}
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -30,3 +30,11 @@ func OpenAPI() map[string]any { return buildOpenAPI("https://uptime.example") }
|
||||
func (s *Server) WatchRegionsOf(ctx context.Context, now time.Time, ids ...uuid.UUID) error {
|
||||
return s.watchRegions(ctx, now, ids)
|
||||
}
|
||||
|
||||
// LookupCNAME lets tests replace DNS lookups for domain verification.
|
||||
var LookupCNAME = &lookupCNAME
|
||||
|
||||
// WatchDomainOf runs the domain watch for one page only.
|
||||
func (s *Server) WatchDomainOf(ctx context.Context, now time.Time, page uuid.UUID) error {
|
||||
return s.watchDomains(ctx, now, &page)
|
||||
}
|
||||
@@ -480,6 +480,13 @@ type statusPageView struct {
|
||||
DomainVerified bool `json:"domain_verified"`
|
||||
// DomainRecord is the TXT record that proves control of CustomDomain.
|
||||
DomainRecord *dnsRecord `json:"domain_record,omitempty"`
|
||||
// CNAMERecord points CustomDomain at the platform's status page
|
||||
// servers and proves control of it in one, where the platform knows
|
||||
// their host.
|
||||
CNAMERecord *dnsRecord `json:"cname_record,omitempty"`
|
||||
// DomainMissingSince is set when the record of a verified domain has
|
||||
// not been found since then; it is switched off a week later.
|
||||
DomainMissingSince *time.Time `json:"domain_missing_since,omitempty"`
|
||||
// Suspended is set when platform admins took the page offline; it is
|
||||
// not served whatever Published says.
|
||||
Suspended bool `json:"suspended,omitempty"`
|
||||
@@ -492,7 +499,7 @@ type dnsRecord struct {
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
func viewStatusPage(p store.StatusPage) statusPageView {
|
||||
func (s *Server) viewStatusPage(p store.StatusPage) statusPageView {
|
||||
v := statusPageView{
|
||||
ID: p.ID, Slug: p.Slug, Title: p.Title, Description: p.Description,
|
||||
Published: p.Published, ShowComponentDetails: p.ShowComponentDetails,
|
||||
@@ -502,6 +509,10 @@ func viewStatusPage(p store.StatusPage) statusPageView {
|
||||
_ = json.Unmarshal(p.Theme, &v.Theme)
|
||||
if p.CustomDomain != nil {
|
||||
v.DomainRecord = &dnsRecord{Name: verifyPrefix + *p.CustomDomain, Type: "TXT", Value: p.DomainToken}
|
||||
if target := s.cnameFor(p.DomainToken); target != "" {
|
||||
v.CNAMERecord = &dnsRecord{Name: *p.CustomDomain, Type: "CNAME", Value: target}
|
||||
}
|
||||
v.DomainMissingSince = p.DomainFailingSince
|
||||
}
|
||||
return v
|
||||
}
|
||||
@@ -540,7 +551,7 @@ func (s *Server) listStatusPages(c *gin.Context) {
|
||||
out := []statusPageView{}
|
||||
for _, r := range rows {
|
||||
if p.Grants.Can(authz.StatusPagesRead, pageResource(r.ID)) {
|
||||
out = append(out, viewStatusPage(r))
|
||||
out = append(out, s.viewStatusPage(r))
|
||||
}
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"pages": out})
|
||||
@@ -582,7 +593,7 @@ func (s *Server) createStatusPage(c *gin.Context) {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusCreated, viewStatusPage(row))
|
||||
c.JSON(http.StatusCreated, s.viewStatusPage(row))
|
||||
}
|
||||
|
||||
func newDomainToken() string {
|
||||
@@ -621,7 +632,7 @@ func (s *Server) updateStatusPage(c *gin.Context) {
|
||||
case err != nil:
|
||||
internalError(c, err)
|
||||
default:
|
||||
c.JSON(http.StatusOK, viewStatusPage(row))
|
||||
c.JSON(http.StatusOK, s.viewStatusPage(row))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,14 +781,14 @@ func (s *Server) setPageDomain(c *gin.Context) {
|
||||
case err != nil:
|
||||
internalError(c, err)
|
||||
default:
|
||||
c.JSON(http.StatusOK, viewStatusPage(row))
|
||||
c.JSON(http.StatusOK, s.viewStatusPage(row))
|
||||
}
|
||||
}
|
||||
|
||||
// lookupTXT is replaced in tests.
|
||||
var lookupTXT = net.DefaultResolver.LookupTXT
|
||||
|
||||
// verifyPageDomain checks the TXT record. Only verified domains are served,
|
||||
// verifyPageDomain looks for the CNAME or the TXT record now. Only verified domains are served,
|
||||
// so nobody can claim a domain they do not control.
|
||||
func (s *Server) verifyPageDomain(c *gin.Context) {
|
||||
id := uuid.MustParse(c.Param("id"))
|
||||
@@ -804,12 +815,14 @@ func (s *Server) verifyPageDomain(c *gin.Context) {
|
||||
fail(c, http.StatusConflict, "no_domain")
|
||||
return
|
||||
}
|
||||
records, err := lookupTXT(ctx, verifyPrefix+*row.CustomDomain)
|
||||
if err != nil || !slices.Contains(records, row.DomainToken) {
|
||||
method := s.checkDomain(ctx, *row.CustomDomain, row.DomainToken)
|
||||
if method == "" {
|
||||
fail(c, http.StatusUnprocessableEntity, "domain_not_verified")
|
||||
return
|
||||
}
|
||||
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error { return q.MarkDomainVerified(ctx, id) })
|
||||
err = s.db.Tx(ctx, p.scope(), func(q *store.Queries) error {
|
||||
return q.MarkDomainVerified(ctx, store.MarkDomainVerifiedParams{ID: id, Now: time.Now(), Method: method})
|
||||
})
|
||||
if err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
|
||||
@@ -514,6 +514,10 @@
|
||||
"console.sso_required_action": "Mit SSO anmelden",
|
||||
"console.suspended_reason": "Grund: {{.Reason}}",
|
||||
"console.totp_missing_action": "Jetzt einrichten",
|
||||
"email.domain_missing.body": "Die Statusseite {{.Page}} wird unter {{.Domain}} ausgeliefert, aber der DNS-Eintrag, der nachweist, dass die Domain zu ihr gehört, ist nicht mehr zu finden.\n\nIst er bis {{.Date}} nicht zurück, wird die Domain abgeschaltet und die Seite dort nicht mehr ausgeliefert. Den Eintrag, der wiederhergestellt werden muss, findest du hier:\n{{.Link}}",
|
||||
"email.domain_missing.subject": "Der DNS-Eintrag von {{.Domain}} fehlt",
|
||||
"email.domain_off.body": "Der DNS-Eintrag von {{.Domain}} fehlt seit einer Woche, deshalb wird die Statusseite {{.Page}} dort nicht mehr ausgeliefert.\n\nStelle den Eintrag wieder her und prüfe die Domain erneut:\n{{.Link}}",
|
||||
"email.domain_off.subject": "{{.Domain}} wurde abgeschaltet",
|
||||
"email.opened.body": "{{.Monitor}} ({{.Target}}) ist in allen Regionen nicht erreichbar seit {{.Since}}.\n\nLetzte Fehler:\n{{.Cause}}\n\nDu erhältst diese Nachricht, weil ein Benachrichtigungskanal deiner Organisation diese Adresse nutzt.",
|
||||
"email.opened.subject": "[DOWN] {{.Monitor}}",
|
||||
"email.region_back.body": "Region {{.Region}} hat wieder einen aktiven Checker; seit {{.Since}} hatte sie keinen. Überfällige Prüfungen laufen sofort.\n\n{{.Link}}",
|
||||
@@ -544,7 +548,7 @@
|
||||
"error.consent_outdated": "Die Dokumente haben sich inzwischen geändert. Lade die Seite neu und stimme der aktuellen Fassung zu.",
|
||||
"error.consent_required": "Bitte stimme zuerst Datenschutz und AGB zu.",
|
||||
"error.domain_changes_exceeded": "Die eigene Domain wurde heute schon {{.Count}}-mal geändert. Versuch es morgen wieder.",
|
||||
"error.domain_not_verified": "Der TXT-Eintrag wurde noch nicht gefunden. DNS-Änderungen brauchen manchmal etwas Zeit.",
|
||||
"error.domain_not_verified": "Weder der CNAME- noch der TXT-Eintrag wurde bisher gefunden. DNS-Änderungen brauchen manchmal etwas, bis sie sichtbar sind.",
|
||||
"error.domain_taken": "Diese Domain nutzt bereits eine andere Statuspage.",
|
||||
"error.email_not_configured": "E-Mail ist auf diesem Server nicht verfügbar.",
|
||||
"error.email_taken": "Diese E-Mail-Adresse ist bereits registriert.",
|
||||
@@ -1250,16 +1254,22 @@
|
||||
"pages.delete_confirm": "Diese Statuspage löschen?",
|
||||
"pages.description": "Beschreibung",
|
||||
"pages.domain": "Eigene Domain",
|
||||
"pages.domain_alt": "Dann ist der CNAME von außen nicht zu sehen. Weise die Domain stattdessen mit diesem TXT-Eintrag nach und lass die Domain oder den Origin deines Proxys auf {{.Target}} zeigen; für eine Domain ohne Subdomain nutze einen ALIAS- oder ANAME-Eintrag oder CNAME-Flattening.",
|
||||
"pages.domain_alt_summary": "Hinter einem Proxy wie Cloudflare oder eine Domain ohne Subdomain?",
|
||||
"pages.domain_apex": "Eine Domain ohne Subdomain (example.com) kann keinen CNAME-Eintrag haben. Nutze stattdessen den ALIAS- oder ANAME-Eintrag deines DNS-Anbieters oder A/AAAA-Einträge.",
|
||||
"pages.domain_intro": "Liefere diese Seite unter einer eigenen Domain aus, z. B. status.example.com. Drei Schritte: Nachweisen, dass die Domain dir gehört, sie auf die Statusseiten-Server zeigen lassen, und HTTPS kommt von selbst.",
|
||||
"pages.domain_cname_step": "Lege diesen CNAME-Eintrag an. Er lässt die Domain auf die Statusseiten-Server zeigen und weist zugleich nach, dass sie dir gehört, denn sein Ziel gehört nur zu dieser Seite. Wir sehen alle paar Minuten nach und prüfen die Domain von selbst; DNS-Änderungen brauchen manchmal etwas, bis sie sichtbar sind.",
|
||||
"pages.domain_intro": "Liefere diese Seite unter einer eigenen Domain aus, z. B. status.example.com. Meist reicht ein einziger DNS-Eintrag; HTTPS kommt von selbst.",
|
||||
"pages.domain_keep": "Lass den Eintrag bestehen: Er wird täglich geprüft, und eine Domain, deren Eintrag eine Woche lang fehlt, wird abgeschaltet, damit niemand anderes sie übernehmen kann.",
|
||||
"pages.domain_missing": "Der Eintrag dieser Domain ist seit {{.Since}} nicht mehr zu finden. Kommt er nicht zurück, wird die Domain am {{.Date}} abgeschaltet.",
|
||||
"pages.domain_name": "Domain",
|
||||
"pages.domain_step_cname": "2. Lass die Domain mit diesem CNAME-Eintrag auf die Statusseiten-Server zeigen:",
|
||||
"pages.domain_step_cname_own": "2. Lass die Domain auf die eigenen Statusseiten-Server deiner Organisation zeigen: per CNAME-Eintrag auf deren Hostnamen oder per A/AAAA-Eintrag auf deren Adressen.",
|
||||
"pages.domain_step_cname_unknown": "2. Lass die Domain per CNAME-Eintrag auf die Statusseiten-Server der Plattform zeigen; das Ziel nennt dir der Betreiber dieser Installation.",
|
||||
"pages.domain_step_tls": "3. HTTPS: Das Zertifikat wird beim ersten Aufruf über HTTPS automatisch geholt, das kann bis zu einer Minute dauern. Zum Schutz der Limits der Zertifizierungsstelle, die sich alle Organisationen teilen, sind neue Zertifikate pro Tag begrenzt, und die Domain lässt sich höchstens {{.Count}}-mal am Tag ändern.",
|
||||
"pages.domain_step_cname_own": "Lass die Domain dann auf die eigenen Statusseiten-Server deiner Organisation zeigen: per CNAME-Eintrag auf deren Hostnamen oder per A/AAAA-Eintrag auf deren Adressen.",
|
||||
"pages.domain_step_cname_unknown": "Lass die Domain dann per CNAME-Eintrag auf die Statusseiten-Server der Plattform zeigen; das Ziel nennt dir der Betreiber dieser Installation.",
|
||||
"pages.domain_step_tls": "HTTPS: Das Zertifikat wird beim ersten Aufruf über HTTPS automatisch geholt, das kann bis zu einer Minute dauern. Zum Schutz der Limits der Zertifizierungsstelle, die sich alle Organisationen teilen, sind neue Zertifikate pro Tag begrenzt, und die Domain lässt sich höchstens {{.Count}}-mal am Tag ändern.",
|
||||
"pages.domain_step_verified": "1. Domain geprüft.",
|
||||
"pages.domain_step_verify": "1. Weise mit diesem TXT-Eintrag nach, dass die Domain dir gehört, und prüfe ihn dann. Bis dahin wird die Domain weder ausgeliefert noch bekommt sie ein Zertifikat.",
|
||||
"pages.domain_step_verify": "Weise mit diesem TXT-Eintrag nach, dass die Domain dir gehört, und prüfe ihn dann. Bis dahin wird die Domain weder ausgeliefert noch bekommt sie ein Zertifikat.",
|
||||
"pages.domain_verified": "Domain geprüft.",
|
||||
"pages.domain_verified_by_cname": "Domain über ihren CNAME-Eintrag geprüft.",
|
||||
"pages.domain_verified_by_txt": "Domain über ihren TXT-Eintrag geprüft.",
|
||||
"pages.draft": "Entwurf",
|
||||
"pages.export": "Als HTML exportieren",
|
||||
"pages.group": "Gruppe",
|
||||
@@ -1289,6 +1299,7 @@
|
||||
"pages.title": "Statuspages",
|
||||
"pages.value": "Wert",
|
||||
"pages.verify": "Prüfen",
|
||||
"pages.verify_now": "Jetzt prüfen",
|
||||
"perm.audit.read": "Audit-Log einsehen",
|
||||
"perm.incidents.read": "Incidents sehen",
|
||||
"perm.incidents.write": "Incidents verwalten",
|
||||
|
||||
@@ -514,6 +514,10 @@
|
||||
"console.sso_required_action": "Sign in with SSO",
|
||||
"console.suspended_reason": "Reason: {{.Reason}}",
|
||||
"console.totp_missing_action": "Set up now",
|
||||
"email.domain_missing.body": "The status page {{.Page}} is served at {{.Domain}}, but the DNS record proving that the domain belongs to it can no longer be found.\n\nUnless it is back by {{.Date}}, the domain is switched off and the page is no longer served there. The record to restore is shown here:\n{{.Link}}",
|
||||
"email.domain_missing.subject": "The DNS record of {{.Domain}} is gone",
|
||||
"email.domain_off.body": "The DNS record of {{.Domain}} has been missing for a week, so the status page {{.Page}} is no longer served there.\n\nRestore the record and verify the domain again:\n{{.Link}}",
|
||||
"email.domain_off.subject": "{{.Domain}} has been switched off",
|
||||
"email.opened.body": "{{.Monitor}} ({{.Target}}) is down in all of its regions since {{.Since}}.\n\nLast errors:\n{{.Cause}}\n\nYou receive this because a notification channel of your organization is set up for this address.",
|
||||
"email.opened.subject": "[DOWN] {{.Monitor}}",
|
||||
"email.region_back.body": "Region {{.Region}} has an active checker again; it had none since {{.Since}}. Overdue checks run right away.\n\n{{.Link}}",
|
||||
@@ -544,7 +548,7 @@
|
||||
"error.consent_outdated": "The documents changed in the meantime. Reload the page and accept the current version.",
|
||||
"error.consent_required": "Please accept the privacy policy and terms first.",
|
||||
"error.domain_changes_exceeded": "The custom domain was changed {{.Count}} times today already. Try again tomorrow.",
|
||||
"error.domain_not_verified": "The TXT record was not found yet. DNS changes can take a while to appear.",
|
||||
"error.domain_not_verified": "Neither the CNAME nor the TXT record was found yet. DNS changes can take a while to appear.",
|
||||
"error.domain_taken": "This domain is already used by another status page.",
|
||||
"error.email_not_configured": "Email is not available on this server.",
|
||||
"error.email_taken": "This email address is already registered.",
|
||||
@@ -1250,16 +1254,22 @@
|
||||
"pages.delete_confirm": "Delete this status page?",
|
||||
"pages.description": "Description",
|
||||
"pages.domain": "Custom domain",
|
||||
"pages.domain_alt": "Then the CNAME cannot be seen from outside. Prove the domain with this TXT record instead, and point the domain, or your proxy's origin, at {{.Target}}; for a domain without a subdomain use an ALIAS or ANAME record or CNAME flattening.",
|
||||
"pages.domain_alt_summary": "Behind a proxy such as Cloudflare, or a domain without a subdomain?",
|
||||
"pages.domain_apex": "A domain without a subdomain (example.com) cannot have a CNAME record. Use your DNS provider's ALIAS or ANAME record, or A/AAAA records, instead.",
|
||||
"pages.domain_intro": "Serve this page under a domain of your own, e.g. status.example.com. Three steps: prove the domain is yours, point it at the status page servers, and HTTPS follows by itself.",
|
||||
"pages.domain_cname_step": "Create this CNAME record. It points the domain at the status page servers and proves that the domain is yours, because its target belongs to this page alone. We look for it every few minutes and verify the domain on our own; DNS changes can take a while to appear.",
|
||||
"pages.domain_intro": "Serve this page under a domain of your own, e.g. status.example.com. One DNS record is usually all it takes; HTTPS follows by itself.",
|
||||
"pages.domain_keep": "Keep the record in place: it is checked daily, and a domain whose record has been gone for a week is switched off, so nobody else can take it over.",
|
||||
"pages.domain_missing": "The record of this domain has not been found since {{.Since}}. Unless it is back, the domain is switched off on {{.Date}}.",
|
||||
"pages.domain_name": "Domain",
|
||||
"pages.domain_step_cname": "2. Point the domain at the status page servers with this CNAME record:",
|
||||
"pages.domain_step_cname_own": "2. Point the domain at your organization's own status page servers: a CNAME record to their host name, or A/AAAA records to their addresses.",
|
||||
"pages.domain_step_cname_unknown": "2. Point the domain at the platform's status page servers with a CNAME record; the operator of this installation tells you its target.",
|
||||
"pages.domain_step_tls": "3. HTTPS: the certificate is obtained automatically on the first visit over HTTPS, which can take up to a minute. To protect the certificate authority's limits that all organizations share, new certificates are limited per day, and the domain can be changed at most {{.Count}} times a day.",
|
||||
"pages.domain_step_cname_own": "Then point the domain at your organization's own status page servers: a CNAME record to their host name, or A/AAAA records to their addresses.",
|
||||
"pages.domain_step_cname_unknown": "Then point the domain at the platform's status page servers with a CNAME record; the operator of this installation tells you its target.",
|
||||
"pages.domain_step_tls": "HTTPS: the certificate is obtained automatically on the first visit over HTTPS, which can take up to a minute. To protect the certificate authority's limits that all organizations share, new certificates are limited per day, and the domain can be changed at most {{.Count}} times a day.",
|
||||
"pages.domain_step_verified": "1. Domain verified.",
|
||||
"pages.domain_step_verify": "1. Prove the domain is yours with this TXT record, then verify. Until then the domain is neither served nor given a certificate.",
|
||||
"pages.domain_step_verify": "Prove the domain is yours with this TXT record, then verify. Until then the domain is neither served nor given a certificate.",
|
||||
"pages.domain_verified": "Domain verified.",
|
||||
"pages.domain_verified_by_cname": "Domain verified by its CNAME record.",
|
||||
"pages.domain_verified_by_txt": "Domain verified by its TXT record.",
|
||||
"pages.draft": "draft",
|
||||
"pages.export": "Export as HTML",
|
||||
"pages.group": "Group",
|
||||
@@ -1289,6 +1299,7 @@
|
||||
"pages.title": "Status pages",
|
||||
"pages.value": "Value",
|
||||
"pages.verify": "Verify",
|
||||
"pages.verify_now": "Check now",
|
||||
"perm.audit.read": "View the audit log",
|
||||
"perm.incidents.read": "View incidents",
|
||||
"perm.incidents.write": "Manage incidents",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
-- +goose Up
|
||||
-- Custom domains are verified by a CNAME to a target unique to the page, or
|
||||
-- by the TXT record, and checked again while they are in use: a domain that
|
||||
-- no longer points at the page is switched off after a grace period, so a
|
||||
-- record left behind cannot be taken over. Domains verified before this
|
||||
-- have no method and are not checked again.
|
||||
ALTER TABLE status_pages
|
||||
ADD COLUMN domain_set_at timestamptz,
|
||||
ADD COLUMN domain_checked_at timestamptz,
|
||||
ADD COLUMN domain_failing_since timestamptz,
|
||||
ADD COLUMN domain_verify_method text CHECK (domain_verify_method IN ('cname', 'txt'));
|
||||
UPDATE status_pages SET domain_set_at = updated_at WHERE custom_domain IS NOT NULL;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE status_pages
|
||||
DROP COLUMN domain_verify_method,
|
||||
DROP COLUMN domain_failing_since,
|
||||
DROP COLUMN domain_checked_at,
|
||||
DROP COLUMN domain_set_at;
|
||||
@@ -418,6 +418,10 @@ type StatusPage struct {
|
||||
ShowComponentDetails bool
|
||||
SuspendedAt *time.Time
|
||||
SuspendedReason string
|
||||
DomainSetAt *time.Time
|
||||
DomainCheckedAt *time.Time
|
||||
DomainFailingSince *time.Time
|
||||
DomainVerifyMethod *string
|
||||
}
|
||||
|
||||
type StatusPageGroup struct {
|
||||
|
||||
@@ -118,6 +118,11 @@ type Querier interface {
|
||||
DeleteSuccessEvidence(ctx context.Context, arg DeleteSuccessEvidenceParams) error
|
||||
DeleteUser(ctx context.Context, id uuid.UUID) (int64, error)
|
||||
DisableTOTP(ctx context.Context, id uuid.UUID) error
|
||||
// System scope: domains due for a look at their DNS records. A new one is
|
||||
// looked at every minute for a quarter of an hour, then every ten minutes
|
||||
// for two days, after which only the verify button tries again. A verified
|
||||
// one is checked daily, hourly once its record went missing.
|
||||
DomainsToCheck(ctx context.Context, arg DomainsToCheckParams) ([]DomainsToCheckRow, error)
|
||||
EmailKeyTaken(ctx context.Context, emailKey *string) (bool, error)
|
||||
EnableTOTP(ctx context.Context, arg EnableTOTPParams) error
|
||||
EnqueueNotification(ctx context.Context, arg EnqueueNotificationParams) error
|
||||
@@ -261,7 +266,11 @@ type Querier interface {
|
||||
// their group or one of its ancestors.
|
||||
MaintenanceForMonitors(ctx context.Context, ids []uuid.UUID) ([]MaintenanceForMonitorsRow, error)
|
||||
MakeAdmin(ctx context.Context, id uuid.UUID) error
|
||||
MarkDomainVerified(ctx context.Context, id uuid.UUID) error
|
||||
// The record of a domain was not found. Returns since when it has not
|
||||
// been, for a verified domain.
|
||||
MarkDomainUnconfirmed(ctx context.Context, arg MarkDomainUnconfirmedParams) (*time.Time, error)
|
||||
// The domain's record was found: verified, or still in place.
|
||||
MarkDomainVerified(ctx context.Context, arg MarkDomainVerifiedParams) error
|
||||
MarkEmailVerified(ctx context.Context, id uuid.UUID) (User, error)
|
||||
MarkInvitationAccepted(ctx context.Context, id uuid.UUID) (int64, error)
|
||||
MarkNotificationFailed(ctx context.Context, arg MarkNotificationFailedParams) error
|
||||
@@ -353,7 +362,7 @@ type Querier interface {
|
||||
SetOwner(ctx context.Context, arg SetOwnerParams) (int64, error)
|
||||
SetPasswordHash(ctx context.Context, arg SetPasswordHashParams) error
|
||||
SetPlatformSetting(ctx context.Context, arg SetPlatformSettingParams) error
|
||||
// Changing the domain drops a previous verification.
|
||||
// Changing the domain drops a previous verification and its checks.
|
||||
SetStatusPageDomain(ctx context.Context, arg SetStatusPageDomainParams) (StatusPage, error)
|
||||
SetStatusPageMonitorGroup(ctx context.Context, arg SetStatusPageMonitorGroupParams) error
|
||||
SetSupportTicketStatus(ctx context.Context, arg SetSupportTicketStatusParams) (int64, error)
|
||||
@@ -391,6 +400,8 @@ type Querier interface {
|
||||
TouchAgentInstance(ctx context.Context, arg TouchAgentInstanceParams) error
|
||||
TouchIdentity(ctx context.Context, arg TouchIdentityParams) error
|
||||
TouchPlatformIdentity(ctx context.Context, arg TouchPlatformIdentityParams) error
|
||||
// A verified domain whose record stayed missing past the grace period.
|
||||
UnverifyDomain(ctx context.Context, id uuid.UUID) error
|
||||
UpdateAlertGroup(ctx context.Context, arg UpdateAlertGroupParams) (AlertGroup, error)
|
||||
UpdateChannel(ctx context.Context, arg UpdateChannelParams) (NotificationChannel, error)
|
||||
UpdateGroup(ctx context.Context, arg UpdateGroupParams) (MonitorGroup, error)
|
||||
|
||||
@@ -16,16 +16,63 @@ WHERE id = $1
|
||||
RETURNING *;
|
||||
|
||||
-- name: SetStatusPageDomain :one
|
||||
-- Changing the domain drops a previous verification.
|
||||
-- Changing the domain drops a previous verification and its checks.
|
||||
UPDATE status_pages SET
|
||||
custom_domain = sqlc.narg(custom_domain),
|
||||
domain_verified_at = CASE WHEN custom_domain IS NOT DISTINCT FROM sqlc.narg(custom_domain) THEN domain_verified_at END,
|
||||
domain_verify_method = CASE WHEN custom_domain IS NOT DISTINCT FROM sqlc.narg(custom_domain) THEN domain_verify_method END,
|
||||
domain_failing_since = CASE WHEN custom_domain IS NOT DISTINCT FROM sqlc.narg(custom_domain) THEN domain_failing_since END,
|
||||
domain_checked_at = CASE WHEN custom_domain IS NOT DISTINCT FROM sqlc.narg(custom_domain) THEN domain_checked_at END,
|
||||
domain_set_at = CASE WHEN custom_domain IS NOT DISTINCT FROM sqlc.narg(custom_domain) THEN domain_set_at ELSE now() END,
|
||||
custom_domain = sqlc.narg(custom_domain),
|
||||
updated_at = now()
|
||||
WHERE id = sqlc.arg(id)
|
||||
RETURNING *;
|
||||
|
||||
-- name: MarkDomainVerified :exec
|
||||
UPDATE status_pages SET domain_verified_at = now() WHERE id = $1;
|
||||
-- The domain's record was found: verified, or still in place.
|
||||
UPDATE status_pages SET
|
||||
domain_verified_at = coalesce(domain_verified_at, sqlc.arg(now)::timestamptz),
|
||||
domain_verify_method = sqlc.arg(method)::text,
|
||||
domain_checked_at = sqlc.arg(now)::timestamptz,
|
||||
domain_failing_since = NULL
|
||||
WHERE id = sqlc.arg(id);
|
||||
|
||||
-- name: MarkDomainUnconfirmed :one
|
||||
-- The record of a domain was not found. Returns since when it has not
|
||||
-- been, for a verified domain.
|
||||
UPDATE status_pages SET
|
||||
domain_checked_at = sqlc.arg(now)::timestamptz,
|
||||
domain_failing_since = CASE WHEN domain_verified_at IS NULL THEN NULL
|
||||
ELSE coalesce(domain_failing_since, sqlc.arg(now)::timestamptz) END
|
||||
WHERE id = sqlc.arg(id)
|
||||
RETURNING domain_failing_since;
|
||||
|
||||
-- name: UnverifyDomain :exec
|
||||
-- A verified domain whose record stayed missing past the grace period.
|
||||
UPDATE status_pages SET
|
||||
domain_verified_at = NULL, domain_verify_method = NULL, domain_failing_since = NULL
|
||||
WHERE id = $1;
|
||||
|
||||
-- name: DomainsToCheck :many
|
||||
-- System scope: domains due for a look at their DNS records. A new one is
|
||||
-- looked at every minute for a quarter of an hour, then every ten minutes
|
||||
-- for two days, after which only the verify button tries again. A verified
|
||||
-- one is checked daily, hourly once its record went missing.
|
||||
SELECT id, org_id, title, custom_domain::text AS domain, domain_token,
|
||||
domain_verified_at, domain_failing_since
|
||||
FROM status_pages
|
||||
WHERE custom_domain IS NOT NULL
|
||||
AND (sqlc.narg(page_id)::uuid IS NULL OR id = sqlc.narg(page_id))
|
||||
AND (
|
||||
(domain_verified_at IS NULL AND domain_set_at > sqlc.arg(now)::timestamptz - interval '48 hours'
|
||||
AND (domain_checked_at IS NULL OR domain_checked_at <= sqlc.arg(now)::timestamptz - CASE
|
||||
WHEN domain_set_at > sqlc.arg(now)::timestamptz - interval '15 minutes' THEN interval '50 seconds'
|
||||
ELSE interval '10 minutes' END))
|
||||
OR (domain_verified_at IS NOT NULL AND domain_verify_method IS NOT NULL
|
||||
AND (domain_checked_at IS NULL OR domain_checked_at <= sqlc.arg(now)::timestamptz - CASE
|
||||
WHEN domain_failing_since IS NULL THEN interval '24 hours' ELSE interval '1 hour' END)))
|
||||
ORDER BY domain_checked_at NULLS FIRST
|
||||
LIMIT 500;
|
||||
|
||||
-- name: GetStatusPage :one
|
||||
SELECT * FROM status_pages WHERE id = $1;
|
||||
|
||||
@@ -7,6 +7,7 @@ package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
@@ -60,7 +61,7 @@ func (q *Queries) ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID)
|
||||
const createStatusPage = `-- name: CreateStatusPage :one
|
||||
INSERT INTO status_pages (org_id, slug, title, description, published, show_component_details, domain_token, theme)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason
|
||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method
|
||||
`
|
||||
|
||||
type CreateStatusPageParams struct {
|
||||
@@ -102,6 +103,10 @@ func (q *Queries) CreateStatusPage(ctx context.Context, arg CreateStatusPagePara
|
||||
&i.ShowComponentDetails,
|
||||
&i.SuspendedAt,
|
||||
&i.SuspendedReason,
|
||||
&i.DomainSetAt,
|
||||
&i.DomainCheckedAt,
|
||||
&i.DomainFailingSince,
|
||||
&i.DomainVerifyMethod,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@@ -171,8 +176,73 @@ func (q *Queries) DeleteStatusPageGroup(ctx context.Context, arg DeleteStatusPag
|
||||
return result.RowsAffected(), nil
|
||||
}
|
||||
|
||||
const domainsToCheck = `-- name: DomainsToCheck :many
|
||||
SELECT id, org_id, title, custom_domain::text AS domain, domain_token,
|
||||
domain_verified_at, domain_failing_since
|
||||
FROM status_pages
|
||||
WHERE custom_domain IS NOT NULL
|
||||
AND ($1::uuid IS NULL OR id = $1)
|
||||
AND (
|
||||
(domain_verified_at IS NULL AND domain_set_at > $2::timestamptz - interval '48 hours'
|
||||
AND (domain_checked_at IS NULL OR domain_checked_at <= $2::timestamptz - CASE
|
||||
WHEN domain_set_at > $2::timestamptz - interval '15 minutes' THEN interval '50 seconds'
|
||||
ELSE interval '10 minutes' END))
|
||||
OR (domain_verified_at IS NOT NULL AND domain_verify_method IS NOT NULL
|
||||
AND (domain_checked_at IS NULL OR domain_checked_at <= $2::timestamptz - CASE
|
||||
WHEN domain_failing_since IS NULL THEN interval '24 hours' ELSE interval '1 hour' END)))
|
||||
ORDER BY domain_checked_at NULLS FIRST
|
||||
LIMIT 500
|
||||
`
|
||||
|
||||
type DomainsToCheckParams struct {
|
||||
PageID *uuid.UUID
|
||||
Now time.Time
|
||||
}
|
||||
|
||||
type DomainsToCheckRow struct {
|
||||
ID uuid.UUID
|
||||
OrgID uuid.UUID
|
||||
Title string
|
||||
Domain string
|
||||
DomainToken string
|
||||
DomainVerifiedAt *time.Time
|
||||
DomainFailingSince *time.Time
|
||||
}
|
||||
|
||||
// System scope: domains due for a look at their DNS records. A new one is
|
||||
// looked at every minute for a quarter of an hour, then every ten minutes
|
||||
// for two days, after which only the verify button tries again. A verified
|
||||
// one is checked daily, hourly once its record went missing.
|
||||
func (q *Queries) DomainsToCheck(ctx context.Context, arg DomainsToCheckParams) ([]DomainsToCheckRow, error) {
|
||||
rows, err := q.db.Query(ctx, domainsToCheck, arg.PageID, arg.Now)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []DomainsToCheckRow{}
|
||||
for rows.Next() {
|
||||
var i DomainsToCheckRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.OrgID,
|
||||
&i.Title,
|
||||
&i.Domain,
|
||||
&i.DomainToken,
|
||||
&i.DomainVerifiedAt,
|
||||
&i.DomainFailingSince,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const findPublishedPage = `-- name: FindPublishedPage :one
|
||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason FROM status_pages
|
||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method FROM status_pages
|
||||
WHERE published AND suspended_at IS NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM orgs o WHERE o.id = status_pages.org_id AND o.suspended_at IS NOT NULL)
|
||||
AND (($1::citext IS NOT NULL AND custom_domain = $1 AND domain_verified_at IS NOT NULL)
|
||||
@@ -205,12 +275,16 @@ func (q *Queries) FindPublishedPage(ctx context.Context, arg FindPublishedPagePa
|
||||
&i.ShowComponentDetails,
|
||||
&i.SuspendedAt,
|
||||
&i.SuspendedReason,
|
||||
&i.DomainSetAt,
|
||||
&i.DomainCheckedAt,
|
||||
&i.DomainFailingSince,
|
||||
&i.DomainVerifyMethod,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getStatusPage = `-- name: GetStatusPage :one
|
||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason FROM status_pages WHERE id = $1
|
||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method FROM status_pages WHERE id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage, error) {
|
||||
@@ -232,6 +306,10 @@ func (q *Queries) GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage,
|
||||
&i.ShowComponentDetails,
|
||||
&i.SuspendedAt,
|
||||
&i.SuspendedReason,
|
||||
&i.DomainSetAt,
|
||||
&i.DomainCheckedAt,
|
||||
&i.DomainFailingSince,
|
||||
&i.DomainVerifyMethod,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@@ -272,7 +350,7 @@ func (q *Queries) ListStatusPageGroups(ctx context.Context, pageID uuid.UUID) ([
|
||||
}
|
||||
|
||||
const listStatusPages = `-- name: ListStatusPages :many
|
||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason FROM status_pages ORDER BY title
|
||||
SELECT id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method FROM status_pages ORDER BY title
|
||||
`
|
||||
|
||||
func (q *Queries) ListStatusPages(ctx context.Context) ([]StatusPage, error) {
|
||||
@@ -300,6 +378,10 @@ func (q *Queries) ListStatusPages(ctx context.Context) ([]StatusPage, error) {
|
||||
&i.ShowComponentDetails,
|
||||
&i.SuspendedAt,
|
||||
&i.SuspendedReason,
|
||||
&i.DomainSetAt,
|
||||
&i.DomainCheckedAt,
|
||||
&i.DomainFailingSince,
|
||||
&i.DomainVerifyMethod,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -311,12 +393,47 @@ func (q *Queries) ListStatusPages(ctx context.Context) ([]StatusPage, error) {
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const markDomainVerified = `-- name: MarkDomainVerified :exec
|
||||
UPDATE status_pages SET domain_verified_at = now() WHERE id = $1
|
||||
const markDomainUnconfirmed = `-- name: MarkDomainUnconfirmed :one
|
||||
UPDATE status_pages SET
|
||||
domain_checked_at = $1::timestamptz,
|
||||
domain_failing_since = CASE WHEN domain_verified_at IS NULL THEN NULL
|
||||
ELSE coalesce(domain_failing_since, $1::timestamptz) END
|
||||
WHERE id = $2
|
||||
RETURNING domain_failing_since
|
||||
`
|
||||
|
||||
func (q *Queries) MarkDomainVerified(ctx context.Context, id uuid.UUID) error {
|
||||
_, err := q.db.Exec(ctx, markDomainVerified, id)
|
||||
type MarkDomainUnconfirmedParams struct {
|
||||
Now time.Time
|
||||
ID uuid.UUID
|
||||
}
|
||||
|
||||
// The record of a domain was not found. Returns since when it has not
|
||||
// been, for a verified domain.
|
||||
func (q *Queries) MarkDomainUnconfirmed(ctx context.Context, arg MarkDomainUnconfirmedParams) (*time.Time, error) {
|
||||
row := q.db.QueryRow(ctx, markDomainUnconfirmed, arg.Now, arg.ID)
|
||||
var domain_failing_since *time.Time
|
||||
err := row.Scan(&domain_failing_since)
|
||||
return domain_failing_since, err
|
||||
}
|
||||
|
||||
const markDomainVerified = `-- name: MarkDomainVerified :exec
|
||||
UPDATE status_pages SET
|
||||
domain_verified_at = coalesce(domain_verified_at, $1::timestamptz),
|
||||
domain_verify_method = $2::text,
|
||||
domain_checked_at = $1::timestamptz,
|
||||
domain_failing_since = NULL
|
||||
WHERE id = $3
|
||||
`
|
||||
|
||||
type MarkDomainVerifiedParams struct {
|
||||
Now time.Time
|
||||
Method string
|
||||
ID uuid.UUID
|
||||
}
|
||||
|
||||
// The domain's record was found: verified, or still in place.
|
||||
func (q *Queries) MarkDomainVerified(ctx context.Context, arg MarkDomainVerifiedParams) error {
|
||||
_, err := q.db.Exec(ctx, markDomainVerified, arg.Now, arg.Method, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -394,11 +511,15 @@ func (q *Queries) ServablePages(ctx context.Context, agentOrg *uuid.UUID) ([]Ser
|
||||
|
||||
const setStatusPageDomain = `-- name: SetStatusPageDomain :one
|
||||
UPDATE status_pages SET
|
||||
custom_domain = $1,
|
||||
domain_verified_at = CASE WHEN custom_domain IS NOT DISTINCT FROM $1 THEN domain_verified_at END,
|
||||
domain_verify_method = CASE WHEN custom_domain IS NOT DISTINCT FROM $1 THEN domain_verify_method END,
|
||||
domain_failing_since = CASE WHEN custom_domain IS NOT DISTINCT FROM $1 THEN domain_failing_since END,
|
||||
domain_checked_at = CASE WHEN custom_domain IS NOT DISTINCT FROM $1 THEN domain_checked_at END,
|
||||
domain_set_at = CASE WHEN custom_domain IS NOT DISTINCT FROM $1 THEN domain_set_at ELSE now() END,
|
||||
custom_domain = $1,
|
||||
updated_at = now()
|
||||
WHERE id = $2
|
||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason
|
||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method
|
||||
`
|
||||
|
||||
type SetStatusPageDomainParams struct {
|
||||
@@ -406,7 +527,7 @@ type SetStatusPageDomainParams struct {
|
||||
ID uuid.UUID
|
||||
}
|
||||
|
||||
// Changing the domain drops a previous verification.
|
||||
// Changing the domain drops a previous verification and its checks.
|
||||
func (q *Queries) SetStatusPageDomain(ctx context.Context, arg SetStatusPageDomainParams) (StatusPage, error) {
|
||||
row := q.db.QueryRow(ctx, setStatusPageDomain, arg.CustomDomain, arg.ID)
|
||||
var i StatusPage
|
||||
@@ -426,6 +547,10 @@ func (q *Queries) SetStatusPageDomain(ctx context.Context, arg SetStatusPageDoma
|
||||
&i.ShowComponentDetails,
|
||||
&i.SuspendedAt,
|
||||
&i.SuspendedReason,
|
||||
&i.DomainSetAt,
|
||||
&i.DomainCheckedAt,
|
||||
&i.DomainFailingSince,
|
||||
&i.DomainVerifyMethod,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@@ -506,6 +631,18 @@ func (q *Queries) StatusPageMonitors(ctx context.Context, pageID uuid.UUID) ([]S
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const unverifyDomain = `-- name: UnverifyDomain :exec
|
||||
UPDATE status_pages SET
|
||||
domain_verified_at = NULL, domain_verify_method = NULL, domain_failing_since = NULL
|
||||
WHERE id = $1
|
||||
`
|
||||
|
||||
// A verified domain whose record stayed missing past the grace period.
|
||||
func (q *Queries) UnverifyDomain(ctx context.Context, id uuid.UUID) error {
|
||||
_, err := q.db.Exec(ctx, unverifyDomain, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateStatusPage = `-- name: UpdateStatusPage :one
|
||||
UPDATE status_pages
|
||||
SET slug = $2,
|
||||
@@ -516,7 +653,7 @@ SET slug = $2,
|
||||
theme = $7,
|
||||
updated_at = now()
|
||||
WHERE id = $1
|
||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason
|
||||
RETURNING id, org_id, slug, title, description, published, custom_domain, domain_token, domain_verified_at, theme, created_at, updated_at, show_component_details, suspended_at, suspended_reason, domain_set_at, domain_checked_at, domain_failing_since, domain_verify_method
|
||||
`
|
||||
|
||||
type UpdateStatusPageParams struct {
|
||||
@@ -556,6 +693,10 @@ func (q *Queries) UpdateStatusPage(ctx context.Context, arg UpdateStatusPagePara
|
||||
&i.ShowComponentDetails,
|
||||
&i.SuspendedAt,
|
||||
&i.SuspendedReason,
|
||||
&i.DomainSetAt,
|
||||
&i.DomainCheckedAt,
|
||||
&i.DomainFailingSince,
|
||||
&i.DomainVerifyMethod,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
+374
-226
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user