Syself nodes have the BPF Linux Security Module (BPF LSM) enabled. This allows agents such as [Tetragon](https://tetragon.io/) to enforce security policies directly in the kernel, without loading a kernel module. Both can deny an operation, but a BPF LSM policy cannot override a restriction imposed by AppArmor. See [Use AppArmor](/docs/hetzner/apalla/security/use-apparmor). ## Restrict access to BPF LSM Loading a BPF LSM program requires the `CAP_BPF` and `CAP_PERFMON` Linux capabilities. These capabilities allow an agent to attach security policies that affect processes across the entire node, not just the containers it monitors. A misconfigured policy can interfere with system components such as the kubelet or container runtime. Only grant these capabilities to trusted security agents. There are three ways to restrict access to these capabilities: - **Enforce Pod Security Standards:** Set the `baseline` Pod Security level on every namespace except the agent's namespace. Baseline prevents pods from running privileged or requesting additional `BPF` and `PERFMON` capabilities. By default, the cluster reports Pod Security violations but does not prevent the pods from being created. Set the enforcement level to `baseline` to reject pods that violate these restrictions. See [Enforce Pod Security Standards](/docs/hetzner/apalla/security/enforce-pod-security-standards). - **Add an admission policy:** Use a ValidatingAdmissionPolicy to reject pods requesting these capabilities outside the agent's namespace. This provides a cluster-wide restriction. See [Control admission](/docs/hetzner/apalla/security/control-admission), or [Use Kyverno policies](/docs/hetzner/apalla/security/use-kyverno-policies) if you already run Kyverno. - **Restrict access to the agent's namespace:** Only trusted users and controllers should be able to create or modify pods in this namespace. Use [RBAC](/docs/hetzner/apalla/security/manage-access-and-tenancy) to control access. ## Example: Block access to a file The following Tetragon `TracingPolicy` attaches to the `file_open` LSM hook and denies access to `/etc/group` for pods labeled `app: lsm-test`: ```yaml apiVersion: cilium.io/v1alpha1 kind: TracingPolicy metadata: name: deny-etc-group spec: podSelector: matchLabels: app: lsm-test lsmhooks: - hook: "file_open" args: - index: 0 type: "file" selectors: - matchArgs: - index: 0 operator: "Equal" values: ["/etc/group"] matchActions: - action: Override argError: -1 ``` A pod with the matching label cannot open the file: ```console $ kubectl exec lsm-target -- head -1 /etc/group head: /etc/group: Operation not permitted ``` A pod without the label on the same node can still access it: ```console $ kubectl exec lsm-control -- head -1 /etc/group root:x:0: ``` The `podSelector` limits the policy to the selected workloads. Other pods on the node are not matched by this policy. ## Roll out enforcement safely A policy that blocks the wrong operation can interfere with normal node operations. For example, blocking an operation required by the kubelet or container runtime can make the node unusable. Roll out policies gradually: Observe first Start with policies that report suspicious operations without blocking them. Run the agent long enough to observe normal workload activity, including node maintenance and upgrades. Enforce on one node pool Enable enforcement on a single worker pool using the agent's node selector or a dedicated pool. Monitor [node health conditions](/docs/hetzner/apalla/observability/reference/node-health-conditions) and check that your workloads continue to operate normally. Expand gradually Once the policies work as expected, enable enforcement on the remaining node pools. Keep policies in version control alongside your other cluster configuration. ## Compatibility with kernel hardening profiles BPF LSM enforcement works with the `standard` and `hardened` [kernel hardening profiles](/docs/hetzner/apalla/security/kernel-hardening-profiles). The `sealed` profile restricts eBPF programs from reading kernel memory. Tetragon's built-in base sensor tracks processes and collects information about them. It uses the `bpf_probe_read` helper to read kernel memory, which the `sealed` profile restricts. As a result, Tetragon cannot currently start on sealed nodes. If you use sealed nodes, keep the Tetragon DaemonSet off those nodes using node affinity. For the Tetragon Helm chart, configure this under `affinity`. See [Keep tracers off sealed nodes](/docs/hetzner/apalla/security/kernel-hardening-profiles#keep-tracers-off-sealed-nodes). Other runtime security agents may have different requirements. Test them on a sealed node before relying on them in production. ## Related - [Runtime threat detection](/docs/hetzner/apalla/security/runtime-threat-detection) - [Kernel hardening profiles](/docs/hetzner/apalla/security/kernel-hardening-profiles) - [Use AppArmor](/docs/hetzner/apalla/security/use-apparmor) - [Control admission](/docs/hetzner/apalla/security/control-admission) - [Use Kyverno policies](/docs/hetzner/apalla/security/use-kyverno-policies) - [Enforce Pod Security Standards](/docs/hetzner/apalla/security/enforce-pod-security-standards)