Skip to content

TracingPolicy YAML Schema

TracingPolicy is the YAML format used to define custom detection rules and enforcement policies on the Telovix Sensor. This page is the schema reference. For authoring guidance and examples, see Custom Detection Rules and LSM Hooks.


Top-level structure

yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: telovix-custom-<name>
spec:
  kprobes:    # or lsmhooks, or uprobes - not combined
    - ...
FieldValueNotes
apiVersioncilium.io/v1alpha1Required. Fixed value.
kindTracingPolicyRequired. Fixed value.
metadata.nameStringCustom rules authored by operators must start with telovix-custom-. System policies use other prefixes.
specObjectMust contain exactly one of kprobes, lsmhooks, or uprobes. Do not mix types in a single policy.

kprobes

Use kprobes to hook kernel functions and syscalls. Kprobes can observe function arguments at entry time and return values at exit.

yaml
spec:
  kprobes:
    - call: sys_execve
      syscall: true
      args:
        - index: 0
          type: string
      selectors:
        - matchArgs:
            - index: 0
              operator: "Prefix"
              values:
                - "/tmp/"
          matchActions:
            - action: Post

kprobe fields

FieldRequiredDescription
callYesKernel function or syscall name. For syscalls, use the short form: sys_execve, sys_openat, sys_write, tcp_connect, etc.
syscallYestrue for syscalls (use BPF_PROG_TYPE_KPROBE with syscall=true). false for kernel functions.
argsNoArray of argument capture specifications (see arg fields below).
selectorsNoArray of selector conditions (see selectors below).
returnArgNoCapture the function return value. Same format as an arg entry. Use index: 0 for the return value.

PREEMPT_RT note: On kernels with PREEMPT_RT patches, kprobes with syscall: true that use BPF_MODIFY_RETURN may fail verification. The sensor detects this at startup and disables affected policies automatically.


lsmhooks

Use lsmhooks to attach to Linux Security Module hook points. LSM hooks run before the kernel completes an operation and support the Override action (pre-execution denial). The Override action is not available on kprobes.

yaml
spec:
  lsmhooks:
    - hook: bprm_check_security
      args:
        - index: 0
          type: linux_binprm
      selectors:
        - matchArgs:
            - index: 0
              operator: "Postfix"
              values:
                - "suspicious_binary"
          matchActions:
            - action: Override
              argError: -1

Supported LSM hooks

HookDescriptionArg 0 type
bprm_check_securityCalled before a new binary image loads. Fires before process_exec.linux_binprm
task_fix_setuidCalled on UID/GID changes via setuid/setgid.(none required)
kernel_read_fileCalled when the kernel reads privileged files.file
file_openCalled when a file is opened.file

Important: LSM hooks with args must declare at least one arg or matchArgs selectors will silently fail. The bprm_check_security hook requires type: linux_binprm for arg 0, not bprm or any shorthand.

lsmhook fields

FieldRequiredDescription
hookYesLSM hook name from the supported list above.
argsYes (for matchArgs)Argument capture specifications.
selectorsNoArray of selector conditions.

uprobes

Use uprobes to hook user-space library functions. The sensor uses uprobes for TLS library instrumentation (OpenSSL, GnuTLS, BoringSSL, Go TLS).

yaml
spec:
  uprobes:
    - path: /lib/x86_64-linux-gnu/libssl.so.3
      symbols:
        - SSL_write
      args:
        - index: 0
          type: sock
        - index: 1
          type: char_buf
          sizeArgIndex: 3
        - index: 2
          type: int
      selectors:
        - matchActions:
            - action: Post

uprobe fields

FieldRequiredDescription
pathYesFull path to the user-space library or binary to hook.
symbolsYesArray of function symbol names to hook within the binary.
argsNoArgument capture specifications.
selectorsNoArray of selector conditions.
returnArgNoCapture the return value.

Arg types

The args array entries specify which function arguments to capture and how to interpret them.

FieldRequiredDescription
indexYesZero-based argument position.
typeYesType string from the table below.
sizeArgIndexConditionalFor char_buf: 1-based index of the arg that holds the buffer size. Value 3 means use arg at index 2 as the size.

Supported arg types

TypeDescription
stringNull-terminated string.
int32-bit signed integer.
uint3232-bit unsigned integer.
uint6464-bit unsigned integer.
char_bufBinary buffer. Requires sizeArgIndex to limit capture length.
sockKernel socket structure.
sockaddrSocket address structure.
fileKernel file structure (for file_open and kernel_read_file LSM hooks).
linux_binprmBinary program structure (for bprm_check_security LSM hook).
nopSkip this argument position (no capture).

Selectors

Each entry in the selectors array is evaluated against a captured event. A selector matches when all its conditions match. Multiple selectors in the array are OR-combined: the action fires if any selector matches.

yaml
selectors:
  - matchArgs:
      - index: 0
        operator: "Prefix"
        values:
          - "/tmp/"
          - "/dev/shm/"
    matchActions:
      - action: Post

matchArgs

Filter on captured argument values.

FieldDescription
indexArgument index to filter on (matches the index from args).
operatorComparison operator (see table below).
valuesArray of string values to compare against. Multiple values are OR-combined within a single matchArgs entry.

Operators

OperatorDescription
EqualExact match on the full argument value.
PrefixArgument value starts with one of the given strings.
PostfixArgument value ends with one of the given strings.
GTArgument numeric value is greater than the given value.
MaskBitwise AND of the argument value with the given mask is non-zero. Used for checking flag fields.

matchActions

Specifies what to do when the selector matches. Place matchActions as a sibling of matchArgs within the same selector block.

yaml
selectors:
  - matchArgs:
      - index: 0
        operator: "Equal"
        values:
          - "/usr/bin/curl"
    matchActions:
      - action: Post

Actions

ActionWhere it worksFieldsDescription
Postkprobes, lsmhooks, uprobes(none)Emit the event to the Console. This is the observe-mode action.
Signalkprobes, uprobesargSig: <signal_number>Send a signal to the triggering process. argSig: 9 sends SIGKILL. The process starts but is terminated before it completes.
Overridelsmhooks onlyargError: <errno>Return an error from the kernel call, preventing the operation before the process begins. argError: -1 returns EPERM.

The Override action is exclusive to BPF LSM hooks. Using it in a kprobes section will cause a policy validation error.

Signal example (kill on exec from /tmp)

yaml
selectors:
  - matchArgs:
      - index: 0
        operator: "Prefix"
        values:
          - "/tmp/"
    matchActions:
      - action: Signal
        argSig: 9

Override example (block binary execution)

yaml
selectors:
  - matchArgs:
      - index: 0
        operator: "Postfix"
        values:
          - "malicious_binary"
    matchActions:
      - action: Override
        argError: -1

Limits

LimitValueNotes
Max selectors per kprobe/uprobe5Tetragon kernel verifier limit (reduced from 8 in older versions). Policies exceeding this are split automatically by the sensor.
Max custom rules per Console10Enforced by the Console API.
Max YAML size per rule16 KBEnforced by the Console API.
Buffer capture size~4 KBBPF stack limit for char_buf captures.

Complete kprobe example

The following policy captures sys_write calls to file descriptors when the write size is greater than 8 bytes:

yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: telovix-custom-large-write-detect
spec:
  kprobes:
    - call: sys_write
      syscall: true
      args:
        - index: 0
          type: int
        - index: 1
          type: char_buf
          sizeArgIndex: 3
        - index: 2
          type: int
      selectors:
        - matchArgs:
            - index: 2
              operator: "GT"
              values:
                - "8"
          matchActions:
            - action: Post

Complete LSM block example

The following policy blocks execution of any binary whose path ends with cryptominer:

yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: telovix-custom-block-cryptominer
spec:
  lsmhooks:
    - hook: bprm_check_security
      args:
        - index: 0
          type: linux_binprm
      selectors:
        - matchArgs:
            - index: 0
              operator: "Postfix"
              values:
                - "cryptominer"
          matchActions:
            - action: Override
              argError: -1

Policy naming convention

Operator-authored custom rules must use names starting with telovix-custom-. The Console API validates this prefix on creation. System-managed policies (baseline kprobe policies, TLS uprobe policies, Guardian Profile policies) use different prefixes and are managed automatically by the sensor.


Further reading

Released under the Telovix Commercial License.