Commit Graph

7 Commits

Author SHA1 Message Date
Stefan Berger
cc52b200b0 debian: Add rule to allow usage of /var/tmp directory (QEMU)
QEMU's functional tests need access to /var/tmp/**. To avoid the following
type of AppArmor permission failures add a rule that allows access to
/var/tmp/**.

 type=AVC msg=audit(1730829888.863:260): apparmor="DENIED" \
   operation="mknod" class="file" profile="swtpm" \
   name="/var/tmp/qemu_3r9txw7z/swtpm-socket" pid=3925 comm="swtpm" \
   requested_mask="c" denied_mask="c" fsuid=1000 ouid=1000FSUID="stefanb" \
   OUID="stefanb"

[ To run the QEMU's functional tests use the following command:
    make check-functional ]

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-11-06 15:22:58 -05:00
Stefan Berger
47d37ccba2 debian: Add rules for reading profiles from distro and local dirs
Allow a user to pass profiles from the distro or local dirs directly
to swtpm. A rule to allow reading profiles from somewhere under the
HOME directory already exists.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-10-02 09:35:17 -04:00
Lena Voytek
84042ab8b2 debian: Allow non-owner file write access in /var/lib/libvirt/swtpm/
swtpm sometimes needs to create lock files in subdirectories of
/var/lib/libvirt/swtpm/. Since libvirt sets the owner of these
subdirectories to root, apparmor blocks swtpm's access to this when set to
owner. Add write permissions for lock files without the owner restriction
tothe folder to fix wc denials.

Signed-off-by: Lena Voytek <lena.voytek@canonical.com>
2024-06-28 15:12:10 -04:00
Lena Voytek
4f6163ba45 debian: Add sys_admin capability to apparmor profile
Some features of swtpm require kernel modules, such as --vtpm-proxy. Fix
apparmor denials related to this by adding capability sys_admin to the apparmor
profile.

Signed-off-by: Lena Voytek <lena.voytek@canonical.com>
2024-06-28 15:12:10 -04:00
Stefan Berger
3d620d0dd5 debian: Sync AppArmor profile with what is used by Ubuntu
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-06-11 11:03:03 -04:00
Lena Voytek
f732f489c2 debian: Allow apparmor access to qemu session bus swtpm files
When running a VM connected to qemu:///session, swtpm needs access to its own
process id and socket files in /run/user/<UID>/libvirt/qemu/run/swtpm/. Add
permissions to access them in the apparmor profile.

Signed-off-by: Lena Voytek <lena.voytek@canonical.com>
2023-08-10 20:03:06 -04:00
Lena Voytek
3d2747a1be debian: Add swtpm apparmor profile
An apparmor profile was added for Debian-based distributions in order to
increase security. This blocks swtpm from accessing restricted and unnecessary
files, folders, and network interfaces. swtpm works as normal alongside libvirt
and its configurations, however users may run into issues when using swtpm on
its own when providing it with a restricted directory. The apparmor profile can
be modified to include additional permissions by creating and adding to the
file /etc/apparmor.d/local/usr.bin.swtpm.

Signed-off-by: Lena Voytek <lena.voytek@canonical.com>
2022-05-05 20:58:30 -04:00