diff --git a/apparmor.d/groups/apt/unattended-upgrade b/apparmor.d/groups/apt/unattended-upgrade new file mode 100644 index 00000000..0e7b5426 --- /dev/null +++ b/apparmor.d/groups/apt/unattended-upgrade @@ -0,0 +1,29 @@ +# apparmor.d - Full set of apparmor profiles +# Copyright (C) 2021 Alexandre Pujol +# SPDX-License-Identifier: GPL-2.0-only + +abi , + +include + +@{exec_path} = /{usr/,}bin/unattended-upgrade +profile unattended-upgrade @{exec_path} { + include + include + + @{exec_path} mr, + + /{usr/,}bin/python3.[0-9]* rix, + /{usr/,}bin/uname rix, + /{usr/,}bin/dpkg rPx, + /{usr/,}bin/lsb_release rPx -> lsb_release, + + /var/log/unattended-upgrades/*.log rw, + + owner @{run}/unattended-upgrades.pid rw, + owner @{run}/unattended-upgrades.lock rwk, + + owner @{PROC}/@{pids}/fd/ r, + + include if exists +} \ No newline at end of file diff --git a/apparmor.d/groups/apt/unattended-upgrade-shutdown b/apparmor.d/groups/apt/unattended-upgrade-shutdown new file mode 100644 index 00000000..839278fb --- /dev/null +++ b/apparmor.d/groups/apt/unattended-upgrade-shutdown @@ -0,0 +1,26 @@ +# apparmor.d - Full set of apparmor profiles +# Copyright (C) 2021 Alexandre Pujol +# SPDX-License-Identifier: GPL-2.0-only + +abi , + +include + +@{exec_path} = /usr/share/unattended-upgrades/unattended-upgrade-shutdown +profile unattended-upgrade-shutdown @{exec_path} flags=(attach_disconnected) { + include + include + include + + @{exec_path} mr, + + /usr/share/unattended-upgrades/{,*} r, + /etc/apt/apt.conf.d/{,*} r, + + owner /var/log/unattended-upgrades/*.log rw, + + owner @{run}/unattended-upgrades.lock rwk, + owner @{run}/systemd/inhibit/[0-9]*.ref rw, + + include if exists +} \ No newline at end of file