Documentation
¶
Overview ¶
Package evidencelink links audit records across protocols: records of one connection (Community ID within the connection's time span), the DNS answer that resolved a connection's destination, connections opened to resolved addresses, and alerts raised on any of them.
Links are computed from an output directory at query time. The result does not depend on worker count or record emission order, only on record content.
Index ¶
Constants ¶
const ( KindSameConnection = "same-connection" KindSameFlow = "same-flow" KindAlert = "alert" KindDNSResolution = "dns-resolution" KindResolvedConnection = "resolved-connection" )
Link kinds.
const ( BasisCommunityIDSpan = "community-id-in-connection-span" BasisCommunityIDWindow = "community-id-within-window" BasisAnswerBefore = "dns-answer-before-connection" BasisConnectionAfter = "connection-after-dns-answer" )
Link bases: how a link was established.
const IndexBudget uint64 = 64 << 20
IndexBudget bounds accounted storage for records, summaries and join keys.
const Schema = 1
Schema is the version of the Result JSON contract.
Variables ¶
var ErrNotFound = errors.New("record is not indexed: missing, beyond limits or without a Community ID")
ErrNotFound reports a reference that is not an indexed, joinable record.
var PacketTypes = map[string]bool{"TCP": true, "TLSRecord": true, "PacketContext": true, "PKTAP": true}
PacketTypes are per-packet records; linking them would list every packet of a connection, so they are not indexed.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Enabled bool `json:"enabled"`
WindowNS int64 `json:"windowNs"`
MaxRecords int64 `json:"maxRecords"`
MaxLinks int `json:"maxLinks"`
}
Config bounds index construction and query results.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig: one hour join window, 1,000,000 indexed records, 500 links.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index holds the joinable records of one output directory.
type Link ¶
type Link struct {
Kind string `json:"kind"`
Basis string `json:"basis"`
Record Record `json:"record"`
}
Link is one related record and how it was found.
type Record ¶
type Record struct {
Scope *evidence.FlowScope `json:"scope,omitempty"`
ID string `json:"id"`
FileSHA256 string `json:"fileSha256"`
Type string `json:"type"`
Ordinal int64 `json:"ordinal"`
Timestamp int64 `json:"timestamp"`
CommunityID string `json:"communityId,omitempty"`
Summary []Field `json:"summary,omitempty"`
}
Record identifies an audit record by file type and position.
type Result ¶
type Result struct {
ManifestSHA256 string `json:"captureManifestSha256,omitempty"`
CaptureID string `json:"captureId,omitempty"`
ScopeStatus string `json:"scopeStatus"`
Schema int `json:"schema"`
Target Record `json:"target"`
Session *Session `json:"session"`
Links []Link `json:"links"`
Truncated bool `json:"truncated"`
Indexed int64 `json:"indexed"`
Limits Config `json:"limits"`
Notes []string `json:"notes"`
}
Result is the API and CLI response.
type Selector ¶
type Selector struct {
ID string
Type string
Ordinal int64
HasOrdinal bool
ObservationID string
CommunityID string
Time int64
HasTime bool
}
Selector identifies the target record: Type+Ordinal, ObservationID (the latest snapshot of a Connection observation), or Type+CommunityID+Time (exactly one record of that type with that timestamp; ambiguous matches fail).
type Session ¶
type Session struct {
Scope *evidence.FlowScope `json:"scope,omitempty"`
ObservationID string `json:"observationId,omitempty"`
CommunityID string `json:"communityId"`
First int64 `json:"first"`
Last int64 `json:"last"`
SrcIP string `json:"srcIp"`
SrcPort string `json:"srcPort"`
DstIP string `json:"dstIp"`
DstPort string `json:"dstPort"`
Ordinal int64 `json:"ordinal"`
// contains filtered or unexported fields
}
Session is the connection observation that scopes Community ID links.