publiccert

package
v0.57.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package publiccert gives the router of a public identity origin its publicly trusted certificate (homelab identity target §5, §14 decision 2): one certificate for *.<name> and <name> (id.<name>, base.<name>, ...) obtained by ACME DNS-01 with the same client that obtains the LAN-name certificate (internal/lancert, profile Public). kombify.me names answer DNS-01 through kombify Me's responder; an own domain answers it in the owner's Cloudflare zone with the owner's DNS token from Owner custody (a token file copied into custody, or a Wallet item delivered to the node). A local-only homelab keeps the step-ca certificates and never issues one.

Index

Constants

View Source
const (
	ProviderMe         = "kombify-me"
	ProviderCloudflare = "cloudflare"
)

DNS providers of the DNS-01 challenge.

View Source
const BaseTLSOptions = "tls:\n  options:\n    stackkit-komodo:\n      minVersion: VersionTLS13\n      sniStrict: true\n"

BaseTLSOptions is the router's TLS policy (the Komodo control listener's minimum version); the public certificate is added to it.

Variables

View Source
var ErrRouterNotRefreshed = errors.New("publiccert: the router policy was not refreshed")

ErrRouterNotRefreshed marks a policy refresh that could not read the router's routes; the existing policy stays in place and the signer retries.

Functions

func Configured

func Configured(workspace string) bool

Configured reports whether a DNS-01 provider is already recorded.

func DefaultProvider

func DefaultProvider(domain string) string

DefaultProvider is the DNS-01 provider for a domain: kombify Me for a kombify.me name, Cloudflare for an own domain.

func Domain

func Domain(workspace string) (string, error)

Domain is the workspace's public identity domain, or an error for a local-only one.

func Issue

func Issue(ctx context.Context, workspace, directory string, eab *acme.ExternalAccountBinding, contact string) (lancert.State, error)

Issue obtains or renews the public-names certificate and rewrites the router's policy file.

func RefreshRouter

func RefreshRouter(ctx context.Context, workspace string) error

RefreshRouter rewrites the router's policy file once the Basement core was applied; before that the apply writes it. When the certificate no longer serves, it reads the running routes from the router's API and adds the step-ca fallback for the covered hosts whose routes name no resolver. When the API cannot be read (the router is stopped or restarting), the existing policy stays as it is, so an installed fallback router is never dropped without its replacement, and the error carries ErrRouterNotRefreshed, so the signer retries soon.

func Remove

func Remove(ctx context.Context, workspace string) error

Remove deletes the certificate, its key, the ACME account and the DNS token copy and returns the router policy to its step-ca certificates: the routes the certificate covered fall back to step-ca at once. A Wallet item stays in the node's Wallet custody.

func Renew

func Renew(ctx context.Context, workspace string) (bool, error)

Renew renews the certificate within 30 days of its expiry with the ACME account in custody, on the identity signer's cadence. A node that never issued one, or a local-only one, renews nothing. The router policy is refreshed after every attempt, not only after a renewal: a certificate that stops serving (it expires after failed renewals) leaves the policy here, and the routes it covered fall back to step-ca, instead of at the next apply.

func RenewalFailing

func RenewalFailing(workspace string, now time.Time, window time.Duration) (time.Time, bool)

RenewalFailing is the installed certificate's expiry when it is within window of it although the node renews 30 days ahead: renewals kept failing. A node without one, or a local-only one, reports nothing.

func SaveProvider

func SaveProvider(workspace, provider string, token DNSToken) error

SaveProvider records which DNS answers the DNS-01 challenge. A Cloudflare token file goes to Owner custody (0600) and is never printed; a Wallet item is recorded by reference and must already be in this node's custody.

func TLSOptions

func TLSOptions(workspace string, fallback []string) []byte

TLSOptions is the router's policy file: the base policy plus the public certificate while it serves the identity host (the same decision that moves the router's ACME store), or, once it no longer serves, the step-ca fallback router for the hosts whose running routes still name no resolver. A certificate the router cannot load is never listed. The digest line makes a renewal (same paths, new certificate) a content change the router reloads on.

func WriteRouterPolicy

func WriteRouterPolicy(workspace string, create bool) error

WriteRouterPolicy writes the policy the apply renders with: the apply names the step-ca resolver on every route the certificate does not serve, so it needs no fallback router.

Types

type DNSToken

type DNSToken struct {
	Token        []byte
	WalletTenant string
	WalletItem   string
}

DNSToken names where the Cloudflare DNS token comes from: exactly one of a token read from the Owner's file or a Wallet item in this node's custody (stackkit wallet-item import), the pattern of reach enable. Either is copied into the public-tls custody, where the identity signer renews with it; a rotated Wallet item takes effect with the next issue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL