Documentation
¶
Overview ¶
Package siem forwards every DNS and egress decision the sensor makes to Guardian, the Vulnetix SIEM, as dns_events and net_events rows.
The sensor runs on a customer's machine, so it posts to the per-tenant events route with the customer's own Guardian ingest token, never to the multi-tenant producer route. The token decides the organisation; a row never carries a tenant.
Forwarding must never slow a decision. DNS and Egress only append to a bounded buffer under a mutex; the HTTP work happens in Run. When the buffer is full the oldest rows are dropped and counted, and a batch the server refuses or cannot be reached for is dropped too: the console's Sensors page stays the record of what matched, and Guardian is a copy.
Index ¶
Constants ¶
const DefaultURL = "https://ingest.vulnetix.com/v1/ingest/events"
DefaultURL is Guardian's per-tenant events route.
const Source = "sensor"
Source is the source column every row carries.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DNSDecision ¶
type DNSDecision struct {
Time time.Time
// Client is who asked, host:port.
Client string
QName string
QType string
RCode string
Answers []string
Match *Match
// Error is set when the upstream resolver could not answer.
Error string
}
DNSDecision is one lookup the DNS guard answered or refused.
type EgressDecision ¶
type EgressDecision struct {
Time time.Time
// Client is the workload's side of the proxy connection, host:port.
Client string
// Target is what the client asked for, host:port.
Target string
// RemoteAddr is the address the proxy reached, ip:port, when it dialled.
RemoteAddr string
Method string
Bytes int64
Match *Match
Error string
}
EgressDecision is one outbound connection the egress proxy allowed or refused.
type Event ¶
Event is one row as the events route takes it.
func DNSRow ¶
func DNSRow(host string, d DNSDecision) Event
DNSRow maps a DNS decision to a dns_events row.
func EgressRow ¶
func EgressRow(host string, d EgressDecision) Event
EgressRow maps an egress decision to a net_events row.
type Forwarder ¶
type Forwarder struct {
// URL is the events route; DefaultURL when empty.
URL string
// Token is the Guardian ingest token, gdn_...
Token string
// Host is the machine name every row carries.
Host string
Client *http.Client
Limit int
BatchSize int
FlushEvery time.Duration
Logf func(string, ...any)
Now func() time.Time
// contains filtered or unexported fields
}
Forwarder buffers rows and posts them in batches.
func (*Forwarder) DNS ¶
func (f *Forwarder) DNS(d DNSDecision)
DNS queues a DNS decision. It never blocks on the network.
func (*Forwarder) Dropped ¶
Dropped is how many rows were dropped since the forwarder started: pushed out of a full buffer, or in a batch that could not be delivered.
func (*Forwarder) Egress ¶
func (f *Forwarder) Egress(d EgressDecision)
Egress queues an egress decision. It never blocks on the network.
func (*Forwarder) Flush ¶
Flush posts everything buffered, BatchSize rows to a request. A batch that fails is dropped and counted; it is not retried.