aboutgitcodebugslistschat
path: root/contrib/apparmor/usr.bin.pasta
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2023-09-06 22:55:22 +0200
committerStefano Brivio <sbrivio@redhat.com>2023-09-07 00:31:35 +0200
commit63a8302961a421a67d38c52285be3c2ef149e6cc (patch)
tree384ac04edfece1f9622faad94be6801afbb21e23 /contrib/apparmor/usr.bin.pasta
parentabf5ef6c22d2e6fce0f0abe398a2c18b70ca6290 (diff)
downloadpasst-63a8302961a421a67d38c52285be3c2ef149e6cc.tar
passt-63a8302961a421a67d38c52285be3c2ef149e6cc.tar.gz
passt-63a8302961a421a67d38c52285be3c2ef149e6cc.tar.bz2
passt-63a8302961a421a67d38c52285be3c2ef149e6cc.tar.lz
passt-63a8302961a421a67d38c52285be3c2ef149e6cc.tar.xz
passt-63a8302961a421a67d38c52285be3c2ef149e6cc.tar.zst
passt-63a8302961a421a67d38c52285be3c2ef149e6cc.zip
apparmor: Add pasta's own profile
If pasta and pasta.avx2 are hard links to passt and passt.avx2, AppArmor will attach their own profiles on execution, and we can restrict passt's profile to what it actually needs. Note that pasta needs to access all the resources that passt needs, so the pasta abstraction still includes passt's one. I plan to push the adaptation required for the Debian package in commit 5bb812e79143 ("debian/rules: Override pasta symbolic links with hard links"), on Salsa. If other distributions need to support AppArmor profiles they can follow a similar approach. The profile itself will be installed, there, via dh_apparmor, in a separate commit, b52557fedcb1 ("debian/rules: Install new pasta profile using dh_apparmor"). Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'contrib/apparmor/usr.bin.pasta')
-rw-r--r--contrib/apparmor/usr.bin.pasta27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/apparmor/usr.bin.pasta b/contrib/apparmor/usr.bin.pasta
new file mode 100644
index 0000000..e5ee4df
--- /dev/null
+++ b/contrib/apparmor/usr.bin.pasta
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# PASST - Plug A Simple Socket Transport
+# for qemu/UNIX domain socket mode
+#
+# PASTA - Pack A Subtle Tap Abstraction
+# for network namespace/tap device mode
+#
+# contrib/apparmor/usr.bin.pasta - AppArmor profile for pasta(1)
+#
+# Copyright (c) 2022 Red Hat GmbH
+# Author: Stefano Brivio <sbrivio@redhat.com>
+
+abi <abi/3.0>,
+
+include <tunables/global>
+
+profile pasta /usr/bin/pasta{,.avx2} flags=(attach_disconnected) {
+ include <abstractions/pasta>
+
+ # Alternatively: include <abstractions/user-tmp>
+ owner /tmp/** w, # tap_sock_unix_init(), pcap(),
+ # write_pidfile(),
+ # logfile_init()
+
+ owner @{HOME}/** w, # pcap(), write_pidfile()
+}