diff --git a/apparmor.d/groups/network/wg b/apparmor.d/groups/network/wg new file mode 100644 index 00000000..6f4bf4ea --- /dev/null +++ b/apparmor.d/groups/network/wg @@ -0,0 +1,20 @@ +# apparmor.d - Full set of apparmor profiles +# Copyright (C) 2022 Alexandre Pujol +# SPDX-License-Identifier: GPL-2.0-only + +abi , + +include + +@{exec_path} = /{usr/,}bin/wg +profile wg @{exec_path} { + include + + capability net_admin, + + network netlink raw, + + @{exec_path} mr, + + include if exists +} \ No newline at end of file diff --git a/apparmor.d/groups/network/wg-quick b/apparmor.d/groups/network/wg-quick new file mode 100644 index 00000000..06ccb7d6 --- /dev/null +++ b/apparmor.d/groups/network/wg-quick @@ -0,0 +1,48 @@ +# apparmor.d - Full set of apparmor profiles +# Copyright (C) 2022 Alexandre Pujol +# SPDX-License-Identifier: GPL-2.0-only + +abi , + +include + +@{exec_path} = /{usr/,}bin/wg-quick +profile wg-quick @{exec_path} { + include + + capability net_admin, + + network netlink raw, + + @{exec_path} mr, + + /{usr/,}{s,}bin/nft rix, + /{usr/,}{s,}bin/sysctl rix, + /{usr/,}bin/{,ba,da}sh rix, + /{usr/,}bin/cat rix, + /{usr/,}bin/ip rPx, + /{usr/,}bin/readlink rix, + /{usr/,}bin/resolvectl rPx, + /{usr/,}bin/sort rix, + /{usr/,}bin/stat rix, + /{usr/,}bin/wg rPx, + /{usr/,}bin/xtables-nft-multi rix, + + /usr/share/terminfo/x/xterm-256color r, + + /etc/iproute2/group r, + /etc/iproute2/rt_realms r, + /etc/resolvconf/interface-order r, + /etc/wireguard/*.conf r, + + @{sys}/module/wireguard r, + + @{PROC}/sys/net/ipv4/conf/all/src_valid_mark w, + + /dev/tty rw, + + # Force the use as root + deny /{usr/,}bin/sudo x, + + include if exists +} \ No newline at end of file