Compare commits

...

1 Commits

Author SHA1 Message Date
Jonathan Nobels
69b75da8d9 tailcfg: add schema for client audit logging
updates tailscale/corp#26435

Adds the schema for generating and sendiing audit-logs to
the audit-logs endpoint.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-02-12 14:50:06 -05:00

View File

@@ -2966,3 +2966,32 @@ const LBHeader = "Ts-Lb"
// correspond to those IPs. Any services that don't correspond to a service
// this client is hosting can be ignored.
type ServiceIPMappings map[ServiceName][]netip.Addr
// ClientAuditAction represents an auditable action that a client can report to the
// control plane. These actions must correspond to the supported actions
// in the control plane.
type ClientAuditAction string
const (
// AuditNodeDisconnect action must be sent when a node has disconnected
// from the control plane. The details must include a reason in the Details
// field, either generated, or entered by the user.
AuditNodeDisconnect = ClientAuditAction("DISCONNECT_NODE")
)
// AuditLogRequest represents an audit log request to be sent to the control plane.
//
// This is JSON-encoded and sent over the control plane connection to:
//
// POST https://<control-plane>/machine/audit-logs
type AuditLogRequest struct {
// NodeKey is the client's current node key.
NodeKey key.NodePublic `json:",omitzero"`
// Action is the action to be logged. It must correspond to a known action in the control plane.
Action ClientAuditAction `json:",omitempty"`
// Details is an opaque string, specific to the action being logged. Empty strings may not
// be valid depending on the action being logged.
Details string `json:",omitempty"`
// Timestamp is the time at which the audit log was generated on the node.
Timestamp time.Time `json:",omitzero"`
}