Sub topic 6
Package management, repositories, and updates
Assume you are comfortable with the Linux command line, sudo, systemd, users and groups, and basic networking. The examples use DNF on RHEL 9. Debian-based systems use APT, but the same principles apply.
How package updates support CIS compliance
A package manager installs software, resolves dependencies, verifies signatures, and records transactions. A repository is a trusted source of package metadata and files. The package manager uses repository metadata to decide which versions are available.
CIS recommendations usually expect these conditions:
- The system receives supported vendor security updates.
- Package signatures and repository metadata are verified.
- Unapproved or obsolete repositories are disabled.
- Security updates are installed within the organization’s required time.
- Update transactions are tested, recorded, and followed by a reboot when required.
The update path looks like this:
Inspect repositories before updating
List enabled repositories and inspect available security advisories. Do not add a repository merely because it contains a newer version. An external repository can replace vendor packages, introduce dependency conflicts, or make later support difficult.
# Show enabled repositories and available security advisories
sudo dnf repolist --enabled
sudo dnf updateinfo list --security
# Refresh metadata, install updates, and record the transaction
sudo dnf upgrade --refresh -y
sudo dnf history info last
# Check whether the installed kernel is the newest available kernel
rpm -q --last kernel | headdnf history info last gives you a transaction record that helps with auditing and rollback analysis. Keep repository definitions in configuration management so another administrator can reproduce the server’s package sources.
Choose an update policy
A security-only update can reduce change during an emergency, but it may leave non-security bugs or dependency fixes unresolved. A regular full update is usually easier to support. Test updates in a staging environment, define maintenance windows, and monitor applications after production changes.
For a security-focused transaction, use:
sudo dnf upgrade --security --refreshDo not permanently exclude the kernel or core libraries without a documented exception. A kernel update normally requires a reboot before its protections and fixes become active. Coordinate the reboot with service owners and verify the system afterward.
Common errors include mixing repositories for different operating-system releases, disabling signature checks, copying package files from untrusted sites, and treating a failed update as harmless. If a package is held back, identify the dependency or repository conflict before forcing installation.
Exercise
Why can a server still run a vulnerable kernel after a successful kernel package update?
Show answer
The new kernel may be installed but not running. The server must boot into it, so schedule a reboot and verify the running kernel afterward.