feat(profiles): add swtpm, swtpm_localca and swtpm_setup.

This commit is contained in:
Alexandre Pujol 2022-05-02 18:12:07 +01:00
parent 3018ce3bbd
commit 82e53fd919
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC
4 changed files with 93 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/swtpm
profile swtpm @{exec_path} {
include <abstractions/base>
@{exec_path} mr,
/var/lib/libvirt/swtpm/@{uuid}/tpm2/.lock wk,
/var/lib/libvirt/swtpm/@{uuid}/tpm2/*.permall rw,
/var/log/swtpm/libvirt/qemu/*-swtpm.log w,
/tmp/.swtpm_setup.pidfile.* rw,
@{run}/libvirt/qemu/swtpm/*.sock w,
@{run}/libvirt/qemu/swtpm/*.pid w,
include if exists <local/swtpm>
}

View File

@ -0,0 +1,33 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/swtpm_localca
profile swtpm_localca @{exec_path} {
include <abstractions/base>
include <abstractions/nameservice-strict>
@{exec_path} mr,
/{usr/,}bin/certtool rix,
/{usr/,}bin/swtpm_cert rix,
/etc/swtpm-localca.conf r,
/etc/swtpm-localca.options r,
/var/log/swtpm/libvirt/qemu/*-swtpm.log w,
/var/lib/swtpm-localca/*.pem r,
/var/lib/swtpm-localca/.lock.swtpm-localca rwk,
/var/lib/swtpm-localca/certserial rw,
/tmp/swtpm_setup.certs.*/*.cert rw,
@{run}/libvirt/qemu/swtpm/*.sock w,
include if exists <local/swtpm_localca>
}

View File

@ -0,0 +1,30 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/swtpm_setup
profile swtpm_setup @{exec_path} {
include <abstractions/base>
include <abstractions/nameservice-strict>
@{exec_path} mr,
/{usr/,}bin/swtpm rPx,
/{usr/,}bin/swtpm_localca rPx,
/etc/swtpm_setup.conf r,
/var/log/swtpm/{,**} w,
/var/lib/libvirt/swtpm/@{uuid}/tpm2/ r,
owner /tmp/swtpm_setup.certs.*/ w,
owner /tmp/.swtpm_setup.pidfile* rw,
@{run}/systemd/userdb/ r,
include if exists <local/swtpm_setup>
}

View File

@ -86,6 +86,10 @@ ssh complain
sshd attach_disconnected,complain
su complain
sudo complain
swtpm complain
swtpm_ioctl complain
swtpm_localca complain
swtpm_setup complain
sysctl complain
systemd-analyze complain
systemd-ask-password complain