]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
security: apparmor: Remove hardcoded "libvirtd" profile name
authorJim Fehlig <jfehlig@suse.com>
Sat, 4 Jan 2025 03:44:19 +0000 (20:44 -0700)
committerJim Fehlig <jfehlig@suse.com>
Mon, 6 Jan 2025 21:59:10 +0000 (14:59 -0700)
The apparmor driver probe function checks for an active profile matching
the full path of the running daemon binary. If not found, it checks for
a profile named "libvirtd". This works fine when the running daemon is the
old monolithic libvirtd, but fails with modular daemons.

Remove the check for a hardcoded "libvirtd" profile and replace with the
basename of the running daemon binary.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/security/security_apparmor.c

index c8e77c6cd20c10a839e9649d1ccfdf94248e0e07..eed0f265d635a991d2d6966951aa5522015ba421 100644 (file)
@@ -239,7 +239,9 @@ use_apparmor(void)
      */
     rc = profile_status(libvirt_daemon, 1);
     if (rc < 0) {
-        rc = profile_status("libvirtd", 1);
+        g_autofree char *basename = g_path_get_basename(libvirt_daemon);
+
+        rc = profile_status(basename, 1);
         /* Error or unconfined should all result in -1 */
         if (rc < 0)
             rc = -1;