linux-security-audit
A Claude Code plugin that audits how hardened a Linux system is and produces a
risk-ranked report: what to fix, in what order, with the exact change and its blast radius.
It is an auditing tool, not a hardening script. It changes nothing by default.
Requires Linux. The collector refuses to run on any other kernel rather than emit a report
full of controls that only look absent because /proc, /sys and the GNU userland are missing.
Run it on the host, over SSH, or against a mounted Linux filesystem with --root.
Install
/plugin marketplace add jonaslejon/linux-security-audit-plugin
/plugin install linux-security-audit
Then ask Claude to audit a host, or point it at an image.
What it looks at
461 distinct checks across 33 areas. The number a given host emits is a subset: sections
for subsystems it does not run collapse to a single NA, and a host with Docker, a web server,
TLS listeners and eBPF programs loaded emits far more than a minimal one. Coverage includes:
- Kernel: sysctls, boot parameters, module blacklists, lockdown, CPU mitigations
- Filesystem: mount options (
nosuid/noexec/nodev), SUID/SGID, capabilities, world-writable paths
- Access control: SELinux/AppArmor confinement (not just "enforcing"), sudoers, PAM, password and lockout policy
- Privilege escalation:
sudo GTFOBins-capable grants and env_keep, writable systemd units, writable PATH, NFS no_root_squash, exposed credentials
- Boot and service-start trust chain: everything root reads on the way up:
EnvironmentFile, ld.so search paths, udev RUN, plus what root processes currently hold open
- Network: firewall policy per direction including egress, listener/rule reconciliation, bind-address discipline, exposed services
- TLS: cipher and protocol validation by active probe, and whether mutual TLS is enforced rather than merely requested
- eBPF: loaded programs by type, unattributed and pinned objects, XDP and tc attachments, BPF LSM programs, and
CAP_BPF holders. modules_disabled=1 does not constrain eBPF, so an in-kernel implant needs no module
- Services: SSH (public-key-only enforcement, forwarding channels,
Match block overrides), web servers, databases, and insecure-by-default daemons
- Secrets: cleartext credentials and private keys on disk, reported with values redacted
- Containers and Docker: daemon hardening (
userns-remap, icc, default no-new-privileges), running-container posture (privileged, mounted docker.sock, missing memory/PID limits, writable rootfs), and credentials baked into image layers
- Images and templates: SSH host keys or entropy seeds baked into a golden image
- Physical and peripheral: USB device policy (USBGuard,
authorized_default, deny_new_usb), Thunderbolt/DMA exposure and IOMMU. Scored against whether the machine is bare metal, so a cloud instance with no USB bus is not failed for a port it does not have. An allow-list is what passes here; a driver blacklist is depth, not the control
- Drift: where persisted config and running kernel disagree, and in which direction
Three collection modes
| Mode | How | What is valid |
|---|
| Live host | run it directly | everything |
| Mounted image | --root /mnt | configuration only; runtime checks report NA |
| Container | run inside it | container-level checks; host-owned ones report NA |
In a container, controls that belong to the host or the orchestrator report NA with the reason
rather than as findings against the image: mount layout, firewall, time, file-integrity monitoring
and the interactive-login family. The collector also distinguishes a workload container (PID 1
is the application, so runtime posture is a real finding) from an inspection container (PID 1
is a shell, so the collector is reading an image and the seccomp profile, rootfs mode and
namespaced sysctls belong to your docker run, not to the image). container.context reports
which. Auditing a stock image this way yields single-digit findings instead of ~55.
Use --root for an offline tree, never chroot. Inside a chroot the collector cannot tell it
is offline: systemctl, sudo -l and /proc reads return "absent" rather than failing, and a
check that turns a failed read into a FAIL has manufactured a finding. --root makes the
context explicit, so those checks report NA instead.
Every run ends with a RUN_SUMMARY section giving the collector version and hash, elapsed time,
the slowest sections, the verdict spread and the real static/runtime/active split. Quote
those figures in a report rather than any number written down here.
Running it
The plugin drives this for you, but the collector is a standalone script with no dependencies
beyond a POSIX shell and the tools it audits: