KShield is a manager/agent platform inspired by the Elastic/Kibana + Agent model:
manager: central API, detector engine, dashboard, and policy storeagent: endpoint kernel monitor using eBPFLSM: inline blocking for outbound connects and local bind operations
The agent now captures:
execveexecution telemetryopenatandopenat2file access telemetryptraceactivity telemetry- kernel module load attempts (
init_module,finit_module) when available socket_connectLSM allow/block eventssocket_bindLSM allow/block events
The manager evaluates incoming events against file-based detectors loaded from manager/detectors/*.toml
and stores detector hits separately from the raw event stream. See Detector Authoring
for adding human-maintained rules.
- Agent registers itself to the manager.
- Agent loads eBPF telemetry probes and LSM enforcement hooks.
- Agent posts raw kernel events to the manager over HTTP JSON.
- Manager stores raw events in SQLite.
- Manager evaluates each event against loaded detectors and stores matching detector hits.
- Dashboard shows fleet health, raw events, triggered detectors, and active policy.
KShield detectors use TOML so users can add rules without changing code or needing extra dependencies.
Example:
id = "sensitive-shadow-access"
name = "Sensitive Shadow Access"
description = "Flags access attempts against /etc/shadow."
severity = "critical"
tags = ["credential-access", "filesystem"]
summary_template = "{comm} accessed {subject}"
[match]
event_types = ["file_open"]
subject_prefixes = ["/etc/shadow"]Supported match fields:
event_typesactionscomm_incomm_prefixessubject_prefixessubject_containsdst_portsdst_ipsuidsarg0_inarg1_in
Threshold detectors are also supported with threshold_count, threshold_window_secs, and group_by.
See Detector Authoring for examples and testing commands.
Signature-based antivirus is possible, but eBPF LSM should enforce userspace scan verdicts rather than scan file contents directly in kernel BPF. See Signature Antivirus With LSM.
cd <project-root>
bash scripts/start_manager.shOpen: http://127.0.0.1:8080
cd <project-root>
bash scripts/build_agent.shRun locally (requires root):
sudo ./agent/target/release/kshield-agent \
--manager-url http://127.0.0.1:8080 \
--bpf-object ./agent/bpf/kshield.bpf.oInstall deploy dependency on the host if needed:
sudo pacman -S --noconfirm python-paramikoDeploy:
python3 deploy/deploy_agent.py \
--host 192.168.122.27 \
--user he4p \
--manager-url http://<HOST_IP>:8080The deploy script prompts for the SSH password if --password is omitted. If the remote sudo password
differs from the SSH password, pass it with --sudo-password.
POST /api/v1/agents/registerGET /api/v1/agentsPOST /api/v1/eventsGET /api/v1/eventsGET /api/v1/detectionsGET /api/v1/detectorsGET /api/v1/metrics/summaryGET /api/v1/policyGET /api/v1/policy/<agent_id>POST /api/v1/policy/blocked-ipv4DELETE /api/v1/policy/blocked-ipv4POST /api/v1/policy/blocked-bind-portDELETE /api/v1/policy/blocked-bind-port
- LSM eBPF requires kernel support:
CONFIG_BPF_LSM=yand BTF enabled. - On Ubuntu VMs, the boot LSM order must include
bpf. Example GRUB setting:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash lsm=lockdown,capability,landlock,yama,apparmor,bpf" - Agent must run as root to load and attach eBPF programs.
socket_bindpolicy currently targets IPv4 bind attempts by local port.- A sample VM service unit is provided at
deploy/kshield-agent.service. - KShield now has its own detector engine. It does not embed Tracee's detector library directly.