heyer.systems Open Source

Automatic security updates

Installs Debian security updates automatically every day (without a reboot)

unattended-upgrades LXCVM preselected for new guests

Add to a guest

In the guest as root – container and VM alike:

update --add-modules unattended-upgrades

Runs a normal update and installs the module on the way.

From the Proxmox node, without logging in:

pct exec <ID> -- update --add-modules unattended-upgrades   # container
ssh root@<IP> update --add-modules unattended-upgrades

Choose when creating a guest

Without a dialog, on the Proxmox node:

IAC_NONINTERACTIVE=1 var_modules=auto-update,unattended-upgrades \
  bash -c "$(curl -fsSL https://iac.heyer.systems/<app>/ct.sh)"

var_modules replaces the app's preselection – keep auto-update in the list if you want it. Interactive: choose “advanced” in the dialog, or tick the module in the generator on the app page.

Remove

update --remove-modules unattended-upgrades

Removes the module's packages, services, firewall rules and configuration again. Data stays.

Details

Installs Debian’s security updates every day with unattended-upgrades, without a reboot. Services of the updated packages are restarted by the packages themselves, as with a manual apt upgrade. Other updates, the app, the modules and iac itself still need the full update – by hand or with the module auto-update.

unattended-upgrade --dry-run --debug          # what it would install now
less /var/log/unattended-upgrades/unattended-upgrades.log
systemctl list-timers apt-daily-upgrade.timer # next run

What gets installed is Debian’s default in /etc/apt/apt.conf.d/50unattended-upgrades. Own settings go into /etc/apt/apt.conf.d/52unattended-upgrades-local – e.g. a mail after every run with the module mail-relay:

Unattended-Upgrade::Mail "root";

When the module is removed, the package and its daily run go again.