enrollment

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package enrollment defines single-machine installation invitations.

Index

Constants

View Source
const (
	ProxyActivationPending = "pending"
	ProxyActivationActive  = "active"
)

Managed proxy activation states returned with a new invitation.

Variables

View Source
var ErrPendingInvitation = errors.New("name has an existing invitation")

ErrPendingInvitation identifies a name reservation that force may retract.

Functions

func CheckMessage added in v0.5.7

func CheckMessage(ticket string, r Redemption) []byte

CheckMessage uses a separate purpose so a preflight proof cannot redeem.

func GatewayURL

func GatewayURL(value string) (string, error)

func Hash

func Hash(secret string) string

func InstallCommand

func InstallCommand(link string, windows bool, mode, proxy string) string

InstallCommand fetches the gateway's HTTPS installation URL, through the selected proxy endpoint when one is given. The proxy is explicit, so inherited NO_PROXY settings cannot bypass it and no environment must survive elevation.

func Message

func Message(ticket string, r Redemption) []byte

func PowerShellQuote

func PowerShellQuote(s string) string

func Script

func Script(invitation Invitation, link string) (string, error)

func ShellQuote

func ShellQuote(s string) string

func SystemName added in v0.5.0

func SystemName(name string) string

func SystemTicket added in v0.5.0

func SystemTicket(ticket string) string

SystemTicket derives a separate companion ticket without storing either installation URL in the gateway database.

Types

type InstallerFeatures added in v0.9.1

type InstallerFeatures struct {
	GatewayProxy bool `json:"gatewayProxy"`
}

InstallerFeatures is printed by the hidden installer-features command. The generated script checks it after checksum verification, before any change.

type Invitation

type Invitation struct {
	UserID      string `json:"userId,omitempty"`
	ID          string `json:"id"`
	Name        string `json:"name"`
	AutoName    bool   `json:"autoName,omitempty"` // Hostname selected and signed by the target installer.
	Gateway     string `json:"gateway"`
	ServiceMode string `json:"serviceMode,omitempty"`
	Linger      bool   `json:"linger,omitempty"`
	// HybridID links independently enrolled User and System contexts. The
	// companion uses a separate ticket, credential, identity, and profile.
	HybridID   string         `json:"hybridId,omitempty"`
	HybridRole string         `json:"hybridRole,omitempty"`
	Asset      update.Asset   `json:"asset"`            // Selected binary; first candidate until architecture selection.
	Assets     []update.Asset `json:"assets,omitempty"` // Pinned candidates for architecture-detecting installers.
	Version    string         `json:"version"`
	ExpiresAt  time.Time      `json:"expiresAt"`
	CreatedAt  time.Time      `json:"createdAt"`
	RedeemedID string         `json:"redeemedId,omitempty"`
	ReplaceID  string         `json:"replaceId,omitempty"` // Existing identity reserved by a same-name invitation.
	Revoked    bool           `json:"revoked"`
	// GatewayProxy is the gateway-validated snapshot of the selected proxy
	// worker and endpoint. Later worker renames or address changes never
	// rewrite it; a replacement requires a new invitation.
	GatewayProxy *model.GatewayProxy `json:"gatewayProxy,omitempty"`
}

func (Invitation) Candidates

func (i Invitation) Candidates() []update.Asset

func (Invitation) ProxyURL added in v0.9.1

func (i Invitation) ProxyURL() string

ProxyURL returns the selected endpoint, or "" for a direct invitation.

func (Invitation) ResolveName

func (i Invitation) ResolveName(hostname string) (string, error)

ResolveName runs on the target. The resolved name is persisted with the pending enrollment so a retry cannot rename the machine if its hostname changes.

func (Invitation) Select

func (i Invitation) Select(arch string) (update.Asset, bool)
type Link struct {
	Invitation
	URL     string `json:"url"`
	Command string `json:"command"`
	// ProxyActivation reports a managed proxy listener's state at creation:
	// active when the worker's latest listener check succeeded, otherwise
	// pending until the worker reports a fresh ready check.
	ProxyActivation string `json:"proxyActivation,omitempty"`
}

type Redemption

type Redemption struct {
	Arch           string `json:"arch,omitempty"`
	Name           string `json:"name,omitempty"`
	PublicKey      []byte `json:"publicKey"`
	CredentialHash string `json:"credentialHash"`
	// GatewayProxy echoes a proxied invitation's endpoint. Older installers
	// omit it, so the gateway refuses them before the ticket is consumed.
	GatewayProxy string `json:"gatewayProxy,omitempty"`
	Signature    []byte `json:"signature"`
}

type Request

type Request struct {
	Name        string `json:"name"`
	AutoName    bool   `json:"autoName,omitempty"`
	OS          string `json:"os"`
	Arch        string `json:"arch,omitempty"`
	TTLSeconds  int    `json:"ttlSeconds,omitempty"`
	Gateway     string `json:"gateway"`
	ServiceMode string `json:"serviceMode,omitempty"`
	Linger      bool   `json:"linger,omitempty"` // Linux Hybrid only: keep the User manager running without a login.
	Force       bool   `json:"force,omitempty"`
	// ProxyWorker is the stable ID of a ready same-fleet worker whose advertised
	// endpoint the child uses to reach the gateway. ProxyURL selects one of its
	// advertised endpoints and is required when it advertises several.
	ProxyWorker string `json:"proxyWorker,omitempty"`
	ProxyURL    string `json:"proxyUrl,omitempty"`
}

Jump to

Keyboard shortcuts

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