/engineering:linux-security-hardeningfrom engineering
Hardens and audits Debian/Ubuntu hosts covering identity, sudo, PAM, MFA, permissions, AppArmor, auditd, kernel sysctl, patching, file integrity, rootkit detection, boot security, encryption, and CIS benchmarks.
Ships in engineering. 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.
Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.
| Category | Artifact | Format | Example |
|---|---|---|---|
| Security | Server hardening checklist | Markdown doc covering user/sudo, file permissions, PAM/MFA, and auditd findings | docs/server/hardening-checklist.md |
references/ directory for deep detail after reading the core workflow below.Defensive hardening for Debian 12 / Ubuntu 24.04 servers running multi-tenant SaaS. Covers the OS layer — users, permissions, PAM, mandatory access control, kernel, integrity, patching, and compliance.
Core principle: A fresh Debian install is not production-ready. Every server that accepts traffic needs hardening. Do it once with automation, audit it forever.
Scope: Linux OS security on your own servers. For network-layer defence use network-security. For secrets/CI hardening use cicd-devsecops. For app-code vulnerabilities use web-app-security-audit.
Cross-references: network-security, cicd-devsecops, cicd-jenkins-debian, database-reliability, web-app-security-audit
See references/ for: users-groups-sudo.md, file-permissions-acls.md, pam-authentication.md, selinux-apparmor.md, auditd-logging.md, kernel-sysctl-hardening.md, file-integrity.md, rootkit-detection.md, patch-management.md, boot-security.md, cis-benchmark-checklist.md
Attack surface on a typical Debian server:
| Layer | Attack vector | Primary defence |
|---|---|---|
| Boot | Single-user mode, evil maid, kernel tampering | GRUB password, Secure Boot, LUKS |
| Kernel | Privilege escalation via syscall, unsigned module | sysctl, lockdown mode, MAC, module signing |
| Filesystem | Path traversal, setuid abuse, world-writable | perms, ACLs, mount options (nosuid,noexec) |
| Users | Brute force, privilege abuse, shared accounts | PAM, sudo least-priv, MFA, password policy |
| Services | Unpatched CVE, default creds, exposed port | unattended-upgrades, service minimization |
| Process | Arbitrary code execution in an app | AppArmor, systemd sandboxing, capabilities |
| Monitoring | Attacker erases logs | auditd off-host, FIM, log integrity |
Assume breach. Layer defences so a single failure does not equal game over.
| # | Domain | Reference |
|---|---|---|
| 1 | Users, groups, sudo | references/users-groups-sudo.md |
| 2 | File permissions + ACLs | references/file-permissions-acls.md |
| 3 | PAM authentication | references/pam-authentication.md |
| 4 | Mandatory Access Control (AppArmor) | references/selinux-apparmor.md |
| 5 | auditd + system logging | references/auditd-logging.md |
| 6 | Kernel sysctl hardening | references/kernel-sysctl-hardening.md |
| 7 | File integrity monitoring | references/file-integrity.md |
| 8 | Rootkit detection | references/rootkit-detection.md |
| 9 | Patch management | references/patch-management.md |
| 10 | Boot security (GRUB, UEFI, LUKS) | references/boot-security.md |
Compliance: references/cis-benchmark-checklist.md (~60 items aligned to CIS Debian 12 benchmark).
Run this against every fresh Debian 12 / Ubuntu 24.04 server before accepting production traffic.
apt update && apt full-upgrade -y
apt install -y \
ufw nftables fail2ban \
auditd audispd-plugins \
unattended-upgrades needrestart apt-listchanges \
libpam-pwquality libpam-google-authenticator \
rkhunter chkrootkit aide aide-common \
apparmor apparmor-utils apparmor-profiles \
lynis debsecan
Enable unattended security updates with auto-reboot at a quiet hour (see references/patch-management.md).
# Disable services
for svc in avahi-daemon cups rpcbind nfs-server bluetooth; do
systemctl disable --now "$svc" 2>/dev/null || true
done
# Blacklist rare filesystem / network modules
cat > /etc/modprobe.d/blacklist-hardening.conf <<EOF
install cramfs /bin/true
install freevxfs /bin/true
install jffs2 /bin/true
install hfs /bin/true
install hfsplus /bin/true
install udf /bin/true
install dccp /bin/true
install sctp /bin/true
install rds /bin/true
install tipc /bin/true
EOF
update-initramfs -u
passwd -l root # disable root password login
# Add each admin to sudo group; no shared accounts.
usermod -aG sudo deploy
# Edit sudoers to require pty and log IO
visudo # add: Defaults use_pty, log_input, log_output
Full detail: references/users-groups-sudo.md
chmod 640 /etc/shadow /etc/gshadow
chmod 644 /etc/passwd /etc/group
chmod 700 /root
# Find unexpected setuid binaries
find / -xdev -type f -perm -4000 2>/dev/null
# Find world-writable
find / -xdev -type f -perm -0002 2>/dev/null
Set umask 027 globally via /etc/login.defs. Mount /tmp, /var/tmp, /dev/shm with nodev,nosuid,noexec. Detail: references/file-permissions-acls.md.
Edit /etc/security/pwquality.conf:
minlen = 12
dcredit = -1
ucredit = -1
lcredit = -1
ocredit = -1
retry = 3
enforce_for_root
Enable faillock in /etc/pam.d/common-auth and /etc/security/faillock.conf (deny=5, unlock_time=900). Full stack: references/pam-authentication.md.
systemctl enable --now apparmor
aa-status # check active profiles
# Put any complain-mode profiles into enforce
for p in /etc/apparmor.d/*; do
aa-enforce "$p" 2>/dev/null
done
Custom profiles for your own apps: see references/selinux-apparmor.md.
systemctl enable --now auditd
# Load CIS-style rules (edit to /etc/audit/rules.d/audit.rules)
augenrules --load
auditctl -l # verify loaded
Reference ruleset covering identity changes, sudo, SSH config, kernel module loads, and mount operations: references/auditd-logging.md.
Write /etc/sysctl.d/99-hardening.conf with the baseline from references/kernel-sysctl-hardening.md, then:
sysctl --system
Key values:
kernel.randomize_va_space = 2
kernel.kptr_restrict = 2
kernel.dmesg_restrict = 1
kernel.yama.ptrace_scope = 2
kernel.unprivileged_bpf_disabled = 1
net.core.bpf_jit_harden = 2
fs.suid_dumpable = 0
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
aideinit # build baseline DB
mv /var/lib/aide/aide.db.new /var/lib/aide/aide.db
# Schedule daily checks via systemd timer
Ship output off-host. Detail: references/file-integrity.md.
rkhunter --propupd # build baseline
rkhunter --update # update signature DB
chkrootkit # initial clean scan
Schedule daily + alert on INFECTED. Detail: references/rootkit-detection.md.
dpkg-reconfigure -plow unattended-upgrades
systemctl status unattended-upgrades
Configure security-only updates + auto-reboot at 02:00. Detail: references/patch-management.md.
lynis audit system --profile /etc/lynis/default.prf
# Target: hardening index >= 80 at Level 1
| Control family | CIS | ISO/IEC 27001:2022 Annex A | PCI DSS v4.0.1 | Primary reference |
|---|---|---|---|---|
| Access control | 5.x | A.5.15-A.5.18, A.8.2, A.8.5 | 7, 8 | users-groups-sudo.md, pam-authentication.md |
| Cryptography | - | A.8.24 | 3, 4 | boot-security.md, network-security/tls-pki.md |
| Operations security | 4.x | A.8.8, A.8.9, A.8.19 | 6 | patch-management.md, file-integrity.md |
| Communications security | 3.x | A.8.20-A.8.22 | 1 | network-security/* |
| Logging / monitoring | 4.x | A.8.15, A.8.16 | 10 | auditd-logging.md, rootkit-detection.md |
| Secure development | - | A.8.25-A.8.29 | 6 | cicd-devsecops |
Full CIS Debian 12 checklist: references/cis-benchmark-checklist.md.
Weekly or quarterly, run this sequence on each production host:
lynis audit system — quick hardening scoredebsecan --only-fixed — list unpatched CVEsrkhunter --check --skip-keypress — rootkit scanaide --check — file integrity deltaaureport --summary — audit log summaryfail2ban-client status — see active jails and banslast -a | head -20 — recent loginssudo grep -i 'COMMAND' /var/log/auth.log | tail -50 — recent privileged commandssystemctl --failed — failed servicesapt list --upgradable — pending updatesLog findings and track remediation in a ticket.
Do not:
rwx) alone — add AppArmor for any internet-facing daemon.DynamicUser=true in systemd would suffice./etc/sudoers directly without visudo — syntax errors lock you out.NOPASSWD: ALL in sudoers — the whole point of sudo is the audit trail.complain mode forever — tune and enforce.umask 0022 in /etc/login.defs — use 027 so others can't read new files by default./boot — it often ends up 755 and world-readable.kernel.dmesg_restrict=0 — kernel messages leak addresses useful for exploitation.Domain references:
references/users-groups-sudo.md — account model, sudo hardening, password agingreferences/file-permissions-acls.md — DAC, setuid audit, ACLs, mount optionsreferences/pam-authentication.md — PAM stack, pwquality, faillock, MFAreferences/selinux-apparmor.md — MAC, AppArmor profiles, systemd sandboxingreferences/auditd-logging.md — rules, ausearch, off-host shippingreferences/kernel-sysctl-hardening.md — sysctls, modprobe blacklist, lockdownreferences/file-integrity.md — AIDE baseline, alerting, re-baseliningreferences/rootkit-detection.md — rkhunter, chkrootkit, incident runbookreferences/patch-management.md — unattended-upgrades, debsecan, CVE SLAsreferences/boot-security.md — GRUB password, Secure Boot, LUKS, TPMCompliance:
references/cis-benchmark-checklist.md — ~60-item CIS-aligned audit checklistRelated skills:
network-security — firewall, WAF, TLS, VPN, IDS (network layer)cicd-devsecops — secrets, dependency scanning, pipeline hardeningcicd-jenkins-debian — Debian server provisioning for CI/CDdatabase-reliability — DB-specific hardening, backup, failoverweb-app-security-audit — application-layer vulnerabilitiesFallback without privileged execution: produce a read-only findings report and exact commands for an authorised operator. Never claim a control was applied without post-change evidence.
| Change | Execution mode | Failure avoided |
|---|---|---|
| Read-only inventory or configuration review | inspect directly | Unnecessary host mutation |
| Reversible hardening with tested access path | stage and verify | Administrator lockout |
| Firewall, PAM, SSH, boot, or encryption change | require console/rollback plan | Loss of remote access or boot failure |
| Artefact | Required? | Purpose |
|---|---|---|
| Host role, distribution/version, exposed services, access method, and change window | yes | Select controls without locking out administrators or breaking the workload |
| Current configuration and approved baseline | conditional | Compare observed state with the intended CIS or organisation-specific profile |
Hardening must preserve emergency access and workload availability, produce before-and-after evidence, validate each affected service, and retain a tested rollback for lockout-sensitive changes.
| Artefact | Consumer | Acceptance condition |
|---|---|---|
| Hardening plan, applied-change record, and rollback evidence | System owner and operations team | Each change has pre-check, command or configuration evidence, service validation, lockout-safe rollback, and residual exception owner |
references/auditd-logging.md (opens in a new tab)references/boot-security.md (opens in a new tab)references/cis-benchmark-checklist.md (opens in a new tab)references/file-integrity.md (opens in a new tab)references/file-permissions-acls.md (opens in a new tab)references/kernel-sysctl-hardening.md (opens in a new tab)references/pam-authentication.md (opens in a new tab)references/patch-management.md (opens in a new tab)references/rootkit-detection.md (opens in a new tab)references/selinux-apparmor.md (opens in a new tab)references/users-groups-sudo.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub peterbamuhigire/chwezi-dev-engine --plugin engineering169 skills in this plugin
/accounting-engineUse when designing or implementing double-entry accounting policy and an embedded ledger engine for invoices, payments, stock, balanced postings, mapped accounts, idempotency, reversals, period locks, audit trails, and financial statements./accounting-finance-controllerUse when coordinating accounting and finance implementation reviews, doctrine routing, control evidence, remediation priorities, and release decisions across a software system./advanced-testing-strategyUse when designing or reviewing test strategy for production systems, APIs, mobile apps, SaaS platforms, ERP workflows, and AI-enabled systems. Covers unit, integration, contract, end-to-end, regression, release-gate, and risk-based testing decisions.Other plugins' skills for the same job