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
Whether automatic updates are set up and switched on:
| Distribution | The check passes with |
|---|---|
| Debian, Ubuntu | unattended-upgrades installed, APT::Periodic::Unattended-Upgrade "1", apt-daily-upgrade.timer enabled |
| RHEL, Rocky Linux, AlmaLinux, Amazon Linux | dnf-automatic-install.timer enabled, or dnf-automatic.timer with apply_updates = yes; on releases with yum, yum-cron with apply_updates = yes |
| Alpine | a job in /etc/periodic/ or a line in the root crontab that runs apk upgrade, and crond running |
Risk
A published fix waits until someone logs in and runs the upgrade, which on a quiet server can take weeks. Debian, Ubuntu and the RHEL family apply security fixes to the version that the stable release ships, so the updates are small and a daily automatic install is 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 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 and does not install them; apply_updates = yes changes that.
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 root crontab runs /etc/periodic/daily at 02:00.
How to check the fix
systemctl list-timers 'apt-daily*' 'dnf-automatic*'
After the next run, read the log: /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 another tool installs updates on a schedule (Ansible, Salt, a patch management service), or when freshly built images replace the servers every day. The check updates.pending shows whether updates pile up all the same.
Sources
- Debian wiki: UnattendedUpgrades
- Ubuntu Server: automatic updates (installed and on by default)
- DNF Automatic (the timers and
apply_updates) - Alpine user handbook: apk