diff --git a/docs/clustering.md b/docs/clustering.md index 0aefcf95..6ff4b0dd 100644 --- a/docs/clustering.md +++ b/docs/clustering.md @@ -53,6 +53,15 @@ the ML-DSA CA, so a node that hasn't learned the new anchor keeps verifying the ECDSA one. Either way the connection's key exchange is the X25519MLKEM768 hybrid. ACME and imported certificates stay classical. +A cluster made before ML-DSA certificates has the ECDSA chain only. Once every +node runs a release with ML-DSA support, the primary's **Cluster** page offers +**Upgrade to Post-Quantum** in the **Post-Quantum Certificates** card. Each node +then adds the ML-DSA CA and certificate to its own Sable Private CA within a +minute, without a restart, and the card shows each node's state. The ECDSA +chain stays, so nothing changes for browsers. A node with an ACME or imported +certificate is left as it is. Don't downgrade a node below this release once +it is upgraded: older releases can't read the ML-DSA CA in its trust anchor. + ## Create the primary 1. Open **Cluster → Initialize Primary**. diff --git a/internal/app/process.go b/internal/app/process.go index 3b78d9aa..d41f2ad7 100644 --- a/internal/app/process.go +++ b/internal/app/process.go @@ -639,6 +639,7 @@ func (process *process) startWeb(ctx context.Context) error { if err := process.clusterService.SetUpdateController(process.updateManager, requestRestart); err != nil { process.logger.Error("restore cluster update progress", "error", err) } + process.clusterService.SetPQCertificateUpgrader(process.upgradePQClusterCertificates) initial := process.initial if err := webServer.Start(initial.Server.HTTPListen); err != nil { return err @@ -652,6 +653,22 @@ func (process *process) startWeb(ctx context.Context) error { return nil } +// upgradePQClusterCertificates adds ML-DSA certificates to this node's +// generated cluster PKI and has the HTTPS listener serve them to peers that +// ask. A node with an imported or ACME certificate is left as it is. +func (process *process) upgradePQClusterCertificates(ctx context.Context) error { + current := process.current() + anchor := current.ClusterTrustAnchorPath(process.configurationDirectory) + if anchor == "" || current.EncryptedDNS.CertificateMode != "manual" || current.Server.HTTPSListen == "" { + return certificates.ErrNotGeneratedClusterPKI + } + certificate, privateKey := current.EncryptedDNSCertificatePaths(process.configurationDirectory) + if err := process.certificateManager.AddClusterPQ(ctx, anchor, certificate, privateKey); err != nil { + return err + } + return process.webServer.ReplaceCertificate(certificate, privateKey) +} + func (process *process) newWebServer() error { var webAuthentication web.Authenticator if process.authentication != nil { diff --git a/internal/certificates/cluster_pq.go b/internal/certificates/cluster_pq.go index 486d6b5e..d09c18e8 100644 --- a/internal/certificates/cluster_pq.go +++ b/internal/certificates/cluster_pq.go @@ -2,11 +2,13 @@ package certificates import ( "bytes" + "context" "crypto/mldsa" "crypto/rand" "crypto/x509" "crypto/x509/pkix" "encoding/pem" + "errors" "fmt" "net" "os" @@ -125,6 +127,13 @@ func (pq clusterPQ) commit(caKey *mldsa.PrivateKey, caDER []byte, nodeKey *mldsa if err := writeAtomic(pq.caKeyFile, caKeyPEM, 0o600); err != nil { return fmt.Errorf("write ML-DSA cluster CA private key: %w", err) } + // The node certificate goes first and the trust anchor last. Peers ask + // for the ML-DSA certificate only once the anchor carries its CA, so an + // upgrade cut short leaves nothing that a peer would reach for, and the + // next attempt starts again from a classical anchor. + if err := commitKeyPair(pq.certificateFile, pq.keyFile, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: nodeDER}), nodeKeyPEM); err != nil { + return err + } anchor, err := os.ReadFile(pq.caFile) if err != nil { return fmt.Errorf("read cluster CA certificate: %w", err) @@ -136,5 +145,84 @@ func (pq clusterPQ) commit(caKey *mldsa.PrivateKey, caDER []byte, nodeKey *mldsa if err := writeAtomic(pq.caFile, anchor, 0o600); err != nil { return fmt.Errorf("write cluster CA certificate: %w", err) } - return commitKeyPair(pq.certificateFile, pq.keyFile, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: nodeDER}), nodeKeyPEM) + return nil +} + +// ErrNotGeneratedClusterPKI means a node's HTTPS certificate doesn't come +// from a cluster CA that Sable generated and holds the key for, so Sable +// can't add ML-DSA certificates beside it. +var ErrNotGeneratedClusterPKI = errors.New("the HTTPS certificate is not from a Sable-generated cluster CA") + +// AddClusterPQ adds the ML-DSA half to a cluster PKI that GenerateClusterPKI +// made before it made one itself: an ML-DSA CA appended to caFile, and an +// ML-DSA node certificate beside certificateFile with the same names and +// expiry. The classical CA and certificate stay as they are, so browsers and +// older peers see no change. It does nothing when caFile already has an +// ML-DSA CA. +func (manager *Manager) AddClusterPQ(_ context.Context, caFile, certificateFile, privateKeyFile string) error { + directory := filepath.Dir(caFile) + if _, err := os.Stat(filepath.Join(directory, "cluster-ca-private-key.pem")); err != nil { + return ErrNotGeneratedClusterPKI + } + anchor, err := os.ReadFile(caFile) + if err != nil { + return fmt.Errorf("read cluster CA certificate: %w", err) + } + if ContainsMLDSA(anchor) { + return nil + } + leaf, err := readLeaf(certificateFile) + if err != nil { + return err + } + if !signedByAnchor(leaf, anchor) { + return ErrNotGeneratedClusterPKI + } + now := manager.now().UTC() + if !leaf.NotAfter.After(now) { + return errors.New("the cluster node certificate has expired; generate a new one first") + } + pqCertificateFile, pqKeyFile := PQCompanionPaths(certificateFile, privateKeyFile) + pq := clusterPQ{ + caFile: caFile, caKeyFile: filepath.Join(directory, "cluster-ca-mldsa-private-key.pem"), + certificateFile: pqCertificateFile, keyFile: pqKeyFile, + nodeName: leaf.Subject.CommonName, dnsNames: leaf.DNSNames, ipAddresses: leaf.IPAddresses, + now: now, validFor: leaf.NotAfter.Sub(now), + } + if err := pq.write(); err != nil { + return err + } + manager.logger.Info("ML-DSA certificates added to the private cluster PKI", "node", leaf.Subject.CommonName, "node_expires", leaf.NotAfter) + return nil +} + +func readLeaf(certificateFile string) (*x509.Certificate, error) { + contents, err := os.ReadFile(certificateFile) + if err != nil { + return nil, fmt.Errorf("read cluster node certificate: %w", err) + } + block, _ := pem.Decode(contents) + if block == nil || block.Type != "CERTIFICATE" { + return nil, errors.New("cluster node certificate is not PEM encoded") + } + leaf, err := x509.ParseCertificate(block.Bytes) + if err != nil { + return nil, fmt.Errorf("parse cluster node certificate: %w", err) + } + return leaf, nil +} + +func signedByAnchor(leaf *x509.Certificate, anchor []byte) bool { + for rest := anchor; len(rest) > 0; { + block, remaining := pem.Decode(rest) + if block == nil { + return false + } + rest = remaining + ca, err := x509.ParseCertificate(block.Bytes) + if err == nil && ca.IsCA && leaf.CheckSignatureFrom(ca) == nil { + return true + } + } + return false } diff --git a/internal/certificates/cluster_pq_test.go b/internal/certificates/cluster_pq_test.go new file mode 100644 index 00000000..617289be --- /dev/null +++ b/internal/certificates/cluster_pq_test.go @@ -0,0 +1,114 @@ +package certificates + +import ( + "bytes" + "context" + "crypto/tls" + "crypto/x509" + "encoding/pem" + "errors" + "io" + "log/slog" + "os" + "path/filepath" + "slices" + "testing" + "time" +) + +// classicalClusterPKI generates a cluster PKI and strips its ML-DSA half, as +// a release before ML-DSA certificates left it. +func classicalClusterPKI(t *testing.T) (*Manager, string, string, string) { + t.Helper() + directory := t.TempDir() + manager := New(&memoryVault{}, slog.New(slog.NewTextHandler(io.Discard, nil)), directory) + result, err := manager.GenerateClusterPKI(context.Background(), ClusterPKIOptions{ + NodeName: "dns-1", Names: []string{"dns-1.example.test", "192.0.2.10"}, ValidFor: 365 * 24 * time.Hour, + }) + if err != nil { + t.Fatal(err) + } + caFile := filepath.Join(directory, result.CAFile) + certificateFile := filepath.Join(directory, result.CertificateFile) + keyFile := filepath.Join(directory, result.PrivateKeyFile) + anchor, err := os.ReadFile(caFile) + if err != nil { + t.Fatal(err) + } + block, _ := pem.Decode(anchor) + if err := os.WriteFile(caFile, pem.EncodeToMemory(block), 0o600); err != nil { + t.Fatal(err) + } + pqCertificate, pqKey := PQCompanionPaths(certificateFile, keyFile) + for _, file := range []string{pqCertificate, pqKey, filepath.Join(filepath.Dir(caFile), "cluster-ca-mldsa-private-key.pem")} { + if err := os.Remove(file); err != nil { + t.Fatal(err) + } + } + return manager, caFile, certificateFile, keyFile +} + +func TestAddClusterPQUpgradesAClassicalClusterPKI(t *testing.T) { + manager, caFile, certificateFile, keyFile := classicalClusterPKI(t) + before, _ := os.ReadFile(caFile) + classicalBefore, _ := os.ReadFile(certificateFile) + if err := manager.AddClusterPQ(context.Background(), caFile, certificateFile, keyFile); err != nil { + t.Fatal(err) + } + after, err := os.ReadFile(caFile) + if err != nil { + t.Fatal(err) + } + if !bytes.HasPrefix(after, before) || !ContainsMLDSA(after) { + t.Fatal("the trust anchor should keep its classical CA and gain an ML-DSA one") + } + if classicalAfter, _ := os.ReadFile(certificateFile); !bytes.Equal(classicalAfter, classicalBefore) { + t.Fatal("the classical node certificate changed") + } + classical, err := readLeaf(certificateFile) + if err != nil { + t.Fatal(err) + } + pqCertificate, pqKey := PQCompanionPaths(certificateFile, keyFile) + pair, err := tls.LoadX509KeyPair(pqCertificate, pqKey) + if err != nil { + t.Fatal(err) + } + leaf := pair.Leaf + if leaf.PublicKeyAlgorithm != x509.MLDSA { + t.Fatalf("companion key is %v, want ML-DSA", leaf.PublicKeyAlgorithm) + } + if !slices.Equal(leaf.DNSNames, classical.DNSNames) || len(leaf.IPAddresses) != len(classical.IPAddresses) || + leaf.Subject.CommonName != classical.Subject.CommonName || leaf.NotAfter.After(classical.NotAfter) { + t.Fatalf("companion certificate names or lifetime differ: %v %v %v", leaf.DNSNames, leaf.IPAddresses, leaf.NotAfter) + } + pool := x509.NewCertPool() + pool.AppendCertsFromPEM(after) + if _, err := leaf.Verify(x509.VerifyOptions{Roots: pool, DNSName: "dns-1.example.test"}); err != nil { + t.Fatal(err) + } + + if err := manager.AddClusterPQ(context.Background(), caFile, certificateFile, keyFile); err != nil { + t.Fatal(err) + } + if again, _ := os.ReadFile(caFile); !bytes.Equal(again, after) { + t.Fatal("a second upgrade changed an anchor that already has an ML-DSA CA") + } +} + +func TestAddClusterPQRefusesCertificatesSableDidNotIssue(t *testing.T) { + manager, caFile, _, _ := classicalClusterPKI(t) + directory := t.TempDir() + other := New(&memoryVault{}, slog.New(slog.NewTextHandler(io.Discard, nil)), directory) + foreign, err := other.GenerateSelfSigned(context.Background(), ManualCertificateOptions{Names: []string{"dns-1.example.test"}}) + if err != nil { + t.Fatal(err) + } + err = manager.AddClusterPQ(context.Background(), caFile, filepath.Join(directory, foreign.CertificateFile), filepath.Join(directory, foreign.PrivateKeyFile)) + if !errors.Is(err, ErrNotGeneratedClusterPKI) { + t.Fatalf("err = %v, want ErrNotGeneratedClusterPKI", err) + } + if err := manager.AddClusterPQ(context.Background(), filepath.Join(directory, foreign.CertificateFile), filepath.Join(directory, foreign.CertificateFile), filepath.Join(directory, foreign.PrivateKeyFile)); !errors.Is(err, ErrNotGeneratedClusterPKI) { + t.Fatalf("err = %v, want ErrNotGeneratedClusterPKI without a CA key", err) + } +} diff --git a/internal/cluster/enrollment.go b/internal/cluster/enrollment.go index 49da119e..df9c443b 100644 --- a/internal/cluster/enrollment.go +++ b/internal/cluster/enrollment.go @@ -102,6 +102,8 @@ type JoinConfiguration struct { Members []Member `json:"members"` UpdateCommand *UpdateCommand `json:"update_command,omitempty"` UpdateProtocol int `json:"update_protocol,omitempty"` + // PQCertificates carries the manifest's flag of the same name. + PQCertificates bool `json:"pq_certificates,omitempty"` // AlertProtocol is set only on synchronization, by a primary that takes // replicas' own alerts in their heartbeats. AlertProtocol int `json:"alert_protocol,omitempty"` @@ -454,7 +456,7 @@ func joinConfiguration(source *manifest, stateSnapshot []byte) JoinConfiguration FormatVersion: source.FormatVersion, ClusterID: source.ClusterID, ClusterDomain: source.ClusterDomain, Generation: source.Generation, Term: source.Term, UpdatedAt: source.UpdatedAt, PrimaryID: source.PrimaryID, StatusKey: source.StatusKey, StateDigest: source.StateDigest, StateSnapshot: stateSnapshot, - Members: make([]Member, 0, len(source.Nodes)), + PQCertificates: source.PQCertificates, Members: make([]Member, 0, len(source.Nodes)), } for _, node := range source.Nodes { configuration.Members = append(configuration.Members, Member{ @@ -471,7 +473,8 @@ func manifestFromJoinConfiguration(source JoinConfiguration) *manifest { result := &manifest{ FormatVersion: source.FormatVersion, ClusterID: source.ClusterID, ClusterDomain: source.ClusterDomain, Generation: source.Generation, Term: source.Term, UpdatedAt: source.UpdatedAt, PrimaryID: source.PrimaryID, - StatusKey: source.StatusKey, StateDigest: source.StateDigest, Nodes: make([]member, 0, len(source.Members)), + StatusKey: source.StatusKey, StateDigest: source.StateDigest, PQCertificates: source.PQCertificates, + Nodes: make([]member, 0, len(source.Members)), } for _, node := range source.Members { result.Nodes = append(result.Nodes, member{ diff --git a/internal/cluster/heartbeat.go b/internal/cluster/heartbeat.go index e6dd234a..8f6826a8 100644 --- a/internal/cluster/heartbeat.go +++ b/internal/cluster/heartbeat.go @@ -81,6 +81,7 @@ type SyncConfiguration struct { Members []Member `json:"members"` UpdateCommand *UpdateCommand `json:"update_command,omitempty"` UpdateProtocol int `json:"update_protocol,omitempty"` + PQCertificates bool `json:"pq_certificates,omitempty"` AlertProtocol int `json:"alert_protocol,omitempty"` LookupProtocol int `json:"lookup_protocol,omitempty"` // ClientIdentities is a batch of the lead's client identities as a JSON @@ -118,6 +119,7 @@ func (service *Service) StartMonitoring(ctx context.Context) { gathering.Go(func() { service.gatherLocalLookups(monitorContext) }) gathering.Go(func() { service.gatherClientIdentities(monitorContext) }) gathering.Go(func() { service.probePeers(monitorContext) }) + gathering.Go(func() { service.maintainPQCertificates(monitorContext) }) service.monitorPrimary(monitorContext) gathering.Wait() }() diff --git a/internal/cluster/pq_certificates.go b/internal/cluster/pq_certificates.go new file mode 100644 index 00000000..43edb0ab --- /dev/null +++ b/internal/cluster/pq_certificates.go @@ -0,0 +1,220 @@ +package cluster + +import ( + "bytes" + "context" + "encoding/pem" + "errors" + "slices" + "time" + + "github.com/drudge/sable/internal/certificates" +) + +// PQCertificateUpgrader adds ML-DSA certificates to this node's own cluster +// PKI and starts serving them to peers that ask (certificates.AddClusterPQ). +// It returns certificates.ErrNotGeneratedClusterPKI when the node's HTTPS +// certificate is not one Sable generated, which leaves the node as it is. +type PQCertificateUpgrader func(ctx context.Context) error + +// SetPQCertificateUpgrader installs the upgrade this node runs once the +// primary turns ML-DSA certificates on. +func (service *Service) SetPQCertificateUpgrader(upgrade PQCertificateUpgrader) { + service.mu.Lock() + defer service.mu.Unlock() + service.pqUpgrader = upgrade +} + +// The states of one node's certificates in PQCertificateStatus. +const ( + // PQCertificateMLDSA is a node whose published CA includes an ML-DSA CA. + PQCertificateMLDSA = "mldsa" + // PQCertificateClassical is a node with only a classical CA. + PQCertificateClassical = "classical" + // PQCertificatePublic is a node with a publicly trusted certificate, + // which Sable doesn't issue and so can't upgrade. + PQCertificatePublic = "public" +) + +// PQCertificateStatus is where the cluster stands on ML-DSA certificates. +type PQCertificateStatus struct { + // Enabled is set once the primary turned ML-DSA certificates on. + Enabled bool + // Outdated names the members still on a release without ML-DSA + // support. Turning ML-DSA certificates on waits for them, because a + // release before it can't read an ML-DSA CA in another node's entry. + Outdated []string + Nodes []PQCertificateNode +} + +// PQCertificateNode is one member's certificate state. +type PQCertificateNode struct { + ID string + Name string + State string +} + +// PQCertificates reports where the cluster stands on ML-DSA certificates. +func (service *Service) PQCertificates() (PQCertificateStatus, error) { + service.mu.RLock() + defer service.mu.RUnlock() + if service.manifest == nil { + return PQCertificateStatus{}, ErrNotInitialized + } + status := PQCertificateStatus{Enabled: service.manifest.PQCertificates} + for _, node := range service.manifest.Nodes { + // A member records an ML-DSA signing key only from a release that + // also reads ML-DSA certificates, so it marks the release. + if node.PQSigningKey == "" { + status.Outdated = append(status.Outdated, node.Name) + } + state := PQCertificateClassical + switch { + case node.TrustAnchor == "": + state = PQCertificatePublic + case certificates.ContainsMLDSA([]byte(node.TrustAnchor)): + state = PQCertificateMLDSA + } + status.Nodes = append(status.Nodes, PQCertificateNode{ID: node.ID, Name: node.Name, State: state}) + } + return status, nil +} + +// ErrMembersOutdated means a member still runs a release that can't read +// ML-DSA certificates. +var ErrMembersOutdated = errors.New("update every node to this release before turning on post-quantum certificates") + +// EnablePQCertificates turns ML-DSA certificates on for the whole cluster. +// Only the primary can, and only once every member runs a release that +// reads them. Each node then upgrades its own cluster PKI. +func (service *Service) EnablePQCertificates(ctx context.Context) error { + service.mu.Lock() + if service.manifest == nil { + service.mu.Unlock() + return ErrNotInitialized + } + if service.manifest.PrimaryID != service.nodeID { + service.mu.Unlock() + return ErrNotPrimary + } + if service.manifest.PQCertificates { + service.mu.Unlock() + return nil + } + if slices.ContainsFunc(service.manifest.Nodes, func(node member) bool { return node.PQSigningKey == "" }) { + service.mu.Unlock() + return ErrMembersOutdated + } + candidate := cloneManifest(service.manifest) + candidate.Generation++ + candidate.UpdatedAt = service.clock() + candidate.PQCertificates = true + if err := writeManifest(service.directory, candidate); err != nil { + service.mu.Unlock() + return err + } + service.manifest = candidate + service.mu.Unlock() + if service.logger != nil { + service.logger.Info("post-quantum cluster certificates turned on") + } + // The primary upgrades its own certificates now rather than at its + // next tick, so the Cluster page shows the change straight away. + service.upgradePQCertificatesOnce(ctx) + return nil +} + +const pqCertificateTick = time.Minute + +func (service *Service) maintainPQCertificates(ctx context.Context) { + ticker := time.NewTicker(pqCertificateTick) + defer ticker.Stop() + for { + service.upgradePQCertificatesOnce(ctx) + select { + case <-ctx.Done(): + return + case <-ticker.C: + } + } +} + +// upgradePQCertificatesOnce upgrades this node's certificates when the +// cluster wants ML-DSA ones and this node has none yet, then publishes its +// new trust anchor: in its next heartbeat as a replica, or straight into the +// manifest as the primary. Peers ask for the ML-DSA certificate only after +// that anchor reaches them, and the node serves it from the moment the +// upgrade finishes, so no peer ever asks before it is there. +func (service *Service) upgradePQCertificatesOnce(ctx context.Context) { + service.mu.RLock() + wanted := service.manifest != nil && service.manifest.PQCertificates + upgrade := service.pqUpgrader + anchorFile := service.configuredTrustAnchorFile + current := service.localTrustAnchorPEM + skipped := service.pqUpgradeSkipped + primary := service.manifest != nil && service.manifest.PrimaryID == service.nodeID + service.mu.RUnlock() + if !wanted || upgrade == nil || skipped || anchorFile == "" || certificates.ContainsMLDSA(current) { + return + } + if err := upgrade(ctx); err != nil { + if errors.Is(err, certificates.ErrNotGeneratedClusterPKI) { + service.mu.Lock() + service.pqUpgradeSkipped = true + service.mu.Unlock() + if service.logger != nil { + service.logger.Info("post-quantum cluster certificates skipped on this node", "reason", err) + } + return + } + if ctx.Err() == nil && service.logger != nil { + service.logger.Warn("add post-quantum cluster certificates", "error", err) + } + return + } + anchor, err := readConfiguredTrustAnchor(anchorFile) + if err != nil || !certificates.ContainsMLDSA(anchor) || !keepsCertificates(anchor, current) { + if service.logger != nil { + service.logger.Warn("post-quantum cluster certificates left an unexpected trust anchor", "error", err) + } + return + } + service.mu.Lock() + service.localTrustAnchorPEM = anchor + service.mu.Unlock() + if service.logger != nil { + service.logger.Info("post-quantum cluster certificates added") + } + if primary { + if err := service.refreshPrimaryState(ctx); err != nil && !errors.Is(err, ErrNotInitialized) && service.logger != nil { + service.logger.Warn("publish post-quantum cluster trust anchor", "error", err) + } + } +} + +// keepsCertificates reports whether every certificate in previous is still +// in anchor, so peers that verify this node against previous keep working. +func keepsCertificates(anchor, previous []byte) bool { + kept := certificateBlocks(anchor) + for _, block := range certificateBlocks(previous) { + if !slices.ContainsFunc(kept, func(candidate []byte) bool { return bytes.Equal(candidate, block) }) { + return false + } + } + return true +} + +func certificateBlocks(contents []byte) [][]byte { + var blocks [][]byte + for rest := contents; len(rest) > 0; { + block, remaining := pem.Decode(rest) + if block == nil { + break + } + rest = remaining + if block.Type == "CERTIFICATE" { + blocks = append(blocks, block.Bytes) + } + } + return blocks +} diff --git a/internal/cluster/pq_certificates_test.go b/internal/cluster/pq_certificates_test.go new file mode 100644 index 00000000..0f83f5c7 --- /dev/null +++ b/internal/cluster/pq_certificates_test.go @@ -0,0 +1,183 @@ +package cluster + +import ( + "context" + "encoding/pem" + "errors" + "io" + "log/slog" + "os" + "path/filepath" + "slices" + "testing" + "time" + + "github.com/drudge/sable/internal/certificates" +) + +// useClassicalClusterPKI gives service a generated cluster PKI as a release +// before ML-DSA certificates left it, and an upgrader that adds ML-DSA +// certificates to it. It returns how many times the upgrader ran. +func useClassicalClusterPKI(t *testing.T, service *Service) *int { + t.Helper() + directory := t.TempDir() + manager := certificates.New(nil, slog.New(slog.NewTextHandler(io.Discard, nil)), directory) + generated, err := manager.GenerateClusterPKI(context.Background(), certificates.ClusterPKIOptions{ + NodeName: service.nodeName, Names: []string{service.nodeName + ".example"}, StorageDirectory: "pki", ValidFor: 24 * time.Hour, + }) + if err != nil { + t.Fatal(err) + } + caFile := filepath.Join(directory, generated.CAFile) + certificateFile := filepath.Join(directory, generated.CertificateFile) + keyFile := filepath.Join(directory, generated.PrivateKeyFile) + anchor, err := os.ReadFile(caFile) + if err != nil { + t.Fatal(err) + } + block, _ := pem.Decode(anchor) + classical := pem.EncodeToMemory(block) + if err := os.WriteFile(caFile, classical, 0o600); err != nil { + t.Fatal(err) + } + pqCertificate, pqKey := certificates.PQCompanionPaths(certificateFile, keyFile) + os.Remove(pqCertificate) + os.Remove(pqKey) + runs := new(int) + service.mu.Lock() + service.configuredTrustAnchorFile = caFile + service.localTrustAnchorPEM = classical + service.mu.Unlock() + service.SetPQCertificateUpgrader(func(ctx context.Context) error { + *runs++ + return manager.AddClusterPQ(ctx, caFile, certificateFile, keyFile) + }) + return runs +} + +func pqStates(t *testing.T, service *Service) map[string]string { + t.Helper() + status, err := service.PQCertificates() + if err != nil { + t.Fatal(err) + } + states := map[string]string{} + for _, node := range status.Nodes { + states[node.Name] = node.State + } + return states +} + +// Turning ML-DSA certificates on waits for every member to run a release +// that reads them, and only the primary can do it. +func TestPQCertificatesWaitForEveryMember(t *testing.T) { + primary, replica := joinedClusterServices(t) + clearMemberPQSigningKey(t, primary, replica.nodeID) + status, err := primary.PQCertificates() + if err != nil { + t.Fatal(err) + } + if !slices.Equal(status.Outdated, []string{"dns-2"}) || status.Enabled { + t.Fatalf("status = %+v; want dns-2 outdated", status) + } + if err := primary.EnablePQCertificates(context.Background()); !errors.Is(err, ErrMembersOutdated) { + t.Fatalf("enable with an outdated member: %v", err) + } + if primary.manifest.PQCertificates { + t.Fatal("the flag was set while a member is outdated") + } + if err := replica.EnablePQCertificates(context.Background()); !errors.Is(err, ErrNotPrimary) { + t.Fatalf("enable on a replica: %v", err) + } +} + +// One click on the primary upgrades its own certificates at once, and +// publishes its new anchor so replicas start asking it for the ML-DSA +// certificate. +func TestPQCertificatesUpgradeThePrimaryAtOnce(t *testing.T) { + primary, _ := joinedClusterServices(t) + runs := useClassicalClusterPKI(t, primary) + if err := primary.refreshPrimaryState(context.Background()); err != nil { + t.Fatal(err) + } + if got := pqStates(t, primary)["dns-1"]; got != PQCertificateClassical { + t.Fatalf("primary before = %s", got) + } + // Nothing happens before the cluster asks. + primary.upgradePQCertificatesOnce(context.Background()) + if *runs != 0 { + t.Fatal("the primary upgraded before the cluster asked") + } + if err := primary.EnablePQCertificates(context.Background()); err != nil { + t.Fatal(err) + } + if got := pqStates(t, primary)["dns-1"]; got != PQCertificateMLDSA { + t.Fatalf("primary after enabling = %s; want it upgraded at once", got) + } + if primary.localTrustRestartRequired() { + t.Fatal("the upgrade left the primary asking for a restart") + } + primary.upgradePQCertificatesOnce(context.Background()) + if *runs != 1 { + t.Fatalf("upgrade ran %d times; want once", *runs) + } +} + +// A replica upgrades once it syncs the flag, and its next heartbeat puts its +// new anchor in the manifest. +func TestPQCertificatesReachReplicas(t *testing.T) { + primary, replica := joinedClusterServices(t) + runs := useClassicalClusterPKI(t, replica) + if err := replica.syncFromPrimary(context.Background()); err != nil { + t.Fatal(err) + } + replica.upgradePQCertificatesOnce(context.Background()) + if *runs != 0 { + t.Fatal("a replica upgraded before the cluster asked") + } + if got := pqStates(t, primary)["dns-2"]; got != PQCertificateClassical { + t.Fatalf("replica before = %s", got) + } + if err := primary.EnablePQCertificates(context.Background()); err != nil { + t.Fatal(err) + } + if err := replica.syncFromPrimary(context.Background()); err != nil { + t.Fatal(err) + } + replica.upgradePQCertificatesOnce(context.Background()) + if err := replica.syncFromPrimary(context.Background()); err != nil { + t.Fatal(err) + } + got := pqStates(t, primary) + if got["dns-2"] != PQCertificateMLDSA || got["dns-1"] != PQCertificatePublic { + t.Fatalf("states after the replica synced = %v", got) + } + if replica.localTrustRestartRequired() { + t.Fatal("the upgrade left the replica asking for a restart") + } + replica.upgradePQCertificatesOnce(context.Background()) + if *runs != 1 { + t.Fatalf("upgrade ran %d times; want once", *runs) + } +} + +// A node whose certificate Sable didn't issue is left as it is, and isn't +// tried again every minute. +func TestPQCertificatesSkipNodesWithoutAGeneratedPKI(t *testing.T) { + primary, _ := joinedClusterServices(t) + runs := 0 + primary.mu.Lock() + primary.configuredTrustAnchorFile = "imported.pem" + primary.mu.Unlock() + primary.SetPQCertificateUpgrader(func(context.Context) error { + runs++ + return certificates.ErrNotGeneratedClusterPKI + }) + if err := primary.EnablePQCertificates(context.Background()); err != nil { + t.Fatal(err) + } + primary.upgradePQCertificatesOnce(context.Background()) + if runs != 1 { + t.Fatalf("upgrader ran %d times; want once", runs) + } +} diff --git a/internal/cluster/service.go b/internal/cluster/service.go index 8b34ac61..6cf642b0 100644 --- a/internal/cluster/service.go +++ b/internal/cluster/service.go @@ -207,6 +207,10 @@ type manifest struct { StatusKey string `json:"status_key"` StateDigest string `json:"state_digest,omitempty"` Nodes []member `json:"nodes"` + // PQCertificates is set by the primary's "Upgrade to post-quantum + // certificates" action. Each node then adds ML-DSA certificates to its + // own generated cluster PKI. Releases before it ignore the field. + PQCertificates bool `json:"pq_certificates,omitempty"` // RetiredStatusKeys are status keys replaced when a member was removed. // They tell a removed node it is gone (410) and, for two minutes, still // admit members that do not sign with their own key yet. They stay on @@ -326,6 +330,11 @@ type Service struct { // lastHeartbeatSentNano keeps back-to-back heartbeats from reusing the // exact same SentAt instant on a coarse wall clock. lastHeartbeatSentNano atomic.Int64 + // pqUpgrader adds ML-DSA certificates to this node's cluster PKI once + // the primary turns them on, and pqUpgradeSkipped records that this + // node's certificate is not one it can upgrade. See pq_certificates.go. + pqUpgrader PQCertificateUpgrader + pqUpgradeSkipped bool } func Open(options Options) (*Service, error) { diff --git a/internal/web/assets/app.css b/internal/web/assets/app.css index 84757466..f6d7b54a 100644 --- a/internal/web/assets/app.css +++ b/internal/web/assets/app.css @@ -2428,6 +2428,10 @@ html:has(> .auth-body) { background: var(--background); scrollbar-gutter: stable .cluster-details dl > div:first-child { border-top: 0; padding-top: 0; } .cluster-details dt { color: var(--muted-foreground); font-size: .68rem; } .cluster-details dd { min-width: 0; margin: 0; font-size: .75rem; font-weight: 600; overflow-wrap: anywhere; } +.cluster-pq-summary { margin: 0 0 var(--space-4); color: var(--muted-foreground); font-size: .75rem; line-height: 1.45; } +.cluster-pq-card dl > div { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); } +.cluster-pq-card dt { color: var(--foreground); font-size: .75rem; font-weight: 600; overflow-wrap: anywhere; } +.cluster-pq-note { display: block; margin-top: var(--space-3); color: var(--muted-foreground); font-size: .7rem; line-height: 1.45; } .cluster-dialog { width: min(calc(100% - 2rem), 34rem); padding: 0; } .cluster-dialog > .dialog-header { padding: var(--space-6) var(--space-6) var(--space-2); } .cluster-dialog > .dialog-footer, .cluster-dialog form > .dialog-footer { border-top: 1px solid var(--border); padding: var(--space-4) var(--space-6); } diff --git a/internal/web/cluster.go b/internal/web/cluster.go index d8373fb4..68c8d2da 100644 --- a/internal/web/cluster.go +++ b/internal/web/cluster.go @@ -699,6 +699,9 @@ func (server *Server) clusterView(request *http.Request, message, errorMessage s } view.CertificateSource = clusterCertificateSource(configuration, baseDirectory) view.ExistingClusterCA = configuration.Cluster.TrustAnchorFile != "" + if state.Initialized { + view.PQ = server.pqCertificateView() + } view.HTTPSListen = configuration.Server.HTTPSListen view.CertificateMode = configuration.EncryptedDNS.CertificateMode view.CertificateFile = configuration.EncryptedDNS.CertificateFile diff --git a/internal/web/cluster_pq_certificates.go b/internal/web/cluster_pq_certificates.go new file mode 100644 index 00000000..3aef7eba --- /dev/null +++ b/internal/web/cluster_pq_certificates.go @@ -0,0 +1,55 @@ +package web + +import ( + "context" + "errors" + "net/http" + + "github.com/drudge/sable/internal/cluster" + "github.com/drudge/sable/internal/web/pages" +) + +// pqCertificateController is the part of the cluster service behind the +// Cluster page's post-quantum certificates card. +type pqCertificateController interface { + PQCertificates() (cluster.PQCertificateStatus, error) + EnablePQCertificates(context.Context) error +} + +func (server *Server) pqCertificateView() *pages.ClusterPQView { + controller, ok := server.cluster.(pqCertificateController) + if !ok { + return nil + } + status, err := controller.PQCertificates() + if err != nil { + return nil + } + view := &pages.ClusterPQView{Enabled: status.Enabled, Outdated: status.Outdated} + for _, node := range status.Nodes { + view.Nodes = append(view.Nodes, pages.ClusterPQNodeView{Name: node.Name, State: node.State}) + } + return view +} + +func (server *Server) enablePQCertificates(writer http.ResponseWriter, request *http.Request) { + if !server.clusterAvailable(writer, request) { + return + } + controller, ok := server.cluster.(pqCertificateController) + if !ok { + server.renderClusterMutation(writer, request, http.StatusNotImplemented, "", "Post-quantum certificates are unavailable") + return + } + if err := controller.EnablePQCertificates(request.Context()); err != nil { + status := http.StatusUnprocessableEntity + if errors.Is(err, cluster.ErrNotPrimary) { + status = http.StatusConflict + } + server.renderClusterMutation(writer, request, status, "", err.Error()) + return + } + server.logger.Info("post-quantum cluster certificates turned on", "client", requestClientIP(request)) + server.recordControlPlaneAudit(request, "cluster.pq_certificates.enable", "turned on post-quantum cluster certificates") + server.renderClusterMutation(writer, request, http.StatusOK, "Post-quantum certificates are on. Each node adds its own within a minute.", "") +} diff --git a/internal/web/cluster_pq_certificates_test.go b/internal/web/cluster_pq_certificates_test.go new file mode 100644 index 00000000..b82f9445 --- /dev/null +++ b/internal/web/cluster_pq_certificates_test.go @@ -0,0 +1,83 @@ +package web + +import ( + "context" + "net/http" + "strings" + "testing" + + "github.com/drudge/sable/internal/cluster" + "github.com/drudge/sable/internal/config" +) + +// testPQClusterController is a primary that reports and turns on +// post-quantum certificates. +type testPQClusterController struct { + testClusterPageController + status *cluster.PQCertificateStatus + enabled *int +} + +func (controller testPQClusterController) PQCertificates() (cluster.PQCertificateStatus, error) { + return *controller.status, nil +} + +func (controller testPQClusterController) EnablePQCertificates(context.Context) error { + if len(controller.status.Outdated) > 0 { + return cluster.ErrMembersOutdated + } + *controller.enabled++ + controller.status.Enabled = true + return nil +} + +func TestClusterPagePQCertificatesCard(t *testing.T) { + t.Parallel() + + configuration := &editableTestConfiguration{snapshot: config.Snapshot{Config: config.Defaults(), Revision: 1}, baseDirectory: t.TempDir()} + server := newDetailsPanelTestServer(t, configuration) + state := cluster.State{ + Initialized: true, Mode: "primary-replica", ClusterID: "cluster-1", NodeID: "node-1", PrimaryID: "node-1", LocalRole: cluster.RolePrimary, + Nodes: []cluster.Node{ + {ID: "node-1", Name: "ns1", Role: cluster.RolePrimary, State: cluster.StateOnline, SyncState: cluster.SyncCurrent}, + {ID: "node-2", Name: "ns2", Role: cluster.RoleReplica, State: cluster.StateOnline, SyncState: cluster.SyncCurrent}, + }, + } + status := &cluster.PQCertificateStatus{ + Outdated: []string{"ns2"}, + Nodes: []cluster.PQCertificateNode{ + {ID: "node-1", Name: "ns1", State: cluster.PQCertificateClassical}, + {ID: "node-2", Name: "ns2", State: cluster.PQCertificateClassical}, + }, + } + enabled := 0 + server.SetClusterController(testPQClusterController{ + testClusterPageController: testClusterPageController{testMCPLeadClusterController{testMCPClusterController: testMCPClusterController{state: state}}}, + status: status, enabled: &enabled, + }) + + page := serveRequest(server, http.MethodGet, "/cluster").Body.String() + expectContains(t, "outdated cluster", page, "Post-Quantum Certificates", "Update ns2 to this release first.", "ECDSA only") + if strings.Contains(page, `hx-post="/ui/cluster/pq-certificates"`) { + t.Error("the upgrade is offered while ns2 is outdated") + } + if refused := serveRequest(server, http.MethodPost, "/ui/cluster/pq-certificates"); refused.Code != http.StatusUnprocessableEntity || enabled != 0 { + t.Fatalf("enable with an outdated member = %d, enabled %d times", refused.Code, enabled) + } + + status.Outdated = nil + page = serveRequest(server, http.MethodGet, "/cluster").Body.String() + expectContains(t, "ready cluster", page, `hx-post="/ui/cluster/pq-certificates"`, "Upgrade to Post-Quantum") + response := serveRequest(server, http.MethodPost, "/ui/cluster/pq-certificates") + if response.Code != http.StatusOK || enabled != 1 { + t.Fatalf("enable = %d, enabled %d times", response.Code, enabled) + } + expectContains(t, "after enabling", response.Body.String(), "Post-quantum certificates are on.") + + status.Nodes[0].State = cluster.PQCertificateMLDSA + page = serveRequest(server, http.MethodGet, "/cluster").Body.String() + expectContains(t, "enabled cluster", page, "ML-DSA + ECDSA", "adds its ML-DSA certificate within a minute") + if strings.Contains(page, `hx-post="/ui/cluster/pq-certificates"`) { + t.Error("the upgrade is still offered once it is on") + } +} diff --git a/internal/web/pages/cluster.templ b/internal/web/pages/cluster.templ index 4f8b56ea..dbb59f58 100644 --- a/internal/web/pages/cluster.templ +++ b/internal/web/pages/cluster.templ @@ -58,6 +58,9 @@ type ClusterPageView struct { JoinAddresses string DNSServiceAddresses string ExistingClusterCA bool + // PQ is the post-quantum certificates card, nil before the cluster + // exists. + PQ *ClusterPQView } type ClusterNodeView struct { @@ -158,6 +161,9 @@ templ ClusterContent(view ClusterPageView) { if view.Initialized { @ClusterUpdatePanel(view.Update, false) } + if view.PQ != nil { + @ClusterPQCard(*view.PQ, view.LocalRole) + } @components.Card(components.CardProps{Class: "cluster-details"}) { @components.CardHeader(components.CardHeaderProps{Title: "Local Node"}) { if view.RestartRequired { diff --git a/internal/web/pages/cluster_pq.templ b/internal/web/pages/cluster_pq.templ new file mode 100644 index 00000000..0db1f15a --- /dev/null +++ b/internal/web/pages/cluster_pq.templ @@ -0,0 +1,81 @@ +package pages + +import ( + "strings" + + "github.com/drudge/sable/internal/web/pages/components" +) + +// ClusterPQView is the Cluster page's post-quantum certificates card. +type ClusterPQView struct { + Enabled bool + // Outdated names the members on a release that can't read ML-DSA + // certificates yet. + Outdated []string + Nodes []ClusterPQNodeView +} + +type ClusterPQNodeView struct { + Name string + State string +} + +func clusterPQStateLabel(state string) string { + switch state { + case "mldsa": + return "ML-DSA + ECDSA" + case "public": + return "Public certificate" + } + return "ECDSA only" +} + +func clusterPQStateTone(state string) components.BadgeTone { + if state == "mldsa" { + return components.BadgeSuccess + } + return components.BadgeNeutral +} + +templ ClusterPQCard(view ClusterPQView, localRole string) { + @components.Card(components.CardProps{Class: "cluster-details cluster-pq-card"}) { + @components.CardHeader(components.CardHeaderProps{Title: "Post-Quantum Certificates"}) { + if view.Enabled { + @components.Badge(components.BadgeProps{Label: "On", Tone: components.BadgeSuccess}) + } else { + @components.Badge(components.BadgeProps{Label: "Off"}) + } + } +

Nodes prove who they are to each other with ML‑DSA certificates, which a quantum computer can't forge. Browsers keep the certificate they use today.

+ @components.FactList(components.FactListProps{}) { + for _, node := range view.Nodes { + @components.Fact(components.FactProps{Label: node.Name}) { + @components.Badge(components.BadgeProps{Label: clusterPQStateLabel(node.State), Tone: clusterPQStateTone(node.State)}) + } + } + } + if !view.Enabled { + if localRole != "Primary" { + Turn this on from the primary. + } else if len(view.Outdated) > 0 { + Update { strings.Join(view.Outdated, ", ") } to this release first. + @components.Button(components.ButtonProps{Label: "Upgrade to Post-Quantum", Icon: "shield-check", Variant: components.ButtonOutline, Disabled: true}) + } else { +
+ @components.Button(components.ButtonProps{Label: "Upgrade to Post-Quantum", Icon: "shield-check", Variant: components.ButtonOutline, Type: "submit"}) +
+ } + } else if clusterPQHasState(view.Nodes, "classical") { + A node on ECDSA only adds its ML-DSA certificate within a minute, unless its certificate came from another CA. + } + } +} + +func clusterPQHasState(nodes []ClusterPQNodeView, state string) bool { + for _, node := range nodes { + if node.State == state { + return true + } + } + return false +} diff --git a/internal/web/pages/cluster_pq_templ.go b/internal/web/pages/cluster_pq_templ.go new file mode 100644 index 00000000..f729b769 --- /dev/null +++ b/internal/web/pages/cluster_pq_templ.go @@ -0,0 +1,220 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.3.1118 + +package pages + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +import ( + "strings" + + "github.com/drudge/sable/internal/web/pages/components" +) + +// ClusterPQView is the Cluster page's post-quantum certificates card. +type ClusterPQView struct { + Enabled bool + // Outdated names the members on a release that can't read ML-DSA + // certificates yet. + Outdated []string + Nodes []ClusterPQNodeView +} + +type ClusterPQNodeView struct { + Name string + State string +} + +func clusterPQStateLabel(state string) string { + switch state { + case "mldsa": + return "ML-DSA + ECDSA" + case "public": + return "Public certificate" + } + return "ECDSA only" +} + +func clusterPQStateTone(state string) components.BadgeTone { + if state == "mldsa" { + return components.BadgeSuccess + } + return components.BadgeNeutral +} + +func ClusterPQCard(view ClusterPQView, localRole string) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + if view.Enabled { + templ_7745c5c3_Err = components.Badge(components.BadgeProps{Label: "On", Tone: components.BadgeSuccess}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = components.Badge(components.BadgeProps{Label: "Off"}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return nil + }) + templ_7745c5c3_Err = components.CardHeader(components.CardHeaderProps{Title: "Post-Quantum Certificates"}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

Nodes prove who they are to each other with ML‑DSA certificates, which a quantum computer can't forge. Browsers keep the certificate they use today.

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + for _, node := range view.Nodes { + templ_7745c5c3_Var5 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = components.Badge(components.BadgeProps{Label: clusterPQStateLabel(node.State), Tone: clusterPQStateTone(node.State)}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = components.Fact(components.FactProps{Label: node.Name}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return nil + }) + templ_7745c5c3_Err = components.FactList(components.FactListProps{}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !view.Enabled { + if localRole != "Primary" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "Turn this on from the primary.") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else if len(view.Outdated) > 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "Update ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var6 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(view.Outdated, ", ")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster_pq.templ`, Line: 61, Col: 77} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " to this release first.") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = components.Button(components.ButtonProps{Label: "Upgrade to Post-Quantum", Icon: "shield-check", Variant: components.ButtonOutline, Disabled: true}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = components.Button(components.ButtonProps{Label: "Upgrade to Post-Quantum", Icon: "shield-check", Variant: components.ButtonOutline, Type: "submit"}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + } else if clusterPQHasState(view.Nodes, "classical") { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "A node on ECDSA only adds its ML-DSA certificate within a minute, unless its certificate came from another CA.") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return nil + }) + templ_7745c5c3_Err = components.Card(components.CardProps{Class: "cluster-details cluster-pq-card"}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func clusterPQHasState(nodes []ClusterPQNodeView, state string) bool { + for _, node := range nodes { + if node.State == state { + return true + } + } + return false +} + +var _ = templruntime.GeneratedTemplate diff --git a/internal/web/pages/cluster_templ.go b/internal/web/pages/cluster_templ.go index 94e13aad..6adb428a 100644 --- a/internal/web/pages/cluster_templ.go +++ b/internal/web/pages/cluster_templ.go @@ -67,6 +67,9 @@ type ClusterPageView struct { JoinAddresses string DNSServiceAddresses string ExistingClusterCA bool + // PQ is the post-quantum certificates card, nil before the cluster + // exists. + PQ *ClusterPQView } type ClusterNodeView struct { @@ -322,7 +325,7 @@ func ClusterContent(view ClusterPageView) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d replicas will leave automatically on their next synchronization.", len(view.Nodes)-1)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 135, Col: 120} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 138, Col: 120} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -409,6 +412,12 @@ func ClusterContent(view ClusterPageView) templ.Component { return templ_7745c5c3_Err } } + if view.PQ != nil { + templ_7745c5c3_Err = ClusterPQCard(*view.PQ, view.LocalRole).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } templ_7745c5c3_Var10 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -481,7 +490,7 @@ func ClusterContent(view ClusterPageView) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(view.NodeID) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 171, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 177, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -520,7 +529,7 @@ func ClusterContent(view ClusterPageView) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(endpointLabel(view.AdvertiseURL)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 175, Col: 47} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 181, Col: 47} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { @@ -671,7 +680,7 @@ func ClusterSettingsDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.NodeName).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 209, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 215, Col: 78} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19) if templ_7745c5c3_Err != nil { @@ -684,7 +693,7 @@ func ClusterSettingsDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var20 string templ_7745c5c3_Var20, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.AdvertiseURL).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 210, Col: 100} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 216, Col: 100} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20) if templ_7745c5c3_Err != nil { @@ -697,7 +706,7 @@ func ClusterSettingsDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var21 string templ_7745c5c3_Var21, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.DataDirectory).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 211, Col: 121} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 217, Col: 121} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21) if templ_7745c5c3_Err != nil { @@ -720,7 +729,7 @@ func ClusterSettingsDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(ifThen(view.Initialized, "The state directory cannot be moved while this node belongs to a cluster.", "Stores the stable node identity and synchronized generation manifest.")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 211, Col: 394} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 217, Col: 394} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { @@ -876,7 +885,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var28 string templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(view.ConflictNode) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 238, Col: 105} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 244, Col: 105} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) if templ_7745c5c3_Err != nil { @@ -914,7 +923,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var29 string templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(view.ClusterDomain) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 246, Col: 96} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 252, Col: 96} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) if templ_7745c5c3_Err != nil { @@ -927,7 +936,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var30 string templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(view.ClusterID) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 246, Col: 163} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 252, Col: 163} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) if templ_7745c5c3_Err != nil { @@ -986,7 +995,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var34 string templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(FormatShortDateTime(view.ObservedAt, view.Console.TimeDisplay, true)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 251, Col: 121} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 257, Col: 121} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34)) if templ_7745c5c3_Err != nil { @@ -1046,7 +1055,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var37 string templ_7745c5c3_Var37, templ_7745c5c3_Err = templruntime.NewAttributeExpression("Connection status: " + nodeStateLabel(node.State)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 258, Col: 110} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 264, Col: 110} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var37) if templ_7745c5c3_Err != nil { @@ -1059,7 +1068,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var38 string templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(nodeStateLabel(node.State)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 258, Col: 147} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 264, Col: 147} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38) if templ_7745c5c3_Err != nil { @@ -1117,7 +1126,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var39 string templ_7745c5c3_Var39, templ_7745c5c3_Err = templruntime.NewAttributeExpression("View details for " + node.Name).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 267, Col: 154} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 273, Col: 154} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var39) if templ_7745c5c3_Err != nil { @@ -1144,7 +1153,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var40 string templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(node.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 267, Col: 168} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 273, Col: 168} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40)) if templ_7745c5c3_Err != nil { @@ -1203,7 +1212,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var43 string templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(syncStateLabel(node.SyncState)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 271, Col: 87} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 277, Col: 87} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) if templ_7745c5c3_Err != nil { @@ -1216,7 +1225,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var44 string templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(node.ID) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 273, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 279, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44)) if templ_7745c5c3_Err != nil { @@ -1234,7 +1243,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var45 string templ_7745c5c3_Var45, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(node.AdvertiseURL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 275, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 281, Col: 79} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45) if templ_7745c5c3_Err != nil { @@ -1247,7 +1256,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var46 string templ_7745c5c3_Var46, templ_7745c5c3_Err = templruntime.NewAttributeExpression("Open " + node.Name + " portal").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 275, Col: 168} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 281, Col: 168} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var46) if templ_7745c5c3_Err != nil { @@ -1260,7 +1269,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var47 string templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(clusterNodeEndpoint(node)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 275, Col: 204} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 281, Col: 204} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47)) if templ_7745c5c3_Err != nil { @@ -1286,7 +1295,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var48 string templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(clusterNodeEndpoint(node)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 277, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 283, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48)) if templ_7745c5c3_Err != nil { @@ -1304,7 +1313,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var49 string templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(node.Role) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 281, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 287, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49)) if templ_7745c5c3_Err != nil { @@ -1325,7 +1334,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var50 string templ_7745c5c3_Var50, templ_7745c5c3_Err = templruntime.NewAttributeExpression("cluster-uptime:" + node.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 281, Col: 130} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 287, Col: 130} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var50) if templ_7745c5c3_Err != nil { @@ -1338,7 +1347,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var51 string templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(nodeUptimeLabel(node)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 281, Col: 156} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 287, Col: 156} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51)) if templ_7745c5c3_Err != nil { @@ -1356,7 +1365,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var52 string templ_7745c5c3_Var52, templ_7745c5c3_Err = templruntime.NewAttributeExpression("Synchronization progress for " + node.Name).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 286, Col: 123} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 292, Col: 123} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var52) if templ_7745c5c3_Err != nil { @@ -1374,7 +1383,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var53 string templ_7745c5c3_Var53, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprint(node.AppliedGeneration)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 288, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 294, Col: 60} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var53) if templ_7745c5c3_Err != nil { @@ -1387,7 +1396,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var54 string templ_7745c5c3_Var54, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprint(syncProgressMaximum(node.CurrentGeneration))).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 288, Col: 124} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 294, Col: 124} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var54) if templ_7745c5c3_Err != nil { @@ -1400,7 +1409,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var55 string templ_7745c5c3_Var55, templ_7745c5c3_Err = templruntime.NewAttributeExpression("Synchronization progress for " + node.Name).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 288, Col: 183} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 294, Col: 183} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var55) if templ_7745c5c3_Err != nil { @@ -1418,7 +1427,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var56 string templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(syncProgressLabel(node)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 290, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 296, Col: 38} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56)) if templ_7745c5c3_Err != nil { @@ -1431,7 +1440,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var57 string templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d / %d", node.AppliedGeneration, node.CurrentGeneration)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 292, Col: 152} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 298, Col: 152} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57)) if templ_7745c5c3_Err != nil { @@ -1444,7 +1453,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var58 string templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(nodeLagLabel(node)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 292, Col: 229} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 298, Col: 229} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58)) if templ_7745c5c3_Err != nil { @@ -1457,7 +1466,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var59 string templ_7745c5c3_Var59, templ_7745c5c3_Err = templruntime.NewAttributeExpression(node.LastContactAt).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 292, Col: 310} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 298, Col: 310} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var59) if templ_7745c5c3_Err != nil { @@ -1470,7 +1479,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var60 string templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(node.LastContact) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 292, Col: 331} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 298, Col: 331} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60)) if templ_7745c5c3_Err != nil { @@ -1483,7 +1492,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var61 string templ_7745c5c3_Var61, templ_7745c5c3_Err = templruntime.NewAttributeExpression(node.LastSyncAt).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 292, Col: 417} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 298, Col: 417} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var61) if templ_7745c5c3_Err != nil { @@ -1496,7 +1505,7 @@ func ClusterLiveStatus(view ClusterPageView) templ.Component { var templ_7745c5c3_Var62 string templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(node.LastSync) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 292, Col: 435} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 298, Col: 435} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62)) if templ_7745c5c3_Err != nil { @@ -1596,7 +1605,7 @@ func InitializeClusterDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var65 string templ_7745c5c3_Var65, templ_7745c5c3_Err = templruntime.NewAttributeExpression("192.0.2.10\n[2001:db8::10]:53").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 308, Col: 720} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 314, Col: 720} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var65) if templ_7745c5c3_Err != nil { @@ -1609,7 +1618,7 @@ func InitializeClusterDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var66 string templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(view.DNSServiceAddresses) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 308, Col: 758} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 314, Col: 758} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66)) if templ_7745c5c3_Err != nil { @@ -1718,7 +1727,7 @@ func JoinClusterDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var69 string templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(view.Error) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 322, Col: 139} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 328, Col: 139} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69)) if templ_7745c5c3_Err != nil { @@ -1736,7 +1745,7 @@ func JoinClusterDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var70 string templ_7745c5c3_Var70, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.JoinPrimaryURL).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 324, Col: 99} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 330, Col: 99} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var70) if templ_7745c5c3_Err != nil { @@ -1749,7 +1758,7 @@ func JoinClusterDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var71 string templ_7745c5c3_Var71, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.JoinToken).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 324, Col: 297} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 330, Col: 297} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var71) if templ_7745c5c3_Err != nil { @@ -1762,7 +1771,7 @@ func JoinClusterDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var72 string templ_7745c5c3_Var72, templ_7745c5c3_Err = templruntime.NewAttributeExpression("192.0.2.11\n127.0.0.1:8054").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 324, Col: 536} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 330, Col: 536} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var72) if templ_7745c5c3_Err != nil { @@ -1775,7 +1784,7 @@ func JoinClusterDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var73 string templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(view.JoinAddresses) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 324, Col: 568} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 330, Col: 568} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73)) if templ_7745c5c3_Err != nil { @@ -1844,7 +1853,7 @@ func ClusterRestartStep(view ClusterPageView, workflow string) templ.Component { var templ_7745c5c3_Var75 string templ_7745c5c3_Var75, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("/cluster?onboarding=%s&resume=ready", workflow)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 330, Col: 177} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 336, Col: 177} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var75) if templ_7745c5c3_Err != nil { @@ -1857,7 +1866,7 @@ func ClusterRestartStep(view ClusterPageView, workflow string) templ.Component { var templ_7745c5c3_Var76 string templ_7745c5c3_Var76, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.Console.CSRFToken).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 330, Col: 220} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 336, Col: 220} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var76) if templ_7745c5c3_Err != nil { @@ -1923,7 +1932,7 @@ func ClusterWizardProgress(step int, workflow string) templ.Component { var templ_7745c5c3_Var78 string templ_7745c5c3_Var78, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("Step %d of 3", step)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 336, Col: 84} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 342, Col: 84} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var78) if templ_7745c5c3_Err != nil { @@ -2086,7 +2095,7 @@ func ClusterWizardProgress(step int, workflow string) templ.Component { var templ_7745c5c3_Var85 string templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(clusterWizardLastLabel(workflow)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 351, Col: 104} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 357, Col: 104} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var85)) if templ_7745c5c3_Err != nil { @@ -2124,7 +2133,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var87 string templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprint(view.ExistingClusterCA)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 356, Col: 214} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 362, Col: 214} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var87) if templ_7745c5c3_Err != nil { @@ -2137,7 +2146,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var88 string templ_7745c5c3_Var88, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprint(view.OnboardingStep)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 356, Col: 353} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 362, Col: 353} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var88) if templ_7745c5c3_Err != nil { @@ -2150,7 +2159,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var89 string templ_7745c5c3_Var89, templ_7745c5c3_Err = templruntime.NewAttributeExpression(workflow).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 357, Col: 55} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 363, Col: 55} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var89) if templ_7745c5c3_Err != nil { @@ -2189,7 +2198,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var90 string templ_7745c5c3_Var90, templ_7745c5c3_Err = templruntime.NewAttributeExpression(clusterWizardNodeName(view.NodeName, view.OnboardingMode)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 363, Col: 122} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 369, Col: 122} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var90) if templ_7745c5c3_Err != nil { @@ -2202,7 +2211,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var91 string templ_7745c5c3_Var91, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.DataDirectory).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 364, Col: 189} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 370, Col: 189} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var91) if templ_7745c5c3_Err != nil { @@ -2233,7 +2242,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var92 string templ_7745c5c3_Var92, templ_7745c5c3_Err = templ.JoinStringErrs(clusterWizardHTTPSHeading(workflow)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 367, Col: 124} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 373, Col: 124} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var92)) if templ_7745c5c3_Err != nil { @@ -2246,7 +2255,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var93 string templ_7745c5c3_Var93, templ_7745c5c3_Err = templ.JoinStringErrs(clusterWizardHTTPSDescription(workflow)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 367, Col: 183} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 373, Col: 183} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var93)) if templ_7745c5c3_Err != nil { @@ -2259,7 +2268,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var94 string templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(clusterWizardAdvertiseLabel(workflow)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 368, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 374, Col: 56} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94)) if templ_7745c5c3_Err != nil { @@ -2272,7 +2281,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var95 string templ_7745c5c3_Var95, templ_7745c5c3_Err = templruntime.NewAttributeExpression(clusterWizardAdvertiseURL(view.AdvertiseURL, view.OnboardingMode)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 368, Col: 166} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 374, Col: 166} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var95) if templ_7745c5c3_Err != nil { @@ -2285,7 +2294,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var96 string templ_7745c5c3_Var96, templ_7745c5c3_Err = templruntime.NewAttributeExpression(clusterWizardAdvertisePlaceholder(workflow)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 368, Col: 273} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 374, Col: 273} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var96) if templ_7745c5c3_Err != nil { @@ -2298,7 +2307,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var97 string templ_7745c5c3_Var97, templ_7745c5c3_Err = templ.JoinStringErrs(clusterWizardAdvertiseHelp(workflow)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 368, Col: 350} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 374, Col: 350} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var97)) if templ_7745c5c3_Err != nil { @@ -2582,7 +2591,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var106 string templ_7745c5c3_Var106, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.HTTPSListen).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 377, Col: 244} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 383, Col: 244} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var106) if templ_7745c5c3_Err != nil { @@ -2595,7 +2604,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var107 string templ_7745c5c3_Var107, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.ACMEEmail).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 377, Col: 376} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 383, Col: 376} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var107) if templ_7745c5c3_Err != nil { @@ -2608,7 +2617,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var108 string templ_7745c5c3_Var108, templ_7745c5c3_Err = templ.JoinStringErrs(view.ACMEDomains) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 377, Col: 542} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 383, Col: 542} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var108)) if templ_7745c5c3_Err != nil { @@ -2721,7 +2730,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var109 string templ_7745c5c3_Var109, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.ACMEDNSZone).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 377, Col: 1699} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 383, Col: 1699} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var109) if templ_7745c5c3_Err != nil { @@ -2734,7 +2743,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var110 string templ_7745c5c3_Var110, templ_7745c5c3_Err = templruntime.NewAttributeExpression(firstNonEmptyPage(view.ACMEStorageDirectory, "data/tls/acme")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 377, Col: 1857} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 383, Col: 1857} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var110) if templ_7745c5c3_Err != nil { @@ -2747,7 +2756,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var111 string templ_7745c5c3_Var111, templ_7745c5c3_Err = templruntime.NewAttributeExpression(firstNonEmptyPage(view.ACMEDirectoryURL, "https://acme-v02.api.letsencrypt.org/directory")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 377, Col: 2006} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 383, Col: 2006} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var111) if templ_7745c5c3_Err != nil { @@ -2760,7 +2769,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var112 string templ_7745c5c3_Var112, templ_7745c5c3_Err = templruntime.NewAttributeExpression(firstNonEmptyPage(view.ACMERenewBefore, "30d")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 377, Col: 2110} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 383, Col: 2110} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var112) if templ_7745c5c3_Err != nil { @@ -2801,7 +2810,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var113 string templ_7745c5c3_Var113, templ_7745c5c3_Err = templruntime.NewAttributeExpression(clusterWizardHTTPSListen(view.HTTPSListen, workflow)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 384, Col: 141} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 390, Col: 141} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var113) if templ_7745c5c3_Err != nil { @@ -2814,7 +2823,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var114 string templ_7745c5c3_Var114, templ_7745c5c3_Err = templruntime.NewAttributeExpression(clusterWizardHTTPSListen("", workflow)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 384, Col: 196} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 390, Col: 196} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var114) if templ_7745c5c3_Err != nil { @@ -2827,7 +2836,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var115 string templ_7745c5c3_Var115, templ_7745c5c3_Err = templ.JoinStringErrs(clusterWizardHTTPSListenHelp(workflow)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 384, Col: 247} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 390, Col: 247} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var115)) if templ_7745c5c3_Err != nil { @@ -2840,7 +2849,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var116 string templ_7745c5c3_Var116, templ_7745c5c3_Err = templruntime.NewAttributeExpression(ifThen(workflow == "primary", "data/cluster/pki", "data/tls/self-signed")).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 385, Col: 135} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 391, Col: 135} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var116) if templ_7745c5c3_Err != nil { @@ -2900,7 +2909,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var117 string templ_7745c5c3_Var117, templ_7745c5c3_Err = templruntime.NewAttributeExpression("localhost\n127.0.0.1").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 393, Col: 327} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 399, Col: 327} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var117) if templ_7745c5c3_Err != nil { @@ -2923,7 +2932,7 @@ func ClusterNodeOnboardingForm(view ClusterPageView, workflow string) templ.Comp var templ_7745c5c3_Var118 string templ_7745c5c3_Var118, templ_7745c5c3_Err = templruntime.NewAttributeExpression(view.HTTPSListen).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 396, Col: 306} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 402, Col: 306} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var118) if templ_7745c5c3_Err != nil { @@ -3075,7 +3084,7 @@ func EnrollmentTokenDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var122 string templ_7745c5c3_Var122, templ_7745c5c3_Err = templ.JoinStringErrs(view.EnrollmentToken) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 414, Col: 163} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 420, Col: 163} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var122)) if templ_7745c5c3_Err != nil { @@ -3096,7 +3105,7 @@ func EnrollmentTokenDialog(view ClusterPageView) templ.Component { var templ_7745c5c3_Var123 string templ_7745c5c3_Var123, templ_7745c5c3_Err = templ.JoinStringErrs(FormatShortDateTime(view.EnrollmentExpiresAt, view.Console.TimeDisplay, true)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 414, Col: 524} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 420, Col: 524} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var123)) if templ_7745c5c3_Err != nil { @@ -3197,7 +3206,7 @@ func ClusterGuide(color, title, description string) templ.Component { var templ_7745c5c3_Var127 string templ_7745c5c3_Var127, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 419, Col: 101} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 425, Col: 101} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var127)) if templ_7745c5c3_Err != nil { @@ -3210,7 +3219,7 @@ func ClusterGuide(color, title, description string) templ.Component { var templ_7745c5c3_Var128 string templ_7745c5c3_Var128, templ_7745c5c3_Err = templ.JoinStringErrs(description) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 419, Col: 131} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 425, Col: 131} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var128)) if templ_7745c5c3_Err != nil { @@ -3608,7 +3617,7 @@ func ClusterNodeDetails(view ClusterNodeDrawerView) templ.Component { var templ_7745c5c3_Var134 string templ_7745c5c3_Var134, templ_7745c5c3_Err = templruntime.NewAttributeExpression(clusterNodePanelURL(view.Key, true)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 552, Col: 123} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 558, Col: 123} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var134) if templ_7745c5c3_Err != nil { @@ -3659,7 +3668,7 @@ func ClusterNodeDetails(view ClusterNodeDrawerView) templ.Component { var templ_7745c5c3_Var135 string templ_7745c5c3_Var135, templ_7745c5c3_Err = templ.JoinStringErrs(clusterNodeProblemsNote(view)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 565, Col: 64} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 571, Col: 64} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var135)) if templ_7745c5c3_Err != nil { @@ -3710,7 +3719,7 @@ func ClusterNodeDetails(view ClusterNodeDrawerView) templ.Component { var templ_7745c5c3_Var138 string templ_7745c5c3_Var138, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(view.Node.AdvertiseURL)).ResolveURL(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 572, Col: 80} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 578, Col: 80} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var138) if templ_7745c5c3_Err != nil { @@ -3723,7 +3732,7 @@ func ClusterNodeDetails(view ClusterNodeDrawerView) templ.Component { var templ_7745c5c3_Var139 string templ_7745c5c3_Var139, templ_7745c5c3_Err = templ.JoinStringErrs(view.Node.AdvertiseURL) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 572, Col: 155} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 578, Col: 155} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var139)) if templ_7745c5c3_Err != nil { @@ -3899,7 +3908,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var144 string templ_7745c5c3_Var144, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/ui/cluster/nodes/" + node.ID + "/promote").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 609, Col: 58} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 615, Col: 58} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var144) if templ_7745c5c3_Err != nil { @@ -3976,7 +3985,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var147 string templ_7745c5c3_Var147, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/ui/cluster/nodes/" + node.ID + "/promote").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 623, Col: 58} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 629, Col: 58} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var147) if templ_7745c5c3_Err != nil { @@ -3999,7 +4008,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var148 string templ_7745c5c3_Var148, templ_7745c5c3_Err = templruntime.NewAttributeExpression(clusterPromoteConfirm(node)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 630, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 636, Col: 45} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var148) if templ_7745c5c3_Err != nil { @@ -4017,7 +4026,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var149 string templ_7745c5c3_Var149, templ_7745c5c3_Err = templruntime.NewAttributeExpression(node.DHCPTakeover).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 635, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 641, Col: 73} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var149) if templ_7745c5c3_Err != nil { @@ -4085,7 +4094,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var152 string templ_7745c5c3_Var152, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/ui/cluster/nodes/" + node.ID + "/remove").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 642, Col: 57} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 648, Col: 57} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var152) if templ_7745c5c3_Err != nil { @@ -4108,7 +4117,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var153 string templ_7745c5c3_Var153, templ_7745c5c3_Err = templruntime.NewAttributeExpression(clusterRemoveConfirm(node)).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 649, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 655, Col: 44} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var153) if templ_7745c5c3_Err != nil { @@ -4184,7 +4193,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var156 string templ_7745c5c3_Var156, templ_7745c5c3_Err = templruntime.NewAttributeExpression("Serve " + node.Name + "'s DHCP ranges from this node? Its clients renew here on the addresses they hold. If " + node.Name + " comes back, it stops serving them.").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 662, Col: 181} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 668, Col: 181} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var156) if templ_7745c5c3_Err != nil { @@ -4197,7 +4206,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var157 string templ_7745c5c3_Var157, templ_7745c5c3_Err = templruntime.NewAttributeExpression(node.ID).Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 666, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 672, Col: 54} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var157) if templ_7745c5c3_Err != nil { @@ -4268,7 +4277,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var160 string templ_7745c5c3_Var160, templ_7745c5c3_Err = templruntime.NewAttributeExpression("/ui/cluster/nodes/" + node.ID + "/promote").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 672, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 678, Col: 59} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var160) if templ_7745c5c3_Err != nil { @@ -4291,7 +4300,7 @@ func clusterNodeActions(node ClusterNodeView, localRole string, inPanel bool) te var templ_7745c5c3_Var161 string templ_7745c5c3_Var161, templ_7745c5c3_Err = templruntime.NewAttributeExpression("Hand the writable primary role to " + node.Name + "? This server will become a read-only replica.").Resolve(ctx) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 679, Col: 118} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `cluster.templ`, Line: 685, Col: 118} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var161) if templ_7745c5c3_Err != nil { diff --git a/internal/web/routes.go b/internal/web/routes.go index 2eebec7f..7095995e 100644 --- a/internal/web/routes.go +++ b/internal/web/routes.go @@ -469,6 +469,7 @@ func routeTable() []route { {pattern: "POST /ui/cluster/enrollment-tokens", handler: (*Server).createClusterEnrollmentToken, perm: auth.PermissionClusterWrite}, {pattern: "POST /ui/cluster/nodes/{node}/promote", handler: (*Server).promoteClusterNode, perm: auth.PermissionClusterWrite, replicaLocal: true}, {pattern: "POST /ui/cluster/nodes/{node}/remove", handler: (*Server).removeClusterNode, perm: auth.PermissionClusterWrite}, + {pattern: "POST /ui/cluster/pq-certificates", handler: (*Server).enablePQCertificates, perm: auth.PermissionClusterWrite}, {pattern: "POST /ui/cluster/leave", handler: (*Server).leaveCluster, perm: auth.PermissionClusterWrite, replicaLocal: true}, {pattern: "POST /ui/cluster/delete", handler: (*Server).deleteCluster, perm: auth.PermissionClusterWrite}, {pattern: "POST /ui/cluster/restart", handler: (*Server).restartServer, perm: auth.PermissionClusterWrite, replicaLocal: true},