Documentation
¶
Overview ¶
Package config loads and validates the opsgate YAML configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var KnownTools = map[string]bool{ "system_info": true, "disk_usage": true, "process_top": true, "listening_ports": true, "service_list": true, "service_status": true, "docker_ps": true, "docker_logs": true, "docker_inspect": true, "docker_stats": true, "compose_ps": true, "journal_tail": true, "journal_errors": true, "file_read": true, "dir_list": true, "file_grep": true, "nginx_test": true, "service_restart": true, "service_start": true, "service_stop": true, "service_reload": true, "docker_restart": true, "docker_start": true, "docker_stop": true, "nginx_reload": true, "shell_exec": true, }
KnownTools is every tool name that may appear under `tools:` in the config. It is validated against the actually-registered set by a test in the tools package, so the two cannot drift apart.
Functions ¶
This section is empty.
Types ¶
type Audit ¶
type Audit struct {
Path string `yaml:"path"`
// RedactKeys are argument keys whose values are masked in the log.
RedactKeys []string `yaml:"redact_keys"`
}
Audit configures the audit log.
type Config ¶
type Config struct {
Mode Mode `yaml:"mode"`
DefaultHost string `yaml:"default_host"`
Hosts map[string]Host `yaml:"hosts"`
Tools map[string]ToolRule `yaml:"tools"`
Audit Audit `yaml:"audit"`
Files Files `yaml:"files"`
HTTP HTTP `yaml:"http"`
// TimeoutSeconds is the per-command timeout. Default 30.
TimeoutSeconds int `yaml:"timeout_seconds"`
// MaxOutputBytes caps tool output returned to the model. Default 48 KiB.
MaxOutputBytes int `yaml:"max_output_bytes"`
}
Config is the root configuration.
func Default ¶
func Default() *Config
Default returns the built-in configuration used when no file exists: local host only, observe mode, audit to ~/.opsgate/audit.jsonl.
type Files ¶
type Files struct {
// AllowPaths are glob-ish path prefixes readable by file tools.
AllowPaths []string `yaml:"allow_paths"`
// MaxBytes caps file_read output. Default 64 KiB.
MaxBytes int64 `yaml:"max_bytes"`
}
Files configures the file_read / dir_list tools.
type HTTP ¶
type HTTP struct {
Addr string `yaml:"addr"`
// AuthToken is required as "Authorization: Bearer <token>" when set.
AuthToken string `yaml:"auth_token"`
}
HTTP configures the streamable HTTP transport.
type Host ¶
type Host struct {
// Addr is the SSH address (host or host:port). Empty for the implicit local host.
Addr string `yaml:"addr"`
User string `yaml:"user"`
// Key is the path to a private key. Falls back to ssh-agent, then default keys.
Key string `yaml:"key"`
// Mode overrides the global mode for this host.
Mode Mode `yaml:"mode"`
Port int `yaml:"port"`
}
Host is a target machine opsgate can operate on.
type ToolRule ¶
type ToolRule struct {
// Enabled=false removes the tool entirely. Defaults to true except shell_exec.
Enabled *bool `yaml:"enabled"`
// AllowTargets restricts which targets (service names, container names,
// units, paths) the tool may touch. Glob patterns. Empty = all.
AllowTargets []string `yaml:"allow_targets"`
// Approval: "always", "never", or "" (default by mode: mutating tools
// require approval in operate mode).
Approval string `yaml:"approval"`
}
ToolRule tunes policy for a single tool.
Click to show internal directories.
Click to hide internal directories.