usr.sbin.libvirtd 2.3 KB
Newer Older
J
Jamie Strandboge 已提交
1
# Last Modified: Mon Apr  5 15:03:58 2010
2 3 4
#include <tunables/global>
@{LIBVIRT}="libvirt"

5
/usr/sbin/libvirtd flags=(attach_disconnected) {
6
  #include <abstractions/base>
F
Felix Geyer 已提交
7
  #include <abstractions/dbus>
8 9 10 11 12 13 14 15

  capability kill,
  capability net_admin,
  capability net_raw,
  capability setgid,
  capability sys_admin,
  capability sys_module,
  capability sys_ptrace,
M
Mike Latimer 已提交
16
  capability sys_pacct,
17 18 19 20 21 22 23 24 25
  capability sys_nice,
  capability sys_chroot,
  capability setuid,
  capability dac_override,
  capability dac_read_search,
  capability fowner,
  capability chown,
  capability setpcap,
  capability mknod,
J
Jamie Strandboge 已提交
26
  capability fsetid,
F
Felix Geyer 已提交
27
  capability audit_write,
M
Mike Latimer 已提交
28
  capability ipc_lock,
29

30 31 32
  # Needed for vfio
  capability sys_resource,

33
  network inet stream,
J
Jamie Strandboge 已提交
34 35 36
  network inet dgram,
  network inet6 stream,
  network inet6 dgram,
F
Felix Geyer 已提交
37
  network packet dgram,
M
Mike Latimer 已提交
38
  network packet raw,
39 40 41

  # Very lenient profile for libvirtd since we want to first focus on confining
  # the guests. Guests will have a very restricted profile.
F
Felix Geyer 已提交
42
  / r,
43 44
  /** rwmkl,

F
Felix Geyer 已提交
45 46 47
  /bin/* PUx,
  /sbin/* PUx,
  /usr/bin/* PUx,
48
  /usr/sbin/virtlogd pix,
F
Felix Geyer 已提交
49
  /usr/sbin/* PUx,
I
intrigeri 已提交
50
  /{usr/,}lib/udev/scsi_id PUx,
51
  /usr/{lib,lib64}/xen-common/bin/xen-toolstack PUx,
M
Mike Latimer 已提交
52
  /usr/{lib,lib64}/xen/bin/* Ux,
53 54

  # force the use of virt-aa-helper
I
intrigeri 已提交
55
  audit deny /{usr/,}sbin/apparmor_parser rwxl,
56 57 58 59 60
  audit deny /etc/apparmor.d/libvirt/** wxl,
  audit deny /sys/kernel/security/apparmor/features rwxl,
  audit deny /sys/kernel/security/apparmor/matching rwxl,
  audit deny /sys/kernel/security/apparmor/.* rwxl,
  /sys/kernel/security/apparmor/profiles r,
61
  /usr/{lib,lib64}/libvirt/* PUxr,
M
Mike Latimer 已提交
62 63
  /usr/{lib,lib64}/libvirt/libvirt_parthelper ix,
  /usr/{lib,lib64}/libvirt/libvirt_iohelper ix,
F
Felix Geyer 已提交
64 65
  /etc/libvirt/hooks/** rmix,
  /etc/xen/scripts/** rmix,
66 67 68 69

  # allow changing to our UUID-based named profiles
  change_profile -> @{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,

70
  /usr/{lib,lib64,lib/qemu,libexec}/qemu-bridge-helper Cx -> qemu_bridge_helper,
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
  # child profile for bridge helper process
  profile qemu_bridge_helper {
   #include <abstractions/base>

   capability setuid,
   capability setgid,
   capability setpcap,
   capability net_admin,

   network inet stream,

   /dev/net/tun rw,
   /etc/qemu/** r,
   owner @{PROC}/*/status r,

86
   /usr/{lib,lib64,lib/qemu,libexec}/qemu-bridge-helper rmix,
87
  }
88
}