diff --git a/apparmor.d/groups/apt/needrestart b/apparmor.d/groups/apt/needrestart new file mode 100644 index 00000000..c7de4c65 --- /dev/null +++ b/apparmor.d/groups/apt/needrestart @@ -0,0 +1,37 @@ +# apparmor.d - Full set of apparmor profiles +# Copyright (C) 2022 Alexandre Pujol +# SPDX-License-Identifier: GPL-2.0-only + +abi , + +include + +@{exec_path} = /{usr/,}{s,}bin/needrestart +profile needrestart @{exec_path} { + include + include + include + include + + capability sys_ptrace, + + ptrace (read), + + @{exec_path} mr, + + /{usr/,}bin/systemd-detect-virt rPx, + /{usr/,}bin/who rix, + /usr/share/debconf/frontend rix, + + /etc/needrestart/{,**} r, + + @{PROC}/ r, + @{PROC}/@{pids}/cmdline r, + @{PROC}/@{pids}/environ r, + @{PROC}/@{pids}/stat r, + + /dev/ r, + /dev/**/ r, + + include if exists +} \ No newline at end of file diff --git a/apparmor.d/groups/apt/needrestart-apt-pinvoke b/apparmor.d/groups/apt/needrestart-apt-pinvoke new file mode 100644 index 00000000..8072c799 --- /dev/null +++ b/apparmor.d/groups/apt/needrestart-apt-pinvoke @@ -0,0 +1,24 @@ +# apparmor.d - Full set of apparmor profiles +# Copyright (C) 2022 Alexandre Pujol +# SPDX-License-Identifier: GPL-2.0-only + +abi , + +include + +@{exec_path} = /{usr/,}lib/needrestart/apt-pinvoke +profile needrestart-apt-pinvoke @{exec_path} { + include + include + + @{exec_path} mr, + + /{usr/,}{s,}bin/needrestart rPx, + /{usr/,}bin/{,ba,da}sh rix, + /{usr/,}bin/dbus-send rix, + /{usr/,}bin/rm rix, + + @{run}/needrestart/{,**} rw, + + include if exists +} \ No newline at end of file