service

package
v0.0.0-...-230ac96 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RuleSourceDBUnavoidability = "db_unavoidability"

	BypassModeTCPDirect       = "tcp_direct"
	BypassModeUnixSocket      = "unix_socket"
	BypassModePortForwardTool = "port_forward_tool"
	BypassModeDNSAlias        = "dns_alias"
	BypassModeCustomTunnel    = "custom_tunnel"
)

Variables

View Source
var ErrBundleInvalidOptions = errors.New("db unavoidability bundle invalid options")
View Source
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 BundleWarning struct {
	Code    string
	Service string
	Message string
}

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

func ParseConfig(raw []byte) (Config, error)

ParseConfig parses YAML bytes into a validated Config. Returns an error if any service entry is malformed; valid entries are not returned partially.

type Endpoint

type Endpoint struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

Endpoint is a host:port pair — the upstream DB the proxy connects to.

type IPResolver

type IPResolver interface {
	LookupIP(ctx context.Context, host string) ([]net.IP, error)
}

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 (
	UnavoidabilityOff Unavoidability = iota
	UnavoidabilityObserve
	UnavoidabilityEnforce
)

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

Jump to

Keyboard shortcuts

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