publish

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package publish serves what certificates point to: CA certificates (AIA caIssuers) and CRLs (CRL distribution point) – plain HTTP on the public listener, no login (PHASE1 step 9; wired into the listener in step 12).

/ca/<name>/<generation>.crt   DER, application/pkix-cert (RFC 2585)
/ca/<name>/<generation>.pem   the same as PEM (v0.2.2)
/crl/<name>/<generation>.crl  DER, application/pkix-crl, the newest CRL
/<name>.crt, /<name>.crl      legacy URLs of imported CAs: generation 1

With WithTrustPage also the trust page at / (trust.go).

Caching: a short max-age (15 minutes) plus ETag and Last-Modified, so a new CRL after a revocation gets through proxies quickly while unchanged files cost a 304. HEAD and conditional requests come from http.ServeContent.

Index

Constants

View Source
const (
	ScopeMachine = "machine" // Cert:\LocalMachine\Root, needs administrator rights
	ScopeUser    = "user"    // Cert:\CurrentUser\Root, for this user only
)

Scopes of a Windows helper.

View Source
const MaxAge = 15 * time.Minute

MaxAge is how long proxies and clients may reuse a file without asking.

View Source
const PageMaxAge = 5 * time.Minute

PageMaxAge: the page lists the CAs – a new one shows within five minutes.

View Source
const TrustCSP = "default-src 'none'; style-src 'self'; img-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"

TrustCSP: nothing but the own stylesheets and images – no script at all.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves one tenant's CA certificates and CRLs.

func New

func New(db *sql.DB, log *slog.Logger) *Handler

New returns the handler. db should be a read-only connection.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Handler) WithTrustPage added in v0.2.2

func (h *Handler) WithTrustPage(tp TrustPage) *Handler

WithTrustPage adds the trust page, the Windows helpers and the assets.

type TrustPage added in v0.2.2

type TrustPage struct {
	// Enabled reports the tenant setting; it is asked per request, so a
	// change applies at once. An error answers 500.
	Enabled func(context.Context) (bool, error)
	Clock   clock.Clock // nil = clock.System
}

TrustPage configures the trust page.

Jump to

Keyboard shortcuts

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