federationsigning

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package federationsigning implements Kata's bounded RFC 9421 request profile.

Index

Constants

View Source
const (
	// Lifetime covers the 60-second request budget plus signing and transit time.
	Lifetime  = 90 * time.Second
	ClockSkew = 5 * time.Second
	// Quarantine includes one second for integer timestamps at the boundary.
	Quarantine     = Lifetime + ClockSkew + time.Second
	MaxBodyBytes   = 128 << 20
	MaxHeaderBytes = 16 << 10
)

Protocol and admission limits define the supported signing profile.

Variables

View Source
var (
	ErrWarming  = errors.New("federation signing replay protection warming up")
	ErrState    = errors.New("federation replay state unavailable")
	ErrCapacity = errors.New("federation signing replay capacity exhausted")
	// ErrHubRejected is a hub's answer to this daemon's own request signature.
	// It is a signing configuration problem on one of the two daemons, never a
	// revoked grant, so callers keep the binding and report it as such.
	ErrHubRejected = errors.New("hub rejected the request signature; configure request signing for this enrollment")
)

Admission errors never include secret or body contents.

Functions

func ConfigureClient

func ConfigureClient(c *http.Client, base, token string, source signingpolicy.Source) error

ConfigureClient preserves the native bearer transport and TLS validation.

func InitializeReplayState

func InitializeReplayState(path string) error

InitializeReplayState creates new state only; it never resets prior evidence. After losing state, rotate every accepted key before initializing a replacement.

func Sign

func Sign(r *http.Request, source signingpolicy.Source) error

Sign covers exact bytes and a fresh random nonce on each attempt.

Types

type Verifier

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

Verifier owns one bounded admission cache and its durable restart barrier.

func NewVerifier

func NewVerifier(base string, keys []signingpolicy.Key, statePath string) (*Verifier, error)

NewVerifier starts quarantined and locks the durable admission-expiry watermark. Each concurrently serving replica must use distinct enrollment signing keys. Unavailable sources reject their own requests without disabling the daemon.

func (*Verifier) Close

func (v *Verifier) Close() error

Close releases replay ownership and permanently fences this verifier.

func (*Verifier) Verify

func (v *Verifier) Verify(r *http.Request, enrollmentID int64) error

Verify checks the MAC before reading a bounded body, then admits the nonce atomically. The caller must first authenticate the live native enrollment.

Directories

Path Synopsis
Package signingpolicy holds federation request-signing configuration: secret sources, enrollment keys, and policy validation.
Package signingpolicy holds federation request-signing configuration: secret sources, enrollment keys, and policy validation.

Jump to

Keyboard shortcuts

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