Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyEnv(cfg *Config, environ []string) ([]string, error)
- func EnvMarkdownTable(cfg *Config) string
- func NormalizeEdition(value string) (string, error)
- func NormalizeSubscribePath(value string) (string, error)
- func PathFromEnv() string
- func PrepareSubscribePath(c *Config) string
- func Set(c *Config)
- type AdminConfig
- type AgentControlConfig
- type AgentInstallConfig
- type AlertSettings
- type AlertsConfig
- type AppConfig
- type AuthConfig
- type CORSConfig
- type CacheConfig
- type Config
- type DatabaseConfig
- type EnvVar
- type ForwardConfig
- type ForwardRuntimeAnsibleConfig
- type ForwardRuntimeCleanAgentConfig
- type ForwardRuntimeConfig
- type ForwardRuntimeGostStatsConfig
- type ForwardRuntimeJobsConfig
- type ForwardRuntimeLatencyConfig
- type ForwardRuntimeNodeXConfig
- type FrontendConfig
- type GRPCConfig
- type IdentityConfig
- type JWTConfig
- type LogConfig
- type LoginRateLimitConfig
- type ModuleRuntimeConfig
- func (m ModuleRuntimeConfig) BindTimeoutOrDefault() time.Duration
- func (m ModuleRuntimeConfig) BuiltinCA() bool
- func (m ModuleRuntimeConfig) CertLifetimeOrDefault() string
- func (m ModuleRuntimeConfig) ClusterOrDefault() string
- func (m ModuleRuntimeConfig) ListenOrDefault() string
- func (m ModuleRuntimeConfig) PKIOrDefault() string
- type PackageRoutesConfig
- type PluginConfig
- type RegistrationAuthConfig
- type ServerConfig
- type TLSConfig
Constants ¶
const ( DefaultAlertCheckInterval = 15 * time.Minute DefaultAlertLeafExpiryDays = 14 DefaultAlertCAExpiryDays = 60 DefaultAlertRenotifyInterval = 24 * time.Hour DefaultAlertPhaseStuckAfter = 72 * time.Hour )
Alert monitor defaults.
const ( PackageRoutesDefaultRehearsed = "rehearsed" PackageRoutesDefaultLegacy = "legacy" )
Package route default policies (package_routes.default_mode).
const ( AgentMTLSOff = "off" AgentMTLSOptional = "optional" AgentMTLSPreferred = "preferred" AgentMTLSRequired = "required" // AgentMTLSDefault is the mode when agent_control.mtls is empty: // required from 4.2 (owner decision H5; preferred in 4.1). AgentMTLSDefault = AgentMTLSRequired )
Agent listener client certificate modes (agent_control.mtls).
const ( // DefaultControlHostPayloadBytes is the request and response body limit // used when plugins.control_host_max_*_bytes is unset. DefaultControlHostPayloadBytes int64 = 1 << 20 // MaxControlHostPayloadBytes is the largest accepted configured limit. MaxControlHostPayloadBytes int64 = 64 << 20 )
const ( ModulePKIBuiltin = "builtin" ModulePKIExternal = "external" )
Module runtime PKI modes.
const ( EditionCommunity = "community" EditionCommercial = "commercial" )
Product editions (app.edition).
const ConfigPathEnv = EnvPrefix + "CONFIG"
ConfigPathEnv names the config file when -config is not given.
const EnvFileSuffix = "_FILE"
EnvFileSuffix selects the file variant of a variable: the value is read from the named file, which is how Docker and Kubernetes secrets are mounted.
const EnvPrefix = "ANIX_CONTROL_"
EnvPrefix starts every configuration environment variable. A variable name is the upper-cased yaml path joined with underscores, for example database.password -> ANIX_CONTROL_DATABASE_PASSWORD.
MinSharedSecretBytes is the length below which a shared secret (jwt.secret, app.api_token, grpc.api_token) is reported as weak at startup. A shorter one still works: refusing to start would break every installation that has one.
Variables ¶
var AgentMTLSModes = []string{AgentMTLSOff, AgentMTLSOptional, AgentMTLSPreferred, AgentMTLSRequired}
AgentMTLSModes lists the agent_control.mtls modes, weakest first.
Functions ¶
func ApplyEnv ¶ added in v4.1.0
ApplyEnv overrides cfg with ANIX_CONTROL_* entries from environ ("KEY=value" pairs, as returned by os.Environ). It returns the ANIX_CONTROL_* names that match no configuration key so the caller can warn about typos.
func EnvMarkdownTable ¶ added in v4.1.0
EnvMarkdownTable renders the variable reference table of docs/reference/environment-variables.md from cfg (the built-in defaults).
func NormalizeEdition ¶ added in v4.1.0
NormalizeEdition returns the canonical edition name: empty selects community, and any value other than community or commercial is an error.
func NormalizeSubscribePath ¶
NormalizeSubscribePath cleans the public subscription path and rejects values that could overlap the versioned API namespace.
func PathFromEnv ¶ added in v4.1.0
func PathFromEnv() string
PathFromEnv returns the config file named by ANIX_CONTROL_CONFIG, if any.
func PrepareSubscribePath ¶
PrepareSubscribePath normalizes the configured public subscription path, updates the in-memory configuration when present, and fails before route registration if the path could overlap the versioned API namespace.
Types ¶
type AdminConfig ¶
AdminConfig defines the bootstrap admin account.
type AgentControlConfig ¶ added in v4.1.0
type AgentControlConfig struct {
// MTLS selects the client certificate mode of the AnixOps Agent
// channels:
// - "off": client certificates are neither requested nor accepted and
// AgentEnrollment is unavailable; every agent uses its legacy node
// credential, without deprecation signals (a rollback switch);
// - "optional": a client certificate is verified when given, otherwise
// the legacy node credential authenticates, silently;
// - "preferred" (the 4.1 default): as optional, but legacy
// authentication is answered with deprecation signals (the
// x-anix-auth-deprecated stream header, and Deprecation, Sunset and
// Link on the legacy HTTP agent paths);
// - "required" (the default from 4.2, owner decision H5): the AnixOps
// Agent channels accept certificates only; the legacy agent paths
// and API key authentication on the stream are refused. Third-party
// node protocols (UniProxy, the v2board gRPC services) are not
// affected.
// Empty means the default, required. Certificates come from
// AgentEnrollment and need the built-in CA (module_runtime.ca_kek with
// pki builtin; module_runtime.enabled is not needed) and
// grpc.tls_cert_file. An explicit required refuses to start without
// them; the default starts and warns (MTLSExplicit).
MTLS string `yaml:"mtls"`
// LegacySunset is the date after which the legacy agent transports may
// stop answering, as YYYY-MM-DD or RFC 3339. When set, the deprecation
// signals carry it (the HTTP Sunset header, x-anix-auth-sunset on the
// stream). Empty sends no Sunset: the 4.2 release date is not fixed.
LegacySunset string `yaml:"legacy_sunset"`
}
AgentControlConfig configures how AnixOps Agents authenticate on the node-facing gRPC listener (grpc.*) and on the legacy AnixOps-agent HTTP and WebSocket paths (node-ops-service.md, section 5.6).
func (AgentControlConfig) LegacySunsetTime ¶ added in v4.1.0
func (a AgentControlConfig) LegacySunsetTime() (time.Time, error)
LegacySunsetTime parses LegacySunset: the zero time when it is empty.
func (AgentControlConfig) MTLSExplicit ¶ added in v4.2.0
func (a AgentControlConfig) MTLSExplicit() bool
MTLSExplicit tells whether agent_control.mtls is set, rather than left to the default. An explicit required refuses to start without what enrollment needs; the default required starts and warns instead (RequiredPrerequisitesError), so a kernel without gRPC TLS or the CA keeps starting after the 4.2 upgrade, with its legacy agents refused.
func (AgentControlConfig) MTLSOrDefault ¶ added in v4.1.0
func (a AgentControlConfig) MTLSOrDefault() string
MTLSOrDefault returns the configured mode, AgentMTLSDefault (required) when empty.
type AgentInstallConfig ¶ added in v4.2.0
type AgentInstallConfig struct {
// PublicURL is the Control address nodes reach, as https://host[:port];
// empty uses the request's origin (server.trusted_proxies decides
// whether X-Forwarded-* count).
PublicURL string `yaml:"public_url"`
// GRPCTarget is the host:port of the gRPC listener nodes dial (TLS);
// empty uses PublicURL's host and grpc.port.
GRPCTarget string `yaml:"grpc_target"`
// AgentVersion is the Agent release tag installed; empty uses
// "v" + app.version (Control and the Agent share version numbers, H25).
AgentVersion string `yaml:"agent_version"`
// ArtifactDir holds Agent release assets as <dir>/<tag>/<asset> with
// their .dgst (and .sig) files; Control then serves them at
// /install/agent/<tag>/<asset> (the "control" mirror) and publishes their
// SHA-256 in /install/agent.json. Empty: the control mirror falls back to
// GitHub releases.
ArtifactDir string `yaml:"artifact_dir"`
// CNMirrorURL is the base URL of a mainland mirror laid out like GitHub
// release downloads (<base>/<tag>/<asset>). The script never trusts a
// checksum from the mirror: it takes it from Control or GitHub.
CNMirrorURL string `yaml:"cn_mirror_url"`
// SignatureFile is the release signature of the embedded install
// script (base64 Ed25519 by plugins.official_public_key), served at
// /install.sh.sig after Control checks it. The release image sets it.
SignatureFile string `yaml:"signature_file"`
}
AgentInstallConfig configures one-command node onboarding (forward-sdk.md, section 9): the signed install script Control serves at /install.sh, the release metadata it reads from /install/agent.json, and where the Agent release is downloaded from.
func (AgentInstallConfig) Validate ¶ added in v4.2.0
func (a AgentInstallConfig) Validate() error
Validate checks agent_install: absolute https URLs without a query, a host:port gRPC target and absolute file paths.
type AlertSettings ¶ added in v4.2.0
type AlertSettings struct {
Enabled bool
CheckInterval time.Duration
LeafExpiryDays int
CAExpiryDays int
RenotifyInterval time.Duration
// PhaseStuckAfter is zero when the phase alerts are off.
PhaseStuckAfter time.Duration
}
AlertSettings are the alert monitor's settings with the defaults applied.
type AlertsConfig ¶ added in v4.2.0
type AlertsConfig struct {
// Enabled turns the monitor off when false; nil means on.
Enabled *bool `yaml:"enabled"`
// CheckInterval is how often the certificate stores and the phased
// processes are scanned (a duration, at least 1m; default 15m).
CheckInterval string `yaml:"check_interval"`
// LeafExpiryDays caps, in days, how close to its end a leaf certificate
// (Agent, link, module) may get without having been renewed before it
// alerts (default 14). The window is the smaller of this and one sixth
// of the certificate's own lifetime, because a healthy certificate is
// renewed at two thirds of its lifetime.
LeafExpiryDays int `yaml:"leaf_expiry_days"`
// CAExpiryDays is how many days before its end the current module or
// forward link CA alerts (default 60).
CAExpiryDays int `yaml:"ca_expiry_days"`
// RenotifyInterval is the shortest time between two notifications of
// the same alert (a duration, at least 1h; default 24h). Critical alerts
// repeat four times as often, phase alerts seven times as rarely.
RenotifyInterval string `yaml:"renotify_interval"`
// PhaseStuckAfter is how long a phased process may stay untouched in a
// non-final phase before it alerts (a duration, at least 1h; default
// 72h); "0" turns the phase alerts off.
PhaseStuckAfter string `yaml:"phase_stuck_after"`
}
AlertsConfig configures the kernel alert monitor (internal/kernelalerts): certificates that were not renewed in time, CAs close to their end, and phased processes (the node credential split, the identity cutover) that have not moved for too long. Alerts are listed at GET /api/v4/kernel/alerts and sent to the administrators through the notification channels (Telegram for bound administrators, and the notification log).
func (AlertsConfig) Settings ¶ added in v4.2.0
func (a AlertsConfig) Settings() AlertSettings
Settings returns the effective alert settings. It assumes a validated configuration; an unparsable duration falls back to its default.
type AppConfig ¶
type AppConfig struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
APIToken string `yaml:"api_token"`
TrafficLogEnable bool `yaml:"traffic_log_enable"`
SubscribePath string `yaml:"subscribe_path"`
// Edition selects the product edition: "community" (default) hides the
// commercial features (orders, payments, affiliate, plan purchase);
// "commercial" serves them. See internal/edition.
Edition string `yaml:"edition"`
}
AppConfig defines generic app settings.
func (AppConfig) EditionOrDefault ¶ added in v4.1.0
EditionOrDefault returns the configured edition, community when it is empty or not valid (load rejects invalid values).
type AuthConfig ¶
type AuthConfig struct {
LoginRateLimit LoginRateLimitConfig `yaml:"login_rate_limit"`
RegisterRateLimit LoginRateLimitConfig `yaml:"register_rate_limit"`
Registration RegistrationAuthConfig `yaml:"registration"`
}
AuthConfig defines authentication security settings.
type CORSConfig ¶
type CORSConfig struct {
AllowedOrigins []string `yaml:"allowed_origins"`
AllowedMethods []string `yaml:"allowed_methods"`
AllowedHeaders []string `yaml:"allowed_headers"`
AllowCredentials bool `yaml:"allow_credentials"`
MaxAge int `yaml:"max_age"` // preflight cache duration in seconds
}
CORSConfig defines Cross-Origin Resource Sharing settings.
type CacheConfig ¶
type CacheConfig struct {
Driver string `yaml:"driver"`
RedisHost string `yaml:"redis_host"`
RedisPort int `yaml:"redis_port"`
RedisPassword string `yaml:"redis_password"`
RedisDB int `yaml:"redis_db"`
}
CacheConfig defines cache settings.
type Config ¶
type Config struct {
Env string `yaml:"env"`
Server ServerConfig `yaml:"server"`
Frontend FrontendConfig `yaml:"frontend"`
Database DatabaseConfig `yaml:"database"`
Cache CacheConfig `yaml:"cache"`
Log LogConfig `yaml:"log"`
JWT JWTConfig `yaml:"jwt"`
Auth AuthConfig `yaml:"auth"`
App AppConfig `yaml:"app"`
Admin AdminConfig `yaml:"admin"`
TLS TLSConfig `yaml:"tls"`
ForwardRuntime ForwardRuntimeConfig `yaml:"forward_runtime"`
Forward ForwardConfig `yaml:"forward"`
Plugins PluginConfig `yaml:"plugins"`
GRPC GRPCConfig `yaml:"grpc"`
ModuleRuntime ModuleRuntimeConfig `yaml:"module_runtime"`
Identity IdentityConfig `yaml:"identity"`
AgentControl AgentControlConfig `yaml:"agent_control"`
AgentInstall AgentInstallConfig `yaml:"agent_install"`
PackageRoutes PackageRoutesConfig `yaml:"package_routes"`
Alerts AlertsConfig `yaml:"alerts"`
}
Config is the root application configuration loaded from config.yaml.
func Defaults ¶ added in v4.1.0
func Defaults() *Config
Defaults returns a fresh copy of the built-in container defaults.
func Load ¶
Load reads the configuration once per process. A non-empty path names a YAML file; an empty path starts from the built-in defaults (defaults.yaml), which is how containers run without a config file. ANIX_CONTROL_* environment variables override either source.
func (*Config) RequiredPrerequisitesError ¶ added in v4.2.0
RequiredPrerequisitesError names what agent_control.mtls: required lacks to let agents enroll and connect: the gRPC listener, its TLS and the built-in CA. Nil when nothing is missing.
func (*Config) SecretStrengthWarnings ¶ added in v4.2.0
SecretStrengthWarnings reports the shared secrets that are set but weak: shorter than MinSharedSecretBytes, a template value, or one repeated byte or a handful of distinct bytes. An unset secret is not reported (jwt production requirements are in ValidateForServer, and an empty api token disables its feature). Each finding names the setting and how to rotate it and never contains the secret value.
func (*Config) ValidateForServer ¶ added in v4.1.0
ValidateForServer rejects settings the server must not start with. In production the JWT secret must be set and must not be a template value.
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver string `yaml:"driver"`
Database string `yaml:"database"`
Host string `yaml:"host"`
Port int `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
// SSLMode is the libpq sslmode (disable, allow, prefer, require,
// verify-ca, verify-full); empty means disable.
SSLMode string `yaml:"sslmode"`
// TimeZone is the PostgreSQL session time zone; empty means Asia/Shanghai.
TimeZone string `yaml:"timezone"`
// DSN, when set, is used verbatim instead of the fields above.
DSN string `yaml:"dsn"`
LogLevel string `yaml:"log_level"`
MaxIdleConns int `yaml:"max_idle_conns"`
MaxOpenConns int `yaml:"max_open_conns"`
ConnMaxLifetime int `yaml:"conn_max_lifetime"`
}
DatabaseConfig defines database connection settings.
type EnvVar ¶ added in v4.1.0
type EnvVar struct {
Name string // ANIX_CONTROL_DATABASE_PASSWORD
Path string // database.password
Type string // string, bool, int, list
Default string // value in the supplied config; empty for secrets
Secret bool
}
EnvVar describes one configuration key that can be set from the environment.
type ForwardConfig ¶ added in v4.2.0
type ForwardConfig struct {
// AnixOpsExperimental lets routes use the experimental AnixOps engine and
// link (ENGINE_ANIXOPS, LINK_SECURITY_ANIXOPS): it sets the planner's and
// the validation's EnableAnixOps. Off by default; the Agents need their own
// Forward.AnixOps.Enable (their JSON configuration) to advertise the engine, since the planner
// refuses a node that does not. The wire format of the prototype (ALPN
// anixops/0) may change without notice.
AnixOpsExperimental bool `yaml:"anixops_experimental"`
}
ForwardConfig holds the switches of the v4.2 forwarding engines (docs/architecture/forward-sdk.md, anixops-protocol.md).
type ForwardRuntimeAnsibleConfig ¶
type ForwardRuntimeAnsibleConfig struct {
Inventory string `yaml:"inventory"`
ApplyPlaybook string `yaml:"apply_playbook"`
RemovePlaybook string `yaml:"remove_playbook"`
Become bool `yaml:"become"`
ExtraVars map[string]any `yaml:"extra_vars"`
Command string `yaml:"command"`
WorkingDir string `yaml:"working_dir"`
TargetPattern string `yaml:"target_pattern"`
Environment map[string]string `yaml:"environment"`
TimeoutSeconds int `yaml:"timeout_seconds"`
}
ForwardRuntimeAnsibleConfig stores local ansible runtime settings.
type ForwardRuntimeCleanAgentConfig ¶
type ForwardRuntimeCleanAgentConfig struct {
PublicURL string `yaml:"public_url"`
HeartbeatIntervalSeconds int `yaml:"heartbeat_interval_seconds"`
ActionTimeoutSeconds int `yaml:"action_timeout_seconds"`
TokenExpireSeconds int `yaml:"token_expire_seconds"`
LegacyBridgeEnabled bool `yaml:"legacy_bridge_enabled"`
}
ForwardRuntimeCleanAgentConfig stores clean-room forward agent defaults.
type ForwardRuntimeConfig ¶
type ForwardRuntimeConfig struct {
NodeXMode *bool `yaml:"nodex_mode"`
Backend string `yaml:"backend"`
NodeX ForwardRuntimeNodeXConfig `yaml:"nodex"`
CleanAgent ForwardRuntimeCleanAgentConfig `yaml:"clean_agent"`
NftablesAnsible ForwardRuntimeAnsibleConfig `yaml:"nftables_ansible"`
Jobs ForwardRuntimeJobsConfig `yaml:"jobs"`
GostStats ForwardRuntimeGostStatsConfig `yaml:"gost_stats"`
Latency ForwardRuntimeLatencyConfig `yaml:"latency"`
}
ForwardRuntimeConfig stores the canonical forward runtime settings from config.yaml.
type ForwardRuntimeGostStatsConfig ¶
type ForwardRuntimeGostStatsConfig struct {
PollInterval string `yaml:"poll_interval"`
IdlePollInterval string `yaml:"idle_poll_interval"`
ErrorLogInterval string `yaml:"error_log_interval"`
}
ForwardRuntimeGostStatsConfig stores gost stats polling settings.
type ForwardRuntimeJobsConfig ¶
type ForwardRuntimeJobsConfig struct {
PollInterval string `yaml:"poll_interval"`
IdlePollInterval string `yaml:"idle_poll_interval"`
ErrorLogInterval string `yaml:"error_log_interval"`
BatchSize int `yaml:"batch_size"`
TimeoutSeconds int `yaml:"timeout_seconds"`
}
ForwardRuntimeJobsConfig stores local ansible job executor polling settings.
type ForwardRuntimeLatencyConfig ¶
type ForwardRuntimeLatencyConfig struct {
PollInterval string `yaml:"poll_interval"`
IdlePollInterval string `yaml:"idle_poll_interval"`
ErrorLogInterval string `yaml:"error_log_interval"`
Dials int `yaml:"dials"`
DialTimeout string `yaml:"dial_timeout"`
Concurrency int `yaml:"concurrency"`
RetentionDays int `yaml:"retention_days"`
}
ForwardRuntimeLatencyConfig stores latency prober (TCPing) settings.
type ForwardRuntimeNodeXConfig ¶
type ForwardRuntimeNodeXConfig struct {
BaseURL string `yaml:"base_url"`
Token string `yaml:"token"`
TimeoutSeconds int `yaml:"timeout_seconds"`
}
ForwardRuntimeNodeXConfig stores NodeX or gost runtime settings.
type FrontendConfig ¶
type FrontendConfig struct {
Enable bool `yaml:"enable"`
Port int `yaml:"port"`
Path string `yaml:"path"`
}
FrontendConfig defines static frontend serving settings.
type GRPCConfig ¶
type GRPCConfig struct {
Enable bool `yaml:"enabled"`
Host string `yaml:"host"`
Port int `yaml:"port"`
APIToken string `yaml:"api_token"`
TLSCertFile string `yaml:"tls_cert_file"`
TLSKeyFile string `yaml:"tls_key_file"`
}
GRPCConfig controls the node-facing gRPC server (AnixOps Agent nodes connect here).
type IdentityConfig ¶ added in v4.1.0
type IdentityConfig struct {
// KEK is the base64 or hex 32-byte key that seals the identity signing
// keys. It is passed to the local identity-platform host only; a network
// module gets its own copy (ANIX_IDENTITY_KEK_FILE). Without it identity
// signs no tokens and the kernel's own HS256 tokens stay in use.
KEK string `yaml:"kek"`
}
IdentityConfig configures the identity module when Control runs it as a local package host.
type LogConfig ¶
type LogConfig struct {
// Format is "text" (default: the historical plain log lines) or "json"
// (one JSON object per line on stdout, for container log collectors).
Format string `yaml:"format"`
Level string `yaml:"level"`
Output string `yaml:"output"`
FilePath string `yaml:"file_path"`
MaxSize int `yaml:"max_size"`
MaxBackups int `yaml:"max_backups"`
MaxAge int `yaml:"max_age"`
}
LogConfig defines log settings.
type LoginRateLimitConfig ¶
type LoginRateLimitConfig struct {
Enabled *bool `yaml:"enabled"`
MaxAttempts int `yaml:"max_attempts"`
WindowSeconds int `yaml:"window_seconds"`
LockoutSeconds int `yaml:"lockout_seconds"`
}
LoginRateLimitConfig controls brute-force protection for login.
type ModuleRuntimeConfig ¶ added in v4.1.0
type ModuleRuntimeConfig struct {
Enabled bool `yaml:"enabled"`
// Listen is the address of the kernel's mTLS module listener (ModulePKI
// and the remote package bridge).
Listen string `yaml:"listen"`
// Cluster names the deployment in every module SPIFFE ID.
Cluster string `yaml:"cluster"`
// PKI is "builtin" (the kernel's own CA, with enrollment) or "external"
// (certificates issued elsewhere, for example by cert-manager).
PKI string `yaml:"pki"`
// CAKEK is the base64 or hex 32-byte key that seals the built-in CA key.
CAKEK string `yaml:"ca_kek"`
// CertLifetime bounds module and kernel certificates (default 24h).
CertLifetime string `yaml:"cert_lifetime"`
// External PKI: the trust bundle and the kernel's own certificate.
TrustBundleFile string `yaml:"trust_bundle_file"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
// DatabaseHost ("host" or "host:port") is the PostgreSQL address in
// storage leases for remote modules, when it differs from the kernel's.
DatabaseHost string `yaml:"database_host"`
// BindTimeout bounds how long starting a remote package waits for a
// healthy instance (default 2m).
BindTimeout string `yaml:"bind_timeout"`
}
ModuleRuntimeConfig controls network modules: packages that run as separate services and talk to the kernel over gRPC with mTLS.
func (ModuleRuntimeConfig) BindTimeoutOrDefault ¶ added in v4.1.0
func (m ModuleRuntimeConfig) BindTimeoutOrDefault() time.Duration
BindTimeoutOrDefault returns the remote start timeout, 2m when empty or invalid (validate rejects invalid values).
func (ModuleRuntimeConfig) BuiltinCA ¶ added in v4.1.0
func (m ModuleRuntimeConfig) BuiltinCA() bool
BuiltinCA reports whether the kernel runs its built-in CA: pki is builtin and either the module runtime is enabled (which requires ca_kek) or ca_kek is set. The CA does not depend on the module listener: agent enrollment uses it with module_runtime.enabled false.
func (ModuleRuntimeConfig) CertLifetimeOrDefault ¶ added in v4.1.0
func (m ModuleRuntimeConfig) CertLifetimeOrDefault() string
CertLifetimeOrDefault returns the configured certificate lifetime, 24h when empty.
func (ModuleRuntimeConfig) ClusterOrDefault ¶ added in v4.1.0
func (m ModuleRuntimeConfig) ClusterOrDefault() string
ClusterOrDefault returns the configured cluster name, "default" when empty.
func (ModuleRuntimeConfig) ListenOrDefault ¶ added in v4.1.0
func (m ModuleRuntimeConfig) ListenOrDefault() string
ListenOrDefault returns the module listener address, ":7443" when empty.
func (ModuleRuntimeConfig) PKIOrDefault ¶ added in v4.1.0
func (m ModuleRuntimeConfig) PKIOrDefault() string
PKIOrDefault returns the configured PKI mode, "builtin" when empty.
type PackageRoutesConfig ¶ added in v4.1.0
type PackageRoutesConfig struct {
// DefaultMode is the default policy:
// - "rehearsed" (the default from 4.1.0): the routes listed in
// config/package-route-defaults.json, which passed the staging
// rehearsal, run natively when the installation stores no mode for
// them and the installed package release is at least the rehearsed
// one;
// - "legacy": no route defaults to native; every route without a
// stored mode runs its legacy handler, as in 4.0 (the kill switch).
// A stored mode (anix-control routes set/rollback) always wins.
DefaultMode string `yaml:"default_mode"`
}
PackageRoutesConfig sets the route modes the kernel hands v2 Control package hosts for routes whose installation stores no mode.
func (PackageRoutesConfig) DefaultModeOrDefault ¶ added in v4.1.0
func (p PackageRoutesConfig) DefaultModeOrDefault() string
DefaultModeOrDefault returns the configured policy, rehearsed when empty.
type PluginConfig ¶
type PluginConfig struct {
OfficialPublicKey string `yaml:"official_public_key"`
IdentityBootstrapPackageDir string `yaml:"identity_bootstrap_package_dir"`
ControlExecutionEnabled bool `yaml:"control_execution_enabled"`
ControlPollInterval string `yaml:"control_poll_interval"`
ControlHostRuntimeDir string `yaml:"control_host_runtime_dir"`
ControlHostArtifactDir string `yaml:"control_host_artifact_dir"`
ControlHostStartupTimeout string `yaml:"control_host_startup_timeout"`
ControlHostRequestTimeout string `yaml:"control_host_request_timeout"`
ControlHostWebSocketSessionTimeout string `yaml:"control_host_websocket_session_timeout"`
ControlHostMaxRequestBytes int64 `yaml:"control_host_max_request_bytes"`
ControlHostMaxResponseBytes int64 `yaml:"control_host_max_response_bytes"`
DispatchEnabled bool `yaml:"dispatch_enabled"`
DispatchPollInterval string `yaml:"dispatch_poll_interval"`
TopologyExecutionEnabled bool `yaml:"topology_execution_enabled"`
TopologyPollInterval string `yaml:"topology_poll_interval"`
}
PluginConfig controls the official plugin trust root and the opt-in durable lifecycle dispatcher. Third-party plugin execution is intentionally unsupported by the control kernel.
func (PluginConfig) ControlHostRequestBodyLimit ¶ added in v4.1.0
func (p PluginConfig) ControlHostRequestBodyLimit() int64
ControlHostRequestBodyLimit returns the effective plugins.control_host_max_request_bytes: the largest /api/v2 request body the gateway forwards to a package host.
func (PluginConfig) ControlHostResponseBodyLimit ¶ added in v4.1.0
func (p PluginConfig) ControlHostResponseBodyLimit() int64
ControlHostResponseBodyLimit returns the effective plugins.control_host_max_response_bytes: the largest package response body, enforced by the package bridge, the package-host SDK, and the kernel's host client.
func (PluginConfig) ValidatePayloadLimits ¶ added in v4.1.0
func (p PluginConfig) ValidatePayloadLimits() error
ValidatePayloadLimits rejects negative or oversized payload limits. Zero means "use the default".
type RegistrationAuthConfig ¶
type RegistrationAuthConfig struct {
Enabled *bool `yaml:"enabled"`
RequireInvite bool `yaml:"require_invite"`
AllowedEmailDomains []string `yaml:"allowed_email_domains"`
BlockedEmailDomains []string `yaml:"blocked_email_domains"`
}
RegistrationAuthConfig controls public account registration policy.
type ServerConfig ¶
type ServerConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Mode string `yaml:"mode"`
ReadTimeout int `yaml:"read_timeout"`
WriteTimeout int `yaml:"write_timeout"`
TrustedProxies []string `yaml:"trusted_proxies"` // proxies whose X-Forwarded-* count (internal/requestorigin); nil = loopback, empty = none
CORS CORSConfig `yaml:"cors"`
// ShutdownDrainDelay is how long the server keeps accepting requests after
// /readyz starts failing on shutdown, so load balancers and Kubernetes
// endpoints stop routing to it first (Go duration, e.g. "5s"; empty = 0).
ShutdownDrainDelay string `yaml:"shutdown_drain_delay"`
}
ServerConfig defines backend server settings.
func (ServerConfig) DrainDelay ¶ added in v4.1.0
func (s ServerConfig) DrainDelay() (time.Duration, error)
DrainDelay returns the parsed server.shutdown_drain_delay (0 when unset).