Security updates are not installed automatically
- Check
updates.auto_security- Severity
- medium
- Runs
- on the server, in the daily run of the agent
- Looks at
- unattended-upgrades, dnf-automatic or an apk cron job is not active
What the check looks at
The agent looks for an active automatic update setup:
- Debian and Ubuntu: unattended-upgrades installed, with
APT::Periodic::Unattended-Upgrade "1"and theapt-daily-upgrade.timerenabled. - RHEL, Rocky Linux, AlmaLinux and Amazon Linux: a
dnf-automatictimer enabled, and fordnf-automatic.timerthe settingapply_updates = yes. - Alpine: a job in
/etc/periodic/or a crontab entry that runsapk upgrade, with crond running.
Why it matters
Many vulnerabilities on a server have a fix that the distribution has already published as a package update. Without automatic updates, the fix waits until someone logs in and runs the upgrade, which on a quiet server can take weeks. Debian, Ubuntu and the RHEL family keep security updates within a stable release small: they apply the fix to the version you have instead of moving to a new upstream release. That makes a daily automatic install the safer default.
How to fix it
Debian and Ubuntu
sudo apt install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
apt-config dump APT::Periodic::Unattended-Upgrade
The last command must print APT::Periodic::Unattended-Upgrade "1";. On Debian 12, Debian 13 and Ubuntu 24.04,
installing the package already turns it on.
RHEL, Rocky Linux and AlmaLinux
sudo dnf install dnf-automatic
sudo sed -i 's/^upgrade_type.*/upgrade_type = security/; s/^apply_updates.*/apply_updates = yes/' /etc/dnf/automatic.conf
sudo systemctl enable --now dnf-automatic.timer
The shipped automatic.conf downloads updates but does not install them, so apply_updates = yes is the
line that matters.
Alpine
cat > /etc/periodic/daily/apk-upgrade <<'EOF'
#!/bin/sh
apk update --quiet && apk upgrade --quiet 2>&1 | logger -t apk-upgrade
EOF
chmod 755 /etc/periodic/daily/apk-upgrade
rc-update add crond default
rc-service crond start
The crontab of root runs /etc/periodic/daily at 02:00.
How to check the fix
systemctl list-timers 'apt-daily*' 'dnf-automatic*'
Then look at the logs after the next run: /var/log/unattended-upgrades/unattended-upgrades.log on Debian and
Ubuntu, journalctl -u dnf-automatic.service on the RHEL family, grep apk-upgrade /var/log/messages on
Alpine.
When a warning is fine
When updates go out through another tool that runs on a schedule, such as Ansible, Salt or a patch management service, or when servers are replaced by new images built every day. Make sure the schedule runs: the check updates.pending shows whether updates pile up.
Sources
- Debian wiki: UnattendedUpgrades
- Ubuntu Server: automatic updates — installed and on by default
- DNF Automatic — timers and
apply_updates - Alpine user handbook: apk