]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
security: AppArmor profile fixes for swtpm
authorChris Coulson <chris.coulson@canonical.com>
Tue, 24 Sep 2019 19:25:14 +0000 (20:25 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 30 Sep 2019 13:15:11 +0000 (15:15 +0200)
The AppArmor profile generated by virt-aa-helper is too strict for swtpm.
This change contains 2 small fixes:
- Relax append access to swtpm's log file to permit write access instead.
Append access is insufficient because the log is opened with O_CREAT.
- Permit swtpm to acquire a lock on its lock file.

Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/security/virt-aa-helper.c

index ead4eaa236a10c9fdc9af13ef73d3bff40f485de..5853ad985fe17c91af3f1dc39d179f22a1dca5b7 100644 (file)
@@ -1238,10 +1238,10 @@ get_files(vahControl * ctl)
              * directory, log, and PID files.
              */
             virBufferAsprintf(&buf,
-                "  \"%s/lib/libvirt/swtpm/%s/%s/**\" rw,\n",
+                "  \"%s/lib/libvirt/swtpm/%s/%s/**\" rwk,\n",
                 LOCALSTATEDIR, uuidstr, tpmpath);
             virBufferAsprintf(&buf,
-                "  \"%s/log/swtpm/libvirt/qemu/%s-swtpm.log\" a,\n",
+                "  \"%s/log/swtpm/libvirt/qemu/%s-swtpm.log\" w,\n",
                 LOCALSTATEDIR, ctl->def->name);
             virBufferAsprintf(&buf,
                 "  \"%s/libvirt/qemu/swtpm/%s-swtpm.pid\" rw,\n",