firewallaudit

package
v0.16.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 32 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

Overview

Package firewallaudit projects decoder records into retrospective policy events. It does not intercept the transaction that produced a record.

Index

Constants

View Source
const (
	MaxFields     = 128
	MaxValueBytes = 1024
	MaxItems      = 4
	MaxDepth      = 6
	MaxNodes      = 4096
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(path string) (responseactions.Config, error)

LoadConfig reads configuration and TLS material without creating a broker or making network requests. New performs broker scope/token admission separately.

func Prepare

func Prepare(c *collector.Collector) error

Prepare must run before packet admission for each collector. GoPacket's initializer assigns its writer directly; SetWriter installs RecordObserver. Other decoder families already use SetWriter during initialization.

Types

type Capabilities

type Capabilities struct {
	Version         string   `json:"version"`
	Protocol        string   `json:"protocol"`
	Phase           string   `json:"phase"`
	EvaluationPhase string   `json:"evaluation_phase"`
	Attributes      []string `json:"attributes"`
	MaxFields       int      `json:"max_fields"`
	MaxValueBytes   int      `json:"max_value_bytes"`
	MaxItems        int      `json:"max_items"`
	MaxDepth        int      `json:"max_depth"`
	MaxNodes        int      `json:"max_nodes"`
	Collections     string   `json:"collections"`
	Omissions       string   `json:"omissions"`
	Records         []Schema `json:"records"`
}

Capabilities describes the exact compiled protobuf surface. All values are transient, including secret fields; audit output never contains field values.

func Discover

func Discover() Capabilities

Discover returns an independent copy suitable for agent/tool discovery.

type Config

type Config struct {
	PolicyFile  string
	EffectsFile string
	Live        bool
	Audit       io.Writer
	// SchemaVersion optionally pins the capability registry used to author rules.
	SchemaVersion string
}

type ConfigJSON

type ConfigJSON struct {
	Scopes              map[string]responseactions.Scope `json:"scopes"`
	QueueSize           int                              `json:"queueSize"`
	MaxPending          int                              `json:"maxPending"`
	MaxReceipts         int                              `json:"maxReceipts"`
	Retention           time.Duration                    `json:"retention"`
	CA                  string                           `json:"ca"`
	Cert                string                           `json:"cert"`
	Key                 string                           `json:"key"`
	MaxActionsPerMinute int                              `json:"maxActionsPerMinute,omitempty"`
}

ConfigJSON matches the firewall command's effects file (durations are JSON nanoseconds). It deliberately contains no endpoint supplied by a policy.

type Field

type Field struct {
	Path        string `json:"path"`
	Type        string `json:"type"`
	Sensitivity string `json:"sensitivity"`
}

type PacketContext

type PacketContext struct{ SrcIP, DstIP string }

PacketContext must come from the caller's packet tuple, never parsed from a protocol banner, Flow string, remote-address text, or unvalidated Fields.

type Projection

type Projection struct {
	Event     policy.Event
	Truncated bool
	// contains filtered or unexported fields
}

func Project

func Project(m proto.Message, packet *PacketContext) (Projection, error)

Project reads but never retains or mutates the message. The decoder must own the record for the duration of the callback, as for its existing writer.

type Result

type Result struct {
	SchemaVersion    string          `json:"schema_version"`
	RecordType       string          `json:"record_type,omitempty"`
	Phase            string          `json:"phase"`
	Decision         policy.Decision `json:"decision"`
	Reason           string          `json:"reason"`
	DryRun           bool            `json:"dry_run"`
	Truncated        bool            `json:"truncated,omitempty"`
	EffectsRequested int             `json:"effects_requested,omitempty"`
	EffectsRejected  int             `json:"effects_rejected,omitempty"`
}

Result is metadata only. Never add event values, expressions or intent sources.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func Open

func Open(c Config) (*Runtime, error)

Open requires explicit effect admission even for replay, but replay constructs no broker. Evaluation uses one counter state with effects removed; only a live, attributed winning decision can subsequently be converted to broker intents.

func (*Runtime) Chain

func (r *Runtime) Chain(previous func(proto.Message)) func(proto.Message)

Chain preserves a pre-existing observer. Collector.New wraps this callback again to retain its own network detection and record analysis.

func (*Runtime) Close

func (r *Runtime) Close() error

func (*Runtime) DroppedAudit

func (r *Runtime) DroppedAudit() uint64

func (*Runtime) Observe

func (r *Runtime) Observe(m proto.Message, packet *PacketContext) Result

Observe is synchronous, bounded projection/evaluation plus nonblocking queue admission. There is no per-record goroutine and no writer or network I/O here.

func (*Runtime) Receipts

func (r *Runtime) Receipts() []responseactions.Receipt

Receipts reports asynchronous broker outcomes without record or source values.

type Schema

type Schema struct {
	RecordType string  `json:"record_type"`
	Fields     []Field `json:"fields"`
}

Jump to

Keyboard shortcuts

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