Skip to content

Connection Telemetry M93

Chris Sutton edited this page Nov 29, 2026 · 1 revision

Published documentation mirror. Edit the source through a repository PR. See Project status.

M9.3 — Endpoint network connection telemetry (#80)

Status: accepted native foundation (192 local gates, 618 configured CTests, 84 structural verifiers, nine hosted checks and maintainer visual review/merge); native explicitly supplied local socket collection foundation. Builds on network scope requirements and the accepted M9.2 correlation foundation. No production agent or manager integration, durable event ingestion, or GUI is added.

Collection and authorization contract (version 1)

KnetSentry::ConnectionTelemetry provides a synchronous, Qt-independent Linux collector for one explicitly supplied borrowed TCP socket descriptor. The trusted host integration must own the descriptor for the entire operation and ensure that the socket is from an approved host integration, with current administrative consent. The caller must supply current generation, exact approved local numeric address and interface name/index, collection consent and permission to retain peer metadata. No remote message may supply this authority. Default, withdrawn or stale consent returns no event before socket inspection. The expected generation is supplied by the trusted caller; this library is not a policy store or revocation publisher. Existing M3 transport authorization is independent, not a capture grant.

The collector requires an established TCP stream (SO_PROTOCOL, SO_TYPE, TCP_INFO). It compares the socket's SO_NETNS_COOKIE with a fresh unbound AF_UNIX socket in the calling thread's namespace. It checks the local endpoint against the exact approved address and verifies that it appears on exactly one up interface matching the approved name/index in current getifaddrs data. It rejects ambiguity and bounds address-list traversal at 4096 entries. The OS allocates the interface snapshot; this is not a hard bound on kernel/libc allocation or a real-time deadline. Local and peer tuples, TCP state, namespace and attachment are checked again before return. The reference socket is closed on all paths. No supplied descriptor is closed. These are sampled checks: they cannot establish atomic topology or policy epochs, actual ingress/egress interface, path, packet visibility or absence of changes between checks. Operational adapters must enforce current topology, configuration and source ownership; results are not durable grants. No public IP is rejected merely for being public; a peer address never grants permission to contact it.

Event and privacy contract

Field Meaning
Schema version 1, independent native typed event
Acquisition timestamp Local CLOCK_REALTIME milliseconds; not connection start or packet time
Policy generation Trusted caller's current approved configuration revision
Local interface index Checked address attachment; not actual packet path
Local and peer IPv4/IPv6 binary address, port, IPv6 link-local scope where present
Local role Unknown by default; Initiator or Acceptor only if asserted by a trusted integration that witnessed the operation
Source and destination Optional role-oriented connection endpoints; not packet direction

Addresses are numeric only, with zeroed IPv4 tails; unspecified, multicast, IPv4-mapped IPv6, malformed and oversize approval literals are rejected. Listeners, UDP, non-sockets, closed descriptors, invalid roles, wrong local address/interface and unavailable namespace evidence produce no event. IPv6 link-local zones must match the approved local interface when present. No DNS, probe, packet capture, process enumeration, payload access, credential access, connection initiation, external transfer, logging or persistence occurs in the collector. Only local kernel metadata queries and an unbound AF_UNIX reference socket are used. The typed Event retains both endpoints even if direction is unknown; it must not be represented as an OCSF journal event or persisted without an explicit future schema, authenticated provenance, privacy/retention and admission contract. No asset identity is inferred from the address; M9.2 remains authoritative for authenticated source attribution. The result may contain sensitive local and remote addresses and ports; the caller must keep it private and enforce policy on subsequent use. No process IDs, users, byte counts, payload, DNS or application metadata are collected.

Qualification and remaining scope

knetsentry_connection_telemetry_contract uses real, ephemeral, local-only IPv4 and IPv6 TCP connections. It verifies exact address bytes and listener port, reciprocal tuples, caller orientation, unknown direction, timestamp and scope, that an application byte remains unread by the collector, default/withdrawn consent, stale generations, invalid address syntax, wrong interface/address, invalid role, listener, UDP, non-socket and closed descriptor rejection. It prints only bounded completion markers, never addresses or ports. The target environment must support IPv4 and IPv6 loopback; missing support fails qualification. Cross- namespace rejection, topology races and external-peer collection are not independently exercised by this test. The collector is not linked into production applications.

Supports existing KS-NET-001/002/003/004/005/006/007/015/035/036/041 without altering their requirements. No new privileges or external dependencies. Full operational host-wide collection, source/interface configuration and epoch invalidation, durable consent and authenticated transport, UDP and short-lived connections, ingestion/storage/query schema and asset/event attribution remain outstanding. Agentless gateway observation remains independently required. Do not close issue #80 on this foundation alone.

Clone this wiki locally