Skip to content

Commit

Permalink
feat: improve dbus integration for chsh, better handling of generic n…
Browse files Browse the repository at this point in the history
…eedrestart.
  • Loading branch information
roddhjav committed Dec 11, 2024
1 parent 3a407cb commit 4c56976
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/local/needrestart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

/var/lib/waagent/** r,
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
sudo apt-get install -y \
apparmor-profiles apparmor-utils \
bats bats-support
sudo install -Dm0644 .github/local/needrestart /etc/apparmor.d/local/needrestart
- name: Install apparmor.d
run: |
Expand Down
8 changes: 7 additions & 1 deletion apparmor.d/profiles-a-f/chsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@ include <tunables/global>
@{exec_path} = @{bin}/chsh
profile chsh @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/authentication>
include <abstractions/bus-system>
include <abstractions/consoles>
include <abstractions/nameservice-strict>
include <abstractions/wutmp>

capability audit_write,
capability chown,
capability fsetid,
capability net_admin,
capability setuid,

network netlink raw,

unix type=stream addr=@@{udbus}/bus/chsh/system,

#aa:dbus talk bus=system name=org.freedesktop.home1 label=systemd-homed

@{exec_path} mr,

/etc/shells r,
Expand Down
3 changes: 1 addition & 2 deletions apparmor.d/profiles-m-r/needrestart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ profile needrestart @{exec_path} flags=(attach_disconnected) {

@{exec_path} mrix,

@{bin}/* r,
@{sh_path} rix,
@{bin}/dpkg-query rpx,
@{bin}/fail2ban-server rPx,
Expand All @@ -42,8 +43,6 @@ profile needrestart @{exec_path} flags=(attach_disconnected) {
@{lib}/needrestart/* rPx,
/usr/share/debconf/frontend rix,

@{bin}/networkd-dispatcher r,
@{bin}/gettext.sh r,
/usr/share/needrestart/{,**} r,
/usr/share/unattended-upgrades/unattended-upgrade-shutdown r,

Expand Down
1 change: 1 addition & 0 deletions apparmor.d/profiles-s-z/snapd
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ profile snapd @{exec_path} {
@{lib_dirs}/snapd/snap-update-ns rPx,

/usr/share/bash-completion/{,**} r,
/usr/share/dbus-1/{system,session}.d.d/snapd.{system,session}-services.conf* rw,
/usr/share/dbus-1/{system,session}.d/{,snapd*} r,
/usr/share/dbus-1/services/*snap* r,
/usr/share/polkit-1/actions/{,**/} r,
Expand Down

0 comments on commit 4c56976

Please sign in to comment.