---
title: "Runtime sensor"
description: "Install Falco with TRUSTIVAN's 33 runtime rules, see each detection on its workload, and stop, isolate or scale down the pod."
keywords: ["runtime security", "Falco", "eBPF", "CWPP", "Helm", "container runtime detection", "crypto miner detection", "container drift", "runtime response", "MITRE ATT&CK"]
---

The runtime sensor watches what containers do while they run: container
escapes, reverse shells, crypto-miners, credential and secret access, privilege
escalation, persistence, drift (a binary that is not in the image), defense
evasion, discovery tools and unexpected outbound connections. Each detection
appears on the **Runtime** page, on the workload and image it happened in, and
as a finding. A [response policy](#response-actions) can act on it: stop the
pod, cut its network, scale its workload to zero or label it.

TRUSTIVAN does not write its own kernel sensor. The `trustivan-runtime` Helm
chart installs **[Falco](https://falco.org) 0.45.2** with its modern eBPF probe
(no kernel module), TRUSTIVAN's rule library, and a small relay that sends each
detection to TRUSTIVAN with your API key. The optional responder carries out
approved response actions.

## Before you install

- A Kubernetes cluster [connected to TRUSTIVAN](/configuration/cloud-and-kubernetes).
  You need its id (the `id` returned by `POST /api/v1/kubernetes/clusters`, also
  in the cluster page's address).
- Nodes on Linux 5.8 or later with BTF (`/sys/kernel/btf/vmlinux`), which the
  modern eBPF probe needs. Most current distributions have it.
- A TRUSTIVAN API key holding **`scans:create` only** (Settings, API keys).
  It can post events to the clusters of its organization and nothing else.

## Install

```bash
kubectl create namespace trustivan-runtime
kubectl -n trustivan-runtime create secret generic trustivan-runtime-key \
  --from-literal=token="$TRUSTIVAN_API_KEY"

helm install trustivan-runtime ./infra/helm/trustivan-runtime \
  --namespace trustivan-runtime \
  --set clusterId=<cluster id> \
  --set trustivan.existingSecret=trustivan-runtime-key
```

The chart is in the TRUSTIVAN repository at `infra/helm/trustivan-runtime`; it
is not published to a Helm repository. For a self-hosted TRUSTIVAN, add
`--set trustivan.url=https://<your host>` (https only).

Within a minute every node runs one `trustivan-runtime` pod. To see it work,
open a shell in any container (`kubectl exec -it <pod> -- sh`): a **Shell in
container** event appears on the Runtime page.

## What the chart installs

| Object | What it is |
|---|---|
| DaemonSet `trustivan-runtime` | One pod per node (control plane included) with two containers. |
| Container `falco` | Falco 0.45.2, pinned by image digest. Modern eBPF probe. Runs as root with four capabilities (`BPF`, `PERFMON`, `SYS_RESOURCE`, `SYS_PTRACE`), not privileged; read-only root filesystem; reads `/proc` and the container runtime socket directories read-only. Liveness and readiness on Falco's `/healthz`. |
| Container `relay` | nginx 1.29.8, pinned by digest, as user 101 with no capabilities and a read-only root. It listens on the pod's loopback (`127.0.0.1:8080`) only, adds `Authorization: Bearer <key>` and forwards to TRUSTIVAN over verified TLS. Falco's HTTP output cannot add a header, which is why it exists. |
| ConfigMaps | Falco's whole configuration and the rules file. Nothing from the image's own `config.d` is read. |
| ServiceAccount | No token mounted, and no Role or ClusterRole: the sensor never calls the Kubernetes API. Pod and namespace names come from the container runtime. |
| Deployment `trustivan-runtime-responder` | Only with `responder.enabled`. See [Response actions](#response-actions). |
| Secret | Only when you pass `trustivan.token` instead of `existingSecret`. |

### Values

| Value | Default | Meaning |
|---|---|---|
| `clusterId` | (required) | The TRUSTIVAN cluster id. Must be a UUID. |
| `trustivan.url` | `https://app.trustivan.com` | Where TRUSTIVAN's API is. |
| `trustivan.existingSecret` / `trustivan.token` | | The API key: a Secret with key `token`, or the key itself. |
| `falco.priority` | `notice` | The lowest Falco priority sent. |
| `falco.upstreamRules` | `false` | Also load Falco's own default rules. They are broad and noisy; when on, rule matching becomes `all` so an upstream rule cannot hide a curated one. |
| `falco.extraRules` | `""` | More Falco rules (YAML), loaded after the curated ones. |
| `falco.runtimeSocketDirs` | containerd, k3s, CRI-O | Host directories holding the container runtime socket. |
| `falco.apparmorUnconfined` | `true` | Some distributions' default AppArmor profile refuses `bpf()`. |
| `falco.resources`, `relay.resources` | 100m/256Mi requests, 1 CPU/1Gi limits; 10m/16Mi, 200m/64Mi | Per pod. |
| `tolerations`, `nodeSelector`, `priorityClassName` | every node | Scheduling. |
| `responder.enabled` | `false` | Run the responder that carries out approved response actions. |
| `responder.image` | `""` | The `trustivan-backend` release image, pinned by digest (`...@sha256:...`); refused otherwise. |
| `responder.interval` | `5s` | How often the responder asks for actions. |

**Tetragon is not shipped.** TRUSTIVAN reads Falco's event format only; there is
no Tetragon values file and no Tetragon parser.

## The rule library

33 rules in 12 categories, each mapped to a MITRE ATT&CK tactic and technique
(the rule's Falco tags carry them, for example `mitre_privilege_escalation`,
`T1611`). Each rule is in the [check catalogue](/concepts/check-catalogue)
under area `runtime`, with what it detects, why it matters and how to fix it.

| Category | Rules | ATT&CK |
|---|---|---|
| Crypto-mining | miner binary, stratum URL or mining-pool port; a public mining pool on the command line | T1496 |
| Reverse shell | standard input, output or error redirected to a network socket; netcat with `-e`/`-c` | T1059.004 |
| Execution | interactive shell on a terminal | T1059 |
| Container escape | container runtime socket opened; cgroup `release_agent` written (CVE-2022-0492); `nsenter`/`unshare`/`chroot`; `mount`; kernel module load; ptrace attach or memory write | T1611, T1547.006, T1055.008 |
| Credential access | password database, sudoers or SSH key read; cloud credential files; searching for keys or passwords; the cloud metadata endpoint | T1003, T1552.001, T1552.005 |
| Privilege escalation | setuid or setgid bit set; `sudo`/`su` | T1548.001, T1548.003 |
| Persistence | SSH `authorized_keys` written; users or groups changed; write below `/etc` | T1098.004, T1136.001, T1543 |
| Package management | a package manager run in a running container | T1072 |
| Drift | **an executable not in the image run** (Falco's `proc.is_exe_upper_layer`); fileless execution from memory (`memfd`); a program run from `/tmp`, `/var/tmp`, `/dev/shm` or `/run`; a compiler run; a file written in a binary directory | T1105, T1620, T1059.004, T1027.004, T1574 |
| Defense evasion | a log or shell history cleared; a firewall tool run | T1070.003, T1562.004 |
| Discovery | `kubectl`, `crictl`, `ctr`, `docker`, `helm` run in a container; network scanners and raw connection tools | T1613, T1046 |
| Unexpected outbound | a Tor port; outbound SSH; a connection outside an egress allowlist you set | T1090.003, T1021.004, T1041 |

Rule matching is `first` (one event, one rule), so a specific rule comes before
a broader one in the file: a renamed miner in `/tmp` is reported as a miner, not
as drift.

The egress allowlist rule is silent until you name images:

```yaml
- list: trustivan_egress_restricted_images
  items: [registry.example.com/payments-api]
  override: { items: append }
- list: trustivan_allowed_egress_networks
  items: ["10.0.0.0/8", "203.0.113.10/32"]
  override: { items: append }
```

To let an image reach the metadata endpoint (a node agent, a cloud SDK without
workload identity), extend the rule's list in `falco.extraRules`:

```yaml
- list: trustivan_metadata_allowed_images
  items: [registry.example.com/node-agent]
  override:
    items: append
```

A Falco you already run can use the same rules file
(`infra/helm/trustivan-runtime/rules/trustivan_rules.yaml`) and post JSON
output to `POST /api/v1/kubernetes/clusters/{id}/events`.

## What TRUSTIVAN does with an event

- **Reads** the rule, priority, time, node, container id, image, image digest,
  pod and namespace. Unknown fields are ignored; at most 64 output fields are
  kept; a request body may be at most 1 MiB and 500 events.
- **Collapses repeats.** An event with the same rule, pod, container, image and
  detail (process, file, destination) as one stored in the last 10 minutes is
  counted on that event instead of stored. The list shows it as `+N`.
- **Bounds each cluster** to 600 stored events a minute. Events over that are
  counted as dropped; the Runtime page shows the last 24 hours' drops.
- **Joins** the event to the workload it ran in and the image that workload
  runs, and, by image digest, to the scanned image even when the pod is not
  inventoried.
- **Files a finding** per rule and workload on the cluster. A new critical or
  high one is sent to the [notification destinations](/how-to/configure-notifications)
  subscribed to scan alerts.
- **Adds context to the image.** The image's page shows the last seven days'
  detections, and the risk explanation of each of its findings says
  "Observed suspicious runtime behaviour" when there were critical or high
  ones. This adds no points to the score.

## What is verified, and what is not

- **Verified:** all 33 rules, and the `extraRules` examples above, load with
  `falco -V` on Falco 0.45.2. Every one of them fired against a live Falco
  0.45.2 running under Docker (modern eBPF, the chart's configuration) on a
  development host, driven by `scripts/runtime/record-falco-events.sh` (two
  victim containers doing what the rules describe), and those recorded events
  are the test fixtures the ingest is tested on
  (`backend/internal/runtime/testdata/falco/`). That run is also how the mount
  rule was found to fire on runc's own init at every container start; runc and
  crun are excluded.
- **Verified:** the chart passes `helm lint` and `helm template` with its
  defaults and with overrides, refuses six invalid values, and its rendered
  output passes `kubeconform` and checks of the properties above (pinned
  digests, the four capabilities, no RBAC without the responder, the
  responder's four verbs exactly, loopback-only relay)
  (`scripts/ci/check-runtime-chart.sh`, run in CI).
- **Verified on a throwaway cluster:** the chart installed on a single-node
  k3d cluster (k3s v1.30.6, containerd) on a development host. Falco started
  with the modern eBPF probe under the four capabilities and a read-only root,
  the container plugin named the namespace, pod, image and digest through the
  k3s containerd socket, and *Write below /etc*, *Sensitive file read* and
  *Package manager run* fired in a pod; those three events are a test fixture
  too. Falco's HTTP output reached the relay. That install surfaced, and the
  chart now fixes, a relay that would not start when TRUSTIVAN's host name did
  not resolve at start.
- **Not verified:** a relay posting to a live TRUSTIVAN from inside a cluster
  (the k3d test pointed it at a name that does not resolve), a multi-node or
  managed cluster (EKS, GKE, AKS), CRI-O, and the AppArmor setting on a host
  that enforces AppArmor. On k3d Falco logged that its TOCTOU mitigation
  probes and BPF iterators were unavailable (no tracefs mount, not the host
  PID namespace); detection still worked, and processes already running when
  Falco starts are learned as they act rather than up front.
- **Not measured:** CPU and memory overhead on a busy node. The limits are
  ceilings, not measurements.

## Response actions

A **response policy** names detections (rule categories, or curated rule ids,
at or above a severity), an **action** and whether it runs **on its own** or
**after a person approves it**. When an ingested event matches, TRUSTIVAN
creates an action; the **responder** in your cluster claims it, carries it out
with its own service account and reports the result. Nothing connects into the
cluster: the responder polls TRUSTIVAN over HTTPS with the sensor's key.

| Action | What the responder does |
|---|---|
| Stop the pod (`kill_pod`) | Deletes the pod. Its controller starts a fresh one from the image, which drops whatever was added at runtime. |
| Isolate the pod's network (`isolate_network`) | Creates a NetworkPolicy `trustivan-isolate-<action id>` selecting the label `trustivan.com/quarantine=<action id>` with no ingress and no egress rules, then labels the pod. The pod keeps running for forensics. Enforced only where the cluster's network plugin enforces NetworkPolicy. |
| Scale the workload to zero (`scale_to_zero`) | Sets the owning Deployment or StatefulSet's replicas to 0. A pod with no such owner records a failed action. |
| Label the pod quarantined (`quarantine_label`) | Adds `trustivan.com/quarantine` and the rule as an annotation, and nothing else. |

- **Dry run** (the default for a new policy) sends the change with the API
  server's `dryRun=All`: RBAC, admission and validation run, nothing is kept,
  and the result says whether the real action would have worked.
- **Approval:** actions of an approval policy wait on the Runtime page under
  *Actions* for **Approve** or **Reject**. A person can also act on a pod
  directly (`POST /api/v1/runtime/response/actions`); holding the approval
  permission, their request is its own approval and names them.
- **Never acted on:** `kube-system`, `kube-public`, `kube-node-lease`, any
  namespace a policy excludes, events without a pod, and rules that are not
  curated (your `extraRules`).
- **Expiry:** an action not carried out within an hour expires; one claimed
  but never reported is marked failed. A pod is short-lived, and an old
  approval should not act on its replacement.
- **Audit:** every policy change, request, decision and result is in the
  organization's audit trail (`runtime_response.*`).
- **Who may:** policies and approvals need `credentials:manage` and a person
  (not an API key); reading needs `findings:read`; the responder uses the
  cluster's `scans:create` key and sees only its own cluster's actions.

Enable the responder with the `trustivan-backend` image of your TRUSTIVAN
release (it runs `/app/trustivan respond`):

```bash
helm upgrade trustivan-runtime ./infra/helm/trustivan-runtime --reuse-values \
  --set responder.enabled=true \
  --set responder.image=ghcr.io/trustivan/trustivan-backend:<version>@sha256:<digest>
```

Its ClusterRole grants exactly `delete` and `patch` on pods, `patch` on
`deployments/scale` and `statefulsets/scale`, and `create` on networkpolicies:
nothing that reads a Secret.

## Drift prevention

Detection tells you a binary that is not in the image ran. **Drift
prevention** stops it being written in the first place: turn it on with
`drift_prevention: true` on the cluster's admission settings
(`PUT /api/v1/kubernetes/clusters/{id}/admission`), and in `deny` mode
admission refuses any container whose `securityContext.readOnlyRootFilesystem`
is not `true`, so nothing can be added to the image's filesystem after start.
Writable volumes (an `emptyDir`) remain; the *drift*, *fileless execution* and
*executable run from a temporary directory* rules cover them, and a response
policy on the `drift` category can stop the pod when one fires. That is
detect-and-respond, not an in-kernel block: the dropped program runs until the
responder acts.

## What is verified for response

- **Verified in tests:** the policy matcher (category, rule, severity floor,
  protected and excluded namespaces), the full loop on a real database
  (ingest creates the action, approval, exclusive claim, report, expiry,
  re-delivered batches create nothing twice), tenant isolation of the new
  tables, and the responder's exact Kubernetes requests against a recorded fake
  API server (delete, merge-patch label, NetworkPolicy, `/scale`,
  `dryRun=All`, a 403 reported as a failure).
- **Verified on a throwaway cluster:** the chart's responder Deployment,
  ServiceAccount and ClusterRole, applied as rendered to a single-node k3d
  cluster (k3s, its built-in NetworkPolicy controller), with a stand-in for
  TRUSTIVAN's claim and report endpoints. Under exactly the four verbs it:
  deleted a pod as a dry run (the pod stayed) and for real (its Deployment
  replaced it), labelled a pod, created the isolating NetworkPolicy (the
  isolated pod could no longer open a connection to the API server's service
  address while its sibling could), scaled a Deployment to zero as a dry run
  and for real, and refused a `kube-system` action on its own.
- **Not verified:** the responder against a live TRUSTIVAN deployment, and on
  a managed cluster (EKS, GKE, AKS) or with a CNI other than k3s's.

## Troubleshooting

- **No events at all:** check `kubectl -n trustivan-runtime logs ds/trustivan-runtime -c falco`
  for a probe error (a kernel without BTF), and `-c relay` for a refused key
  (401) or an unreachable TRUSTIVAN. `last_runtime_event_at` on the cluster
  says when the last event arrived.
- **Events without a pod:** the container plugin could not read the runtime
  socket. Add its directory to `falco.runtimeSocketDirs`.
- **Dropped events:** a rule is firing far more than the curated set normally
  does. Find it on the Runtime page and tune it with `falco.extraRules`.
