usr.sbin.libvirtd 2.4 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

J
Jim Fehlig 已提交
40 41 42 43
  ptrace (trace) peer=unconfined,
  ptrace (trace) peer=/usr/sbin/libvirtd,
  ptrace (trace) peer=libvirt-*,

44 45
  # 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 已提交
46
  / r,
47 48
  /** rwmkl,

F
Felix Geyer 已提交
49 50 51
  /bin/* PUx,
  /sbin/* PUx,
  /usr/bin/* PUx,
52
  /usr/sbin/virtlogd pix,
F
Felix Geyer 已提交
53
  /usr/sbin/* PUx,
I
intrigeri 已提交
54
  /{usr/,}lib/udev/scsi_id PUx,
55
  /usr/{lib,lib64}/xen-common/bin/xen-toolstack PUx,
M
Mike Latimer 已提交
56
  /usr/{lib,lib64}/xen/bin/* Ux,
57
  /usr/lib/xen-*/bin/libxl-save-helper PUx,
58 59

  # force the use of virt-aa-helper
I
intrigeri 已提交
60
  audit deny /{usr/,}sbin/apparmor_parser rwxl,
61 62 63 64 65
  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,
66
  /usr/{lib,lib64}/libvirt/* PUxr,
M
Mike Latimer 已提交
67 68
  /usr/{lib,lib64}/libvirt/libvirt_parthelper ix,
  /usr/{lib,lib64}/libvirt/libvirt_iohelper ix,
F
Felix Geyer 已提交
69 70
  /etc/libvirt/hooks/** rmix,
  /etc/xen/scripts/** rmix,
71 72 73 74

  # 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]*,

75
  /usr/{lib,lib64,lib/qemu,libexec}/qemu-bridge-helper Cx -> qemu_bridge_helper,
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
  # 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,

91
   /usr/{lib,lib64,lib/qemu,libexec}/qemu-bridge-helper rmix,
92
  }
93
}