Blueprints · Server Hardening
Beginner
10 min · Linux
Unattended security updates
Stages unattended-upgrades so security updates install without a manual apt run. It does not enable the timer until you review the file.
Baked-in protections
- Only the security pocket is enabled
- Automatic reboots stay off
- The check does not install packages
Step 1 · conf
Apt periodic config
/root/portgate-blueprints/20auto-upgrades
Debian and Ubuntu. RHEL hosts should use dnf-automatic instead of this file.
APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "1"; APT::Periodic::AutocleanInterval "7"; Unattended-Upgrade::Automatic-Reboot "false";
Step 2 · bash
Read-only check
/root/portgate-blueprints/unattended-check.sh
Prints status. It does not change the service.
#!/bin/sh set -eu if dpkg -s unattended-upgrades >/dev/null 2>&1; then echo "unattended-upgrades is installed. Review the staged config before enabling it." else echo "unattended-upgrades is not installed. The config is staged only." fi