Documentation
¶
Overview ¶
Package config turns declarative configuration into a secret.Provider.
This is where the "make doing-it-right easy" principle becomes concrete: the provider is selected by a single string, and the default is NOT plaintext. Choosing the insecure path requires explicitly writing "plaintext" — it can never be the thing you fell into by leaving a field blank.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveSettings ¶ added in v0.4.0
SaveSettings writes the settings file (creating the directory) and returns the path it wrote to.
func SettingsPath ¶ added in v0.4.0
SettingsPath is the config file location: $FLEET_CONFIG if set, else the per-user path (~/.config/fleet/config.json, %AppData%\fleet\config.json).
Types ¶
type Config ¶
type Config struct {
RunAs RunAs `json:"runas"`
}
Config is the top-level configuration document.
type NamedQuery ¶ added in v0.5.0
type NamedQuery struct {
Name string `json:"name"`
Command string `json:"command"`
Parse string `json:"parse,omitempty"`
}
NamedQuery is a reusable gather query: a friendly name, the command to run per target, and an optional parse hint ("kv", "columns", "csv", or "" for raw output) that tells the gather view how to split the output into columns.
func DefaultGatherQueries ¶ added in v0.5.0
func DefaultGatherQueries() []NamedQuery
DefaultGatherQueries is the built-in query library — the everyday "what's the state of the fleet?" questions, with a parse hint so each comes back as real, sortable/groupable columns. Linux forms run as-is; the Windows forms use wmic. Users override or extend this via the gather_queries config key.
type ProviderKind ¶
type ProviderKind string
ProviderKind selects which secret provider to build.
const ( KindEnv ProviderKind = "env" // default KindCredMan ProviderKind = "credman" // Windows Credential Manager KindDPAPI ProviderKind = "dpapi" // DPAPI-encrypted blob on disk KindPlaintext ProviderKind = "plaintext" // opt-in only, never the default )
type RunAs ¶
type RunAs struct {
// Provider selects the backend. Empty defaults to KindEnv.
Provider ProviderKind `json:"provider"`
User string `json:"user,omitempty"`
Domain string `json:"domain,omitempty"`
// Password is consulted ONLY when Provider == "plaintext".
Password string `json:"password,omitempty"`
// BlobPath is the DPAPI blob location (Provider == "dpapi").
BlobPath string `json:"blob_path,omitempty"`
// Target is the Credential Manager target name (Provider == "credman").
Target string `json:"target,omitempty"`
}
RunAs configures the credential used for run-as operations.
type Settings ¶ added in v0.4.0
type Settings struct {
Parallelism int `json:"parallelism,omitempty"`
Transport string `json:"transport,omitempty"`
SSHUser string `json:"ssh_user,omitempty"`
SSHKey string `json:"ssh_key,omitempty"`
ServicesFile string `json:"services_file,omitempty"`
DefaultHosts string `json:"default_hosts,omitempty"`
// GatherQueries is the library of canned gather queries surfaced in the run
// builder and resolvable by name on the CLI. Empty falls back to the
// built-in DefaultGatherQueries.
GatherQueries []NamedQuery `json:"gather_queries,omitempty"`
}
Settings holds persisted run defaults — the "set it once" preferences an admin shouldn't have to retype every run. The file is the single source of truth; both the TUI settings screen and the CLI read it.
func LoadSettings ¶ added in v0.4.0
LoadSettings reads the settings file. A missing file is not an error — it returns the zero Settings, so callers can always use the result.
func (Settings) GatherLibrary ¶ added in v0.5.0
func (s Settings) GatherLibrary() []NamedQuery
GatherLibrary returns the configured queries, or the built-in defaults when none are set — so the picker is never empty.