From 582f351216738f5f50d45ca1a27e45618811c69d Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Tue, 7 Oct 2025 00:07:42 +0200 Subject: [PATCH] feat: Add unattended-upgrades system profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new system profile to enable automatic security updates on Ubuntu containers using unattended-upgrades. Features: - Automatic installation of unattended-upgrades and apt-listchanges - Daily security updates for Ubuntu packages - Weekly cleanup of unused packages - Configurable automatic reboot (disabled by default) - ESM (Extended Security Maintenance) updates support Configuration: - Updates check: Daily - Security updates: Automatic - Autoclean interval: 7 days - Automatic reboot: Disabled (can be enabled by setting to "true") - Reboot time: 02:00 (if enabled) - Remove unused dependencies: Enabled Usage: Apply this profile to any Ubuntu container to enable automatic security updates: lxc profile assign mycontainer default,unattended-upgrades Closes #5 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../system/unattended-upgrades.profile.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 profiles/system/unattended-upgrades.profile.yaml diff --git a/profiles/system/unattended-upgrades.profile.yaml b/profiles/system/unattended-upgrades.profile.yaml new file mode 100644 index 0000000..1ec5166 --- /dev/null +++ b/profiles/system/unattended-upgrades.profile.yaml @@ -0,0 +1,32 @@ +name: unattended-upgrades +description: "Profil pour activer les unattended upgrades sur Ubuntu" +devices: {} +config: + cloud-init.vendor-data: | + #cloud-config + package_update: true + package_upgrade: true + packages: + - unattended-upgrades + - apt-listchanges + + write_files: + - path: /etc/apt/apt.conf.d/20auto-upgrades + content: | + APT::Periodic::Update-Package-Lists "1"; + APT::Periodic::Unattended-Upgrade "1"; + APT::Periodic::AutocleanInterval "7"; + + - path: /etc/apt/apt.conf.d/50unattended-upgrades + content: | + Unattended-Upgrade::Allowed-Origins { + "${distro_id}:${distro_codename}"; + "${distro_id}:${distro_codename}-security"; + "${distro_id}ESM:${distro_codename}"; + }; + Unattended-Upgrade::Automatic-Reboot "false"; + Unattended-Upgrade::Automatic-Reboot-Time "02:00"; + Unattended-Upgrade::Remove-Unused-Dependencies "true"; + + runcmd: + - [ systemctl, enable, --now, unattended-upgrades ]