tenant

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Overview

Package tenant holds the settings of a tenant (PHASE1 step 18): whether the server may generate keys, and the subject defaults that fill empty fields of a request – what pki.conf of legacy/pki.sh did.

Index

Constants

View Source
const (
	EnrollAuto     = "auto"
	EnrollVerified = "verified"
	EnrollManual   = "manual"
)

Agent enrollment modes (docs/PHASE3.md §6.1).

View Source
const ActionSettings = "tenant.settings"

ActionSettings is the audit action of a change.

View Source
const DefaultStepUpMinutes = 5

DefaultStepUpMinutes preserves the lifetime used before v0.3.1.

Variables

View Source
var DefaultACMELimits = ACMELimits{OrdersPerAccount: 300, FailedPerName: 5, AccountsPerIP: 10}

DefaultACMELimits are the limits of a new tenant (migration 0009).

EnrollmentModes lists the valid modes.

View Source
var ErrInvalid = errors.New("invalid settings")

ErrInvalid wraps every refused value.

View Source
var StepUpMinuteValues = []int{5, 10, 15, 30, 60}

StepUpMinuteValues lists the allowed proof lifetimes in minutes.

Functions

This section is empty.

Types

type ACMELimits added in v0.2.0

type ACMELimits struct {
	OrdersPerAccount int // new orders per account
	FailedPerName    int // failed validations per name
	AccountsPerIP    int // new accounts per client address (IPv6: per /64)
}

ACMELimits are per hour (PHASE2 step 11).

type Settings

type Settings struct {
	AllowServerKeygen  bool
	Organization       string
	OrganizationalUnit string
	Locality           string
	State              string
	Country            string
	// ACME: the rate limits of the ACME server. Get always fills it; in
	// Set, nil keeps the stored limits (a v0.1 client doesn't send them).
	ACME *ACMELimits
	// TrustPage: the public listener serves the trust page at / (v0.2.2,
	// default on). Get always fills it; in Set, nil keeps the stored value
	// (a v0.2 client doesn't send it).
	TrustPage *bool
	// AgentEnrollment: how agents are admitted (v0.3.0, ADR-18) – auto,
	// verified (default) or manual. Get always fills it; in Set, nil keeps
	// the stored value.
	AgentEnrollment *string
	// StepUpMinutes is the lifetime of new second-factor proofs (v0.3.1).
	// Get always fills it; in Set, nil keeps the stored value.
	StepUpMinutes *int
	// Separate predecessor defaults for agent deployments and other renewals.
	// In Set, nil keeps the corresponding stored policy.
	AgentPredecessor *predecessor.Policy
	OtherPredecessor *predecessor.Policy
}

Settings of a tenant.

type Store

type Store struct {
	DB    *sql.DB // system.db writer
	Clock clock.Clock
	Wake  func()
}

Store reads and writes settings in system.db.

func (*Store) ACMELimits added in v0.2.0

func (s *Store) ACMELimits(ctx context.Context, tenant string) (ACMELimits, error)

ACMELimits returns the limits without a permission check (for the ACME server).

func (*Store) AgentEnrollment added in v0.3.0

func (s *Store) AgentEnrollment(ctx context.Context, tenant string) (string, error)

AgentEnrollment returns how agents are admitted, without a permission check (the agent listener asks it per enrollment).

func (*Store) Defaults

func (s *Store) Defaults(ctx context.Context, tenant string) (*Settings, error)

Defaults returns the settings without a permission check (for the services that fill requests).

func (*Store) Get

func (s *Store) Get(ctx context.Context, tenant string, who keys.Who) (*Settings, error)

Get returns the settings; reading needs any role in the tenant.

func (*Store) Set

func (s *Store) Set(ctx context.Context, tenant string, v Settings, who keys.Who) error

Set stores new settings; it needs tenant.manage (tenant admin).

func (*Store) TrustPage added in v0.2.2

func (s *Store) TrustPage(ctx context.Context, tenant string) (bool, error)

TrustPage reports whether the public listener serves the trust page, without a permission check (the public listener asks it per request, so a change applies at once).

Jump to

Keyboard shortcuts

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