capable(8)

πŸ“¦ version 0.36.1, in alpine 3.24, nixpkgs unstable, opensuse-leap 16.0

✨ capable(8) ✨

System Manager's Manual πŸ’– Manual name: capable(8)

πŸŽ€ NAME πŸŽ€

capable, trace security capability checks (cap_capable()) πŸ‘€βœ¨

πŸ’… SYNOPSIS πŸ’…

capable [-h] [-v] [-p PID] [-K] [-U] [-x] [--cgroupmap MAPPATH]
                  [--mntnsmap MAPPATH] [--unique]

πŸ“– DESCRIPTION πŸ“–

okay so this one traces security capability checks in the kernel and prints details for every single call 😭 it's giving detective energy. It's super useful for general debugging, and also for security enforcement, like figuring out a white list of capabilities an application actually needs πŸ”₯

Since this uses BPF, only the root user can use this tool πŸ‘‘ no cap, not everyone gets to run it.

🧰 REQUIREMENTS 🧰

CONFIG_BPF, bcc. 🌸

πŸŽ›οΈ OPTIONS πŸŽ›οΈ

  • -h β€” the main character move here: prints the USAGE message πŸ“£
  • -v β€” include non-audit capability checks too πŸ‘€ these are the ones deemed not interesting and not necessary to audit, like CAP_SYS_ADMIN checks on memory allocation that affect overcommit behavior πŸ™ˆ
  • -K β€” adds kernel stack traces to the output 🧚
  • -U β€” adds user-space stack traces to the output πŸ¦‹
  • -x β€” shows extra fields in the TID and INSETID columns ✨
  • --cgroupmap MAPPATH β€” only traces cgroups in this BPF map (filtered in-kernel) πŸ’œ
  • --mntnsmap MAPPATH β€” only traces mount namespaces in this BPF map (filtered in-kernel) 🌈
  • --unique β€” don't repeat stacks for the same PID or cgroup πŸ’…

🌟 EXAMPLES 🌟

Trace all capability checks system-wide:

# capable

Trace capability checks for PID 181:

# capable -p 181

Trace capability checks in a set of cgroups only (see special_filtering.md from bcc sources for more details):

# capable --cgroupmap /sys/fs/bpf/test01

πŸ” FIELDS πŸ”

  • TIME(s) β€” time of the capability check, in HH:MM:SS format ⏰
  • UID β€” user ID 🫢
  • PID β€” process ID πŸ“
  • COMM β€” process name πŸŽ€
  • CAP β€” capability number πŸ”’
  • NAME β€” capability name. See capabilities(7) for descriptions πŸ“š
  • AUDIT β€” whether this was an audit event. Use -v to include non-audit events πŸ™ˆ
  • INSETID β€” whether the INSETID bit was set (Linux >= 5.1) πŸ¦„

⚠️ OVERHEAD ⚠️

This adds low-overhead instrumentation to capability checks. They're expected to be low frequency, but that really depends on the application, so bestie, test in a lab environment before use πŸ₯Ί

Heads up: the overhead depends on your application, so test in a lab environment before using this anywhere real πŸ’€

🌈 SOURCE 🌈

This is from bcc 🫢

https://github.com/iovisor/bcc

Also look in the bcc distribution for a companion _examples.txt file with example usage, output, and commentary for this tool πŸ“–βœ¨

🐧 OS 🐧

Linux 🐧

πŸ§ͺ STABILITY πŸ§ͺ

Unstable, still in development 🚧

πŸ‘©β€πŸ’» AUTHOR πŸ‘©β€πŸ’»

Brendan Gregg πŸ‘‘

πŸ”— SEE ALSO πŸ”—

capabilities(7) πŸ’–


Bye bestie, you're officially a capable(8) expert now πŸŽ€ This page came from the USER COMMANDS section, sourced from bcc and dated 2020-03-08 πŸ“…πŸ’œ