Help us shape the future of Go! Take the 2026 Go Developer Survey

inventoryserver

package
v0.31.1 Latest Latest
Warning

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

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

Documentation

Overview

Package inventoryserver serves CA-authenticated resolution reads and separate OIDC-authorized administration and host enrollment in managed deployments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(config Config) (http.Handler, error)

NewHandler dispatches GET discovery and POST resolution by method at the configured endpoint. A mounting proxy must preserve the signed host and path.

Types

type Admins added in v0.31.0

type Admins struct {
	Users  []string
	Groups []string
}

Admins is intentionally one role. IDs use the same configured claim mapping and active directory records as certificate issuance, never a second identity.

func (Admins) Allows added in v0.31.0

func (a Admins) Allows(u *directory.User) bool

type Client

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

func NewClient

func NewClient(endpoint string, key sshcert.RawPrivateKey, cfg tlsconfig.Config) (*Client, error)

NewClient uses a separate transport for inventory so a Unix policy socket cannot accidentally receive inventory requests. Redirects are never followed.

func (*Client) FetchDiscovery

func (c *Client) FetchDiscovery(ctx context.Context) (*wire.Discovery, error)

FetchDiscovery reads inventory-owned login configuration using service authentication.

func (*Client) Resolve

type Config

type Config struct {
	CAPublicKey sshcert.RawPublicKey
	Resolver    *Resolver
	Validator   *oidc.Validator
	Discovery   *wire.Discovery
}

type Control added in v0.31.0

type Control struct {
	Store     *inventory.Managed
	Directory directory.Directory
	Validator TokenValidator
	Admins    Admins
	// contains filtered or unexported fields
}

func (*Control) ServeHTTP added in v0.31.0

func (c *Control) ServeHTTP(w http.ResponseWriter, r *http.Request)

type OIDCConfig

type OIDCConfig struct {
	IdentityMode oidc.IdentityMode `yaml:"identity_mode,omitempty" json:"identity_mode,omitempty"`
	UserIDClaim  string            `yaml:"user_id_claim,omitempty" json:"user_id_claim,omitempty"`
	Issuer       string            `yaml:"issuer" json:"issuer"`
	ClientID     string            `yaml:"client_id" json:"client_id"`
	ClientSecret string            `yaml:"client_secret,omitempty" json:"client_secret,omitempty"` // Optional, for confidential clients
}

OIDCConfig represents OIDC configuration for token validation

type Resolver

type Resolver struct {
	Directory         directory.Directory
	Hosts             inventory.Hosts
	DirectoryRevision string
}

Resolver combines independently owned directory and host snapshots. Directory data is immutable for the lifetime of this resolver; the host source supplies its revision with each lookup.

func (*Resolver) Resolve

type ServerConfig

type ServerConfig struct {
	CAPublicKey string     `yaml:"ca_pubkey" json:"ca_pubkey"`
	OIDC        OIDCConfig `yaml:"oidc" json:"oidc"`
}

ServerConfig contains inventory-owned authentication settings loaded at startup.

func (*ServerConfig) BootstrapAuth

func (c *ServerConfig) BootstrapAuth() wire.AuthConfig

BootstrapAuth returns the auth configuration for the bootstrap endpoint.

func (*ServerConfig) Validate

func (c *ServerConfig) Validate() error

Validate checks that the ServerConfig is valid.

type TokenValidator added in v0.31.0

type TokenValidator interface {
	Validate(context.Context, string) (*oidc.Claims, error)
}

Jump to

Keyboard shortcuts

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