Files
ShellBook/templates/workspace/notebooks/base-hardening-checks.md
T
Florian Schmidt 91ac1df8a5 feat(templates): add starter runbook workspace (#5)
Document the notebook format and provide SSH-key, hardening-check, and package-install examples with inventory and credential exclusions.
2026-11-16 00:04:45 +01:00

44 lines
1.5 KiB
Markdown

---
title: Base hardening checks
params:
host: { type: host, required: true, label: Target server }
---
# Base hardening checks
Read-only baseline for Debian servers. These checks report state; they do not
change configuration. A failed check needs investigation, not an automatic fix.
SSH configuration checks need passwordless sudo to read all included files.
```sh {check host="{{host}}" id=os title="Identify operating system" capture=os_id}
. /etc/os-release
printf '%s\n' "$ID"
```
```sh {check host="{{host}}" id=no-root-password title="Root password login disabled" sudo}
sshd -T | grep -Eq '^permitrootlogin (no|prohibit-password|without-password)$'
```
```sh {check host="{{host}}" id=no-password-auth title="SSH password authentication disabled" sudo}
sshd -T | grep -qx 'passwordauthentication no'
```
```sh {check host="{{host}}" id=no-interactive-auth title="SSH keyboard-interactive authentication disabled" sudo}
sshd -T | grep -qx 'kbdinteractiveauthentication no'
```
```sh {check host="{{host}}" id=firewall title="Firewall rules present" sudo timeout=10}
nft list ruleset | grep -q 'hook input'
```
This confirms an input hook exists, not that the complete firewall policy is safe.
```sh {check host="{{host}}" id=security-updates title="Automatic security updates active"}
systemctl is-enabled unattended-upgrades.service
systemctl is-active unattended-upgrades.service
```
```sh {check host="{{host}}" id=no-failed-units title="No failed systemd units"}
test "$(systemctl --failed --no-legend --plain | wc -l)" -eq 0
```