feat(profiles): general update.

This commit is contained in:
Alexandre Pujol 2022-08-21 20:16:29 +01:00
parent e6e0ef9067
commit 9d4956df0d
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
23 changed files with 147 additions and 104 deletions

View file

@ -8,7 +8,7 @@ abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/networkctl
profile networkctl @{exec_path} flags=(complain) {
profile networkctl @{exec_path} flags=(attach_disconnected,complain) {
include <abstractions/base>
include <abstractions/dbus-strict>
@ -39,9 +39,6 @@ profile networkctl @{exec_path} flags=(complain) {
/var/lib/dbus/machine-id r,
/etc/machine-id r,
@{run}/systemd/netif/links/[0-9]* r,
@{run}/systemd/netif/state r,
# To be able to read logs
@{run}/log/ r,
/{run,var}/log/journal/ r,
@ -50,12 +47,16 @@ profile networkctl @{exec_path} flags=(complain) {
/{run,var}/log/journal/[0-9a-f]*/system.journal* r,
/{run,var}/log/journal/[0-9a-f]*/system@[0-9a-f]*.journal* r,
@{run}/systemd/netif/links/[0-9]* r,
@{run}/systemd/netif/state r,
@{run}/systemd/notify w,
@{sys}/devices/**/net/**/uevent r,
owner @{PROC}/@{pid}/cgroup r,
owner @{PROC}/@{pid}/stat r,
@{PROC}/filesystems r,
@{PROC}/sys/kernel/random/boot_id r,
owner @{PROC}/@{pid}/cgroup r,
owner @{PROC}/@{pid}/stat r,
include if exists <local/networkctl>
}

View file

@ -17,11 +17,17 @@ profile systemd-hostnamed @{exec_path} flags=(attach_disconnected) {
dbus send bus=system path=/org/freedesktop/DBus
interface=org.freedesktop.DBus
member={RequestName,ReleaseName},
member={RequestName,ReleaseName,GetConnectionUnixUser}
peer=(name=org.freedesktop.DBus),
dbus send bus=system path=/org/freedesktop/PolicyKit1/Authority
interface=org.freedesktop.PolicyKit1.Authority
member=CheckAuthorization
peer=(name=org.freedesktop.PolicyKit1),
dbus receive bus=system path=/org/freedesktop/hostname[0-9]
interface=org.freedesktop.DBus.Properties
member={Get,GetAll},
member={Get,GetAll,SetHostname},
dbus bind bus=system
name=org.freedesktop.hostname[0-9],

View file

@ -1,5 +1,6 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2020-2021 Mikhail Morfikov
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
@ -7,40 +8,68 @@ abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}lib/systemd/systemd-networkd
profile systemd-networkd @{exec_path} flags=(complain) {
profile systemd-networkd @{exec_path} flags=(attach_disconnected,complain) {
include <abstractions/base>
include <abstractions/dbus-strict>
include <abstractions/systemd-common>
capability net_admin,
capability net_raw,
capability net_bind_service,
network inet dgram,
network inet6 dgram,
network inet raw,
network inet6 raw,
network netlink raw,
network packet dgram,
network packet raw,
dbus send bus=system path=/org/freedesktop/DBus
interface=org.freedesktop.DBus
member=RequestName
peer=(name=org.freedesktop.DBus),
dbus send bus=system path=/org/freedesktop/hostname[0-9]
interface=org.freedesktop.hostname1
member=SetHostname
peer=(name=org.freedesktop.hostname1),
dbus receive bus=system path=/org/freedesktop/network[0-9]
interface=org.freedesktop.DBus.Properties
member=Get,
dbus bind bus=system
name=org.freedesktop.network1,
@{exec_path} mr,
/var/lib/dbus/machine-id r,
/etc/machine-id r,
/etc/systemd/networkd.conf r,
/etc/systemd/network/ r,
/etc/systemd/network/[0-9][0-9]-*.{netdev,network,link} r,
/etc/networkd-dispatcher/carrier.d/{,*} r,
@{run}/systemd/network/ r,
@{run}/systemd/network/*.network r,
owner @{run}/systemd/netif/.#state rw,
owner @{run}/systemd/netif/.#state* rw,
owner @{run}/systemd/netif/leases/.#* rw,
owner @{run}/systemd/netif/leases/[0-9]* rw,
owner @{run}/systemd/netif/links/.#* rw,
owner @{run}/systemd/netif/links/[0-9]* rw,
owner @{run}/systemd/netif/leases/[0-9]* rw,
owner @{run}/systemd/netif/leases/.#* rw,
owner @{run}/systemd/netif/.#state* rw,
owner @{run}/systemd/netif/.#state rw,
owner @{run}/systemd/netif/state rw,
# To be able to configure network interfaces
@{PROC}/sys/net/ipv{4,6}/** rw,
@{sys}/devices/virtual/dmi/id/product_name r,
@{sys}/devices/virtual/dmi/id/{sys,board,bios}_vendor r,
@{sys}/devices/**/net/** r,
@{run}/udev/data/n[0-9]* r,
/var/lib/dbus/machine-id r,
/etc/machine-id r,
@{sys}/devices/**/net/** r,
@{sys}/devices/virtual/dmi/id/{sys,board,bios}_vendor r,
@{sys}/devices/virtual/dmi/id/product_name r,
@{PROC}/sys/net/ipv{4,6}/** rw,
include if exists <local/systemd-networkd>
}

View file

@ -11,6 +11,10 @@ profile systemd-networkd-wait-online @{exec_path} flags=(complain) {
include <abstractions/base>
include <abstractions/systemd-common>
capability net_admin,
network netlink raw,
@{exec_path} mr,
@{run}/systemd/netif/links/[0-9]* r,