/linux:linux-server-hardeningfrom linux
Remediates verified Linux security findings interactively: SSH, firewall, AppArmor/SELinux, services, permissions, and updates across Debian and RHEL families.
Ships in linux. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Two-family skill. SSH and kernel/sysctl hardening are largely identical; the
big difference is mandatory access control — Debian/Ubuntu use AppArmor,
the RHEL family (Fedora, RHEL, CentOS Stream, Rocky, Alma, Oracle) enforces
SELinux by default. Full SELinux detail is in
references/selinux-reference.md.
| Concept | Debian/Ubuntu | RHEL family |
|---|---|---|
| Mandatory access control | AppArmor (aa-status, /etc/apparmor.d/) | SELinux (getenforce, sestatus) — enforcing by default |
| Firewall | ufw | firewalld |
| Auto security updates | unattended-upgrades | dnf-automatic |
| Sudo admin group | sudo | wheel |
| SSH hardening | /etc/ssh/sshd_config[.d] | identical files and keywords |
| SSH service unit | ssh (sshd is an alias, verified on Debian 12) | sshd; ssh does not exist |
| sysctl hardening | /etc/sysctl.d/ | identical |
| Audit daemon | auditd | auditd (same) |
Golden rule on RHEL: never setenforce 0 to "fix" a problem — diagnose the
denial and set the right context/boolean/port. See
references/selinux-reference.md and
docs/multi-distro/plan.md. In sk-* scripts
use the common.sh primitives (pkg_install, firewall_allow, svc_name).
linux-security-analysis.| Artefact | Source | Required? | If absent |
|---|---|---|---|
| Verified finding and evidence | linux-security-analysis or specialist assessment | yes | Inspect and propose; do not mutate |
| Host role, distro, dependencies, uptime | Inventory and service owner | yes | Stop before changing service behaviour |
| Per-change authority and rollback window | Change owner | for mutation | Return a sequenced hardening plan |
| Recovery access | Console or independent privileged session | for access controls | Do not change SSH, firewall, PAM, or MAC policy |
Read/search confirmation precedes every change. Root-level edits, installs, service reloads, firewall changes, and enforcement changes require explicit authority. Preserve an independent recovery path and never broaden scope from one approved finding to an entire baseline.
Without audit evidence, root, recovery access, a maintenance window, or validation tooling, produce the narrowest qualified plan and exact commands for an operator. Leave the finding open; do not claim hardening is complete.
| Condition | Action | Failure avoided |
|---|---|---|
| Change can break remote access | Test syntax and preserve a second session/console | Lockout |
| SELinux/AppArmor denial is unexplained | Diagnose labels/profile before policy exception | Disabling mandatory access control |
| Several high-risk changes are requested | Apply and validate one control at a time | Untraceable outage |
| Verification contradicts expected result | Roll back and stop the cohort | Compounding a failed change |
| Artefact | Acceptance |
|---|---|
| Hardening evidence pack | Includes finding, approval, backup/diff, syntax checks, commands, service/access validation, rollback if used, and repeated audit check |
sshd -t.| Artefact | Consumer | Acceptance condition |
|---|---|---|
| Hardening change record | Change owner | Links finding, approval, exact diff, and rollback |
| Validation evidence | Service owner | Proves access, syntax, service, and original check |
| Residual-risk register | Risk owner | Names deferred or failed controls and next action |
For password SSH still enabled on Ubuntu, first verify key login in a second session, back up sshd_config, change only PasswordAuthentication, run sshd -t, reload SSH, and prove a new key session works before closing the old one. Restore the backup if validation fails.
For an NGO or civil-society programme that must join host controls to mission,
identity, staff, incident, and recovery risk, load
../linux-ngo-cyber-resilience/SKILL.md.
references/hardening-checklist.md../../docs/security/current-vulnerability-triage.md — verify applicability, vendor fix status, deployment, recovery and closure for security updates before changing a host.references/sysctl-reference.mdreferences/selinux-reference.md../../01-provisioning-and-bootstrap/linux-package-management/SKILL.md — package hygiene, Flatpak/snap, and workstation AppImage runtime support.This skill is self-contained. Every hardening step below uses standard
tools on both Debian/Ubuntu and the RHEL family (Fedora, RHEL, CentOS Stream,
Rocky, Alma, Oracle); see the Distro support table above for the
family-specific equivalents. The sk-* scripts in the Optional fast path
section are convenience wrappers — never required.
Applies security fixes interactively. Runs the audit first — never applies a change without your confirmation.
For a full picture first: run linux-security-analysis before hardening.
Desktop/workstation exception: AppImage runtime packages such as fuse3,
desktop-file-utils, and app-specific media libraries (mpv-libs on Fedora)
belong to workstation package setup, not production server hardening. Keep them
off headless servers unless a real desktop app requirement exists; use
linux-package-management when such a requirement is present.
# Install once with: sudo install-skills-bin linux-security-analysis
sudo sk-audit
Fix FAIL items first, then WARN. Use references/hardening-checklist.md
for the complete commands for each area.
/etc/ssh/sshd_config.d/00-linux-skills-ssh.conf — the 00- prefix is deliberate: sshd keeps the first value it reads, so a later-sorting file loses to 50-cloud-init.conf and distro drop-ins. Confirm with sudo sshd -T.references/hardening-checklist.md; validate with sshd -t and keep the
existing SSH session open until a second login succeeds.sudo ufw status verbose to check current statelinux-firewall-ssl and its native UFW/firewalld procedures./etc/sysctl.d/99-linux-skills.confreferences/hardening-checklist.md.server_tokens off in nginx.confexpose_php = Off, display_errors = Off, allow_url_include = Offdisable_functions for dangerous functionsphp.ini (Debian /etc/php/<version>/fpm/php.ini, RHEL family /etc/php.ini); discover the version first, as references/hardening-checklist.md does with $PHP_VERreferences/hardening-checklist.md.bind-address = 127.0.0.1 (never expose to network)mysql_secure_installation/etc/shadow → 640, credential files → 600/var/wwwunattended-upgrades installed and enabledsudo sk-audit
# All previous FAIL items should now be PASS
Full configs and commands for each area: references/hardening-checklist.md
Reference guide: ~/.claude/skills/notes/server-security.md
Running sudo install-skills-bin linux-server-hardening installs:
| Task | Fast-path script |
|---|---|
| Triage SELinux denials, build reviewed policy module (RHEL family) | sudo sk-selinux-denials |
These wrap the manual steps in references/hardening-checklist.md.
This skill installs the following scripts to /usr/local/bin/. To install:
sudo install-skills-bin linux-server-hardening
| Script | Source | Core? | Purpose |
|---|---|---|---|
| sk-selinux-denials | scripts/sk-selinux-denials.sh | no | RHEL family only. Summarize recent AVC denials (ausearch/aureport --avc), explain with audit2why, then — only after you confirm — build a reviewed local policy module (audit2allow -M + semodule -i). Never disables SELinux. See references/selinux-reference.md. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
linux-hardening, ssh-hardening, selinux, apparmor, firewall, security-remediation
45 skills in this plugin
/cisco-ios-patternsUse when reading or reviewing Cisco IOS/IOS-XE configuration, selecting read-only show commands, or planning and verifying bounded router or switch configuration work. Not for Linux host networking, bulk SSH automation, or config preflight parsing; route those to linux-network-admin, netmiko-ssh-automation, or network-config-validation./linux-access-controlUse when creating, revoking, or auditing Linux users, groups, SSH keys, sudo/wheel access, PAM settings, SELinux user mappings, or file permissions. Use linux-secrets for credential material and linux-server-hardening for broader host policy./linux-archive-integrityUse when creating, signing, encrypting, listing, comparing, or restoring metadata-preserving tar archives on Debian/Ubuntu or RHEL-family hosts. Covers ACLs, xattrs, incrementals, and verification; use linux-rsync-sync for file-tree mirrors./linux-auditd-rulesUse when inspecting, designing, testing, persisting, or querying auditd rules for forensic attribution on Debian/Ubuntu or RHEL-family hosts. Covers watches, syscalls, loss, and immutable mode; use linux-file-integrity for drift and linux-benchmark-scanning for scoring./linux-bash-scriptingUse when writing or reviewing portable sk-* Bash scripts for this engine, including common.sh primitives, flags, preview mode, and safety gates; use linux-repo-sync for Git-update behaviour and not for one-off commands./linux-benchmark-scanningUse when running read-only OpenSCAP or Lynis scans, selecting distro-matched profiles, interpreting failures, or drafting remediation on Debian/Ubuntu or RHEL-family hosts. Use linux-auditd-rules for attribution and linux-file-integrity for AIDE drift.npx claudepluginhub peterbamuhigire/linux-skills --plugin linuxOther plugins' skills for the same job