certfallback

package
v1.5.13 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package certfallback finds and replaces the untrusted local-issuer certificate Caddy stores for a domain when a public CA could not issue one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drop

func Drop(ctx context.Context, s Store, domain string) (int, error)

Drop deletes only the local-issuer storage directories held for domain and returns how many it removed; a public-CA certificate is never touched.

func Held

func Held(ctx context.Context, s Store) (map[string][]string, error)

Held maps each lowercase domain to the storage directories holding a local-issuer certificate for it. Public-CA certificates are never listed.

func IsLocalIssuerCert

func IsLocalIssuerCert(key string, cert *x509.Certificate) bool

IsLocalIssuerCert reports whether a stored certificate came from Caddy's internal CA, by its storage issuer segment or its issuer name.

func ResolvesHere

func ResolvesHere(ctx context.Context, domain string, serverIPs []string) bool

ResolvesHere reports whether domain resolves to any of serverIPs.

Types

type Retrier

type Retrier struct {
	Store      Store
	Candidates func(ctx context.Context) []string // ACME-owned domains only
	Resolves   func(ctx context.Context, domain string) bool
	Interval   func(ctx context.Context) time.Duration
	MaxRetries func(ctx context.Context) int
	Audit      func(ctx context.Context, domain, detail string)
	Nudge      func()
	Logger     *slog.Logger
	// contains filtered or unexported fields
}

Retrier periodically drops the fallback certificate of domains that now resolve to this server, so certmagic requests a public certificate again.

func (*Retrier) Pass

func (r *Retrier) Pass(ctx context.Context) ([]string, error)

Pass runs one retry round and returns the domains it dropped a fallback for.

func (*Retrier) Run

func (r *Retrier) Run(ctx context.Context)

Run loops Pass at the live interval until ctx ends.

type Store

type Store interface {
	ListCertStorageKeys(ctx context.Context, prefix string, recursive bool) ([]string, error)
	GetCertStorageValue(ctx context.Context, key string) (*store.CertStorageValue, error)
	DeleteCertStorageValue(ctx context.Context, key string) error
}

Store is the cert storage surface; *store.DB satisfies it.

Jump to

Keyboard shortcuts

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