---
title: "Host security auditing"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ermahgerd.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Host security auditing

Use the profile-aware audit before and after a host maintenance window:

```sh
make security-audit PROFILE=single
make security-audit PROFILE=latitude
```

Apply available Ubuntu updates and prove the result with one managed workflow:

```sh
make security-maintain PROFILE=single
make security-maintain PROFILE=latitude
```

Maintenance captures a baseline with the current Trivy vulnerability database,
records installed package versions, verifies any declared separate `/boot`
filesystem is mounted, and applies the distribution upgrade. Before rebooting,
it requires the newest installed kernel and initramfs to exist on the active
boot filesystem. After the host returns, the running kernel must match that
newest release before Ansible removes superseded kernels, purges residual
package configuration, and requires every enabled Ermahgerd unit and every
workerd-backed service to be ready. The second scan reuses the baseline
vulnerability database so the reported change reflects the activated and
cleaned package state rather than advisory-feed movement.

Paired scan reports and package manifests are retained under
`artifacts/security-audit/`. The final summary reports deduplicated resolved,
remaining, and new CVE identifiers along with package changes. It reports the
active kernel separately and refuses success if package state and the running
kernel disagree. The workflow retains the previous kernel until the new one has
booted successfully, then removes the superseded package instead of leaving
inactive scanner findings and disk use behind. A successful maintenance run
establishes service recovery for that run; it does not make the single-node
profile highly available during its reboot window.

The audit runs through the same Ansible inventory as the profile, converges the
pinned Trivy scanner, and reports
the Ubuntu release, architecture, active kernel, pending reboot state, pending
APT upgrades, UFW state, unattended-upgrades, auditd, fail2ban, and the network
sysctl values managed by the hardening role. A pending reboot is a failing
result by default because the running kernel and libraries do not yet match
the installed packages.

This is a posture check, not a claim that the host has no vulnerabilities.
APT can show that package metadata is current and that upgrades are available,
but it cannot by itself map every installed package to every current CVE.
Canonical publishes Ubuntu OVAL data for that purpose. Every audit also runs a
pinned Trivy rootfs OS-package scan using Trivy's current vulnerability
database. Missing Trivy or a scanner failure makes the audit fail.

The scanner exit code and unique finding counts are included in the Ansible
summary. The compressed raw JSON is retained under `artifacts/security-audit/`
for review. Keep its result separate
from the Ubuntu OVAL result: it is useful additional coverage, not a
replacement for Canonical's release-specific security metadata. Neither feed
can establish that an as-yet undisclosed or untriaged issue does not exist.

Source: https://docs.ermahgerd.io/operations/security-auditing/index.mdx
