Pcornel
Security · Container Security

Linux Capabilities

Cheat sheet · https://pcornel.dk/topic.php?topic=5041

Back to the Topic

Answer

Linux capabilities split root's powers into units like NET_ADMIN or SYS_ADMIN. Containers should drop all capabilities and add back only what they need, and never run privileged.

Remember

  • Capabilities split root into units like NET_ADMIN.
  • Drop ALL and add back only what is needed.
  • Never run --privileged in production.

First checks

  • docker inspect <c> --format '{{.HostConfig.CapAdd}} {{.HostConfig.CapDrop}}' — capabilities
  • kubectl get pod <p> -o jsonpath='{..securityContext.capabilities}' — pod caps
  • capsh --decode=<hex> — decode CapEff

Verify in this order

container → capability set → kernel operations

Where it usually breaks

First mismatch in platform/workload identity → desired configuration → management/control plane → runtime enforcement → telemetry → workload/resource outcome; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5041

Confirmation

Confirm action

Continue?