Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Endpoint Agent

Repo: AnyOne-Endpoint (Rust workspace). The per-host agent that runs as the AnyOneAgent Windows service (anyone-agent.exe). It collects kernel and OS telemetry, runs the OCSF pipeline, orchestrates static analysis, executes remediation, and manages its own enrollment identity.

Workspace crates

The workspace has five members. Only the drivers and the service run on the endpoint long-term.

CrateBinaryRole
serviceanyone-agent.exeThe agent itself, covering everything below.
clianyone-agent-cli.exeInteractive shell that talks to the running agent over a named pipe.
notifieranyone-agent-notifier.exeHelper spawned into the active desktop session to show toast notifications.
updateranyone-updater.exeBoot-time service that verifies a staged update and rolls back on failure.
shared(lib)Types shared across crates: events, the IPC contract, and constants.

Note: package names for the client/notifier crates (anyedr-cli, anyedr-notifier) differ from their binary names.

Component view

ℹ️ Arrow colors:

  • Blue : data plane (telemetry flow)
  • Orange : control plane (commands, enrollment, and remediation actions).

Source tree

The service crate is a single binary. Its source is organized by subsystem.

service/src/
├── main.rs
├── service.rs
├── bootstrap.rs
├── config.rs
├── context.rs
├── event.rs
├── stats.rs
├── constants.rs
├── driver.rs
├── sources/
│   ├── etw/
│   ├── eventlog.rs
│   ├── kcallback/
│   ├── minifilter/
│   ├── lifecycle.rs
│   └── tamperwatch.rs
├── pipeline/
│   ├── normalizer.rs
│   ├── dedup.rs
│   ├── enricher.rs
│   ├── mapper.rs
│   └── batcher.rs
├── channel/
│   ├── remotectl.rs
│   ├── telemetry.rs
│   ├── static_analysis.rs
│   ├── localctl.rs
│   ├── notification.rs
│   ├── ndjson.rs
│   └── handlers/
├── static_api/
│   ├── filter.rs
│   └── worker.rs
├── commands/
│   ├── dispatcher.rs
│   ├── verifier.rs
│   ├── registry.rs
│   ├── trust_bundle.rs
│   ├── kill_process.rs
│   ├── file_quarantine.rs
│   ├── isolate_host.rs
│   ├── update.rs
│   ├── update_package.rs
│   ├── handler.rs
│   ├── context.rs
│   ├── outcome.rs
│   └── noop.rs
├── remediation/
│   ├── executor.rs
│   ├── kill.rs
│   ├── quarantine.rs
│   ├── isolation.rs
│   ├── verdict.rs
│   ├── audit.rs
│   └── types.rs
├── enrollment/
│   ├── identity.rs
│   ├── keystore.rs
│   ├── certmanager.rs
│   ├── stepca.rs
│   ├── tls.rs
│   ├── fingerprint.rs
│   ├── metadata.rs
│   └── startup.rs
└── utils/
    ├── process_tree.rs
    ├── bloom_filter.rs
    ├── hash.rs
    ├── pipe.rs
    ├── path.rs
    ├── install.rs
    ├── executable.rs
    └── user_resolver.rs

External communication

The diagram shows the wires. This table describes what actually crosses each one, the external processes the agent talks to, what moves, and over which protocol. Internal module-to-module calls are omitted.

FromToDataProtocol
AnyOneKcallback (kernel)sources/ kcallbackKernel events: process, thread, image load, registry, object, and network activityIOCTL and shared ring buffer
AnyOneMinifilter (kernel)sources/ minifilterFile-system activity eventsMinifilter communication port
Event Tracing for Windowssources/ etwOperating-system trace events from ETW providersETW real-time session
Windows Event Logssources/ eventlogWindows event-log recordsEvent Log subscription
channel/ telemetryGatewayBatched OCSF telemetrygRPC, mTLS
channel/ remotectlGatewayUp: enrollment, heartbeats, and command results. Down: signed commands and trust bundlesgRPC bidirectional stream, mTLS
channel/ staticanalysisStatic Analysis APIFiles to scan and hashes to look up, with verdicts returnedHTTPS, mTLS
enrollment/ certmanagerstep-caCertificate bootstrap (CSR signing) and renewalHTTPS, pinned root
AnyOne CLIchannel/ localctlLocal operator commands and status queriesNamed pipe
channel/ notificationAnyOne NotifierToast notification requestsChild-process handoff

Module layout (service)

What each module and subsystem is responsible for.

Entry / host:

ModuleResponsibility
main.rsDevelopment-only entry point for running the agent directly from the command line. Slated for removal, since production installs run the agent as a Windows service with its entry point in service.rs.
service.rsThe production entry point. Registers with the Service Control Manager, handles start and stop requests, and brings up the subsystems: configuration, shared state, the control channel, the pipeline, and the sources.
bootstrap.rsOne-time startup setup: process hardening, acquiring the privileges the agent needs, and initialising logging.
config.rsA global configuration singleton populated from environment variables.
context.rsShared runtime state handed to every subsystem.
event.rsThe internal event model and the set of telemetry sources.
stats.rsRuntime counters used for metrics and diagnostics.
constants.rsFixed values shared across the service.
driver.rsTransport to the AnyOneKcallback kernel driver. Opens the device and moves telemetry and commands across the kernel boundary.

Subsystems:

ModuleResponsibility
sources/Collectors that gather telemetry from the kernel drivers and the operating system.
pipeline/Transforms raw events into batched OCSF telemetry through normalize, deduplicate, enrich, map, and batch stages.
channel/All external transport: the telemetry and control channels to the gateway, the static-analysis client, the local CLI server, and the notifier handoff.
static_api/Orchestrates static-analysis API calls, using a local filter to decide which files actually need a scan.
commands/Receives commands from the server, verifies their signatures, and dispatches them to the matching handler.
remediation/Executes response actions (kill process, quarantine file, isolate host) and records an audit trail.
enrollment/Manages the agent’s cryptographic identity: enrollment, secure key storage, and certificate renewal.
utils/Shared helper routines used across the service.

Configuration

The agent takes all of its configuration from environment variables, read once at startup into a global configuration singleton. There is no configuration file the agent parses itself.

How those variables are set depends on the install path:

  • Normal (dashboard) install. The installer provisions the credentials and writes the configuration for you, so there is nothing to set by hand.
  • Manual install. You write the variables yourself as the service’s registry Environment value, which the Service Control Manager injects into the process when it starts.

The mandatory variables are:

VariablePurpose
GRPC_ENDPOINTGateway address for the telemetry and control channels.
KERNEL_DRIVER_PATHLocation of the AnyOneKcallback driver file.
MINIFILTER_DRIVER_PATHLocation of the AnyOneMinifilter driver file.
CA_URL, CA_FINGERPRINT, CA_PROVISIONERstep-ca connection and root pinning for enrollment.
ENROLLMENT_CERT_SUBJECTThe device id, which must match the enrollment certificate.
ENROLLMENT_X5C_CERT_PATH, ENROLLMENT_X5C_KEY_IMPORT_PATHThe delivered device credential.
COMMAND_ANCHOR_PUBLIC_KEY_BASE64Anchor public key used to verify signed commands.

For the full procedure and every available setting, see Manual Installation → Configuring the Agent in the Installation Guide.

Library inventory

Key third-party libraries the agent depends on, for traceability when reading the code.

LibraryUsed for
tokioAsynchronous runtime for all concurrent tasks.
tonic, prostgRPC transport and Protocol Buffers encoding.
anyprotoShared AnyOne protobuf contracts for telemetry and control.
reqwestHTTP client for the Static Analysis API.
windows, windows-serviceWindows system APIs and Windows service integration.
ed25519-dalekVerifying signed server commands.
p256, pkcs8, rcgen, x509-parserEnrollment certificates and key handling.
xorfLocal membership filter for the static-analysis pre-check.
arc-swapHot-swapping the rotating identity and filter without a restart.
sha2, hex, base64Hashing and encoding.
serde, serde_json, postcardSerialization.
quick-xmlParsing Windows event-log XML.
dashmap, once_cellShared concurrent state.
clapCommand-line parsing.
flexi_logger, logLogging.
zipExtracting update packages.