Difficulty: Beginner Time: 5 minutes Prerequisites: Linux host with kernel 5.15+, root access
- How to start AegisBPF in audit mode
- How to create a deny rule for a file
- How to see block events in real-time
- How to switch from audit to enforce mode
Audit mode logs all enforcement decisions without actually blocking access. This is the safest way to test new policies.
# Start the daemon in audit mode (won't block, just logs)
sudo aegisbpf daemon --audit-onlyYou should see output like:
{"type":"state_change","state":"running","mode":"audit","reason":"daemon_start"}
Leave this terminal running and open a new one for the next steps.
# Create a test file we'll protect
echo "sensitive data" > /tmp/aegis-test-secret.txtCreate a minimal policy that blocks access to our test file:
cat > /tmp/aegis-test-policy.conf <<'EOF'
version=1
[deny_path]
/tmp/aegis-test-secret.txt
EOF
# Apply the policy
sudo aegisbpf policy apply /tmp/aegis-test-policy.conf# Try to read the file (in audit mode, this will succeed but generate a log)
cat /tmp/aegis-test-secret.txtIn the daemon terminal, you should see a block event:
{
"type": "block",
"pid": 12345,
"comm": "cat",
"path": "/tmp/aegis-test-secret.txt",
"action": "deny"
}Stop the daemon (Ctrl+C) and restart without --audit-only:
# Enforce mode — will actually block access
sudo aegisbpf daemonRe-apply the policy:
sudo aegisbpf policy apply /tmp/aegis-test-policy.confNow try reading the file:
cat /tmp/aegis-test-secret.txt
# Expected: "Permission denied" or "Operation not permitted"The file access is blocked at the kernel level!
# See block counts
sudo aegisbpf stats
# See detailed Prometheus metrics
sudo aegisbpf metrics# Stop the daemon (Ctrl+C in daemon terminal)
rm /tmp/aegis-test-secret.txt /tmp/aegis-test-policy.conf- Tutorial 2: Network Policy Enforcement
- Tutorial 3: Writing Custom Policies
- Tutorial 4: Debugging Policy Denials
- Audit mode (
--audit-only): Logs enforcement decisions without blocking. Always start here when testing new policies. - Enforce mode (default): Actually blocks access at the kernel level.
- Deny rules: Specify which files/paths/IPs/ports to block.
- Hot reload: Policies take effect immediately with
policy apply. No daemon restart needed.