Documentation
¶
Index ¶
Constants ¶
const ( BypassModeTCPDirect = "tcp_direct" BypassModeUnixSocket = "unix_socket" BypassModePortForwardTool = "port_forward_tool" BypassModeDNSAlias = "dns_alias" BypassModeCustomTunnel = "custom_tunnel" )
Variables ¶
var ErrBundleInvalidOptions = errors.New("db unavoidability bundle invalid options")
var ErrNoServices = errors.New("no services declared")
ErrNoServices is returned when the config block is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct {
Policy policy.Policy
Metadata []policy.RuleMetadata
Warnings []BundleWarning
}
func GenerateBundle ¶
func GenerateBundle(cfg Config, opts BundleOptions) (Bundle, error)
type BundleOptions ¶
type BundleOptions struct {
SessionID string
ProxySessionID string
SocketBaseDir string
IncludeToolRules bool
Mode Unavoidability
AllowHostnameOnlyInEnforce bool
Resolver IPResolver
}
type BundleWarning ¶
type Config ¶
type Config struct {
Services []Service `yaml:"services"`
}
Config is the top-level YAML schema for the `db_services` block per §9.1.
func ParseConfig ¶
ParseConfig parses YAML bytes into a validated Config. Returns an error if any service entry is malformed; valid entries are not returned partially.
type IPResolver ¶
type Listener ¶
type Listener struct {
Kind string `yaml:"kind"`
Path string `yaml:"path,omitempty"`
Host string `yaml:"host,omitempty"`
Port int `yaml:"port,omitempty"`
}
Listener describes where the proxy accepts client connections. Phase 1 supports kind="unix" (path) and kind="tcp" (host, port).
type Service ¶
type Service struct {
Name string `yaml:"name"`
Family string `yaml:"family"` // currently always "postgres"
Dialect string `yaml:"dialect"` // postgres | aurora_postgres | redshift | cockroachdb
Upstream Endpoint `yaml:"upstream"`
Listen Listener `yaml:"listen"`
TLSMode string `yaml:"tls_mode"` // terminate_reissue | passthrough | terminate_plaintext_upstream
}
Service describes one declared database service. The supervisor uses this to install a Unix-socket listener and a destination rule that makes outbound access to (Upstream.Host, Upstream.Port) unavoidable for governed processes.
type Unavoidability ¶
type Unavoidability uint8
Unavoidability is the policies.db.unavoidability flag per docs/agentmon-db-access-spec.md §11.1. Operators select one of three modes:
off (default): proxy is inert; no listeners are bound.
observe: listeners bind; declared services are intercepted; events emit.
enforce: same as observe in Plan 04a (and through Plan 04c). Plan 07
generates the unavoidability bundle (egress denial, SessionID-
keyed proxy identity) and makes enforce the high-assurance default.
The zero value is UnavoidabilityOff, which is the safe default for any caller holding a not-yet-decoded RuleSet.
const ( )
func ParseUnavoidability ¶
func ParseUnavoidability(s string) (Unavoidability, bool)
ParseUnavoidability accepts the canonical lowercase mode names. Empty input returns ok=false (callers may want to apply a default at a higher level).
func (Unavoidability) String ¶
func (u Unavoidability) String() string