usr.sbin.libvirtd 3.8 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47
  mount options=(rw,rslave)  -> /,
  mount options=(rw, nosuid) -> /{var/,}run/libvirt/qemu/*.dev/,

  mount options=(rw, move) /dev/           -> /{var/,}run/libvirt/qemu/*.dev/,
  mount options=(rw, move) /dev/hugepages/ -> /{var/,}run/libvirt/qemu/*.hugepages/,
  mount options=(rw, move) /dev/mqueue/    -> /{var/,}run/libvirt/qemu/*.mqueue/,
  mount options=(rw, move) /dev/pts/       -> /{var/,}run/libvirt/qemu/*.pts/,
  mount options=(rw, move) /dev/shm/       -> /{var/,}run/libvirt/qemu/*.shm/,

  mount options=(rw, move) /{var/,}run/libvirt/qemu/*.dev/       -> /dev/,
  mount options=(rw, move) /{var/,}run/libvirt/qemu/*.hugepages/ -> /dev/hugepages/,
  mount options=(rw, move) /{var/,}run/libvirt/qemu/*.mqueue/    -> /dev/mqueue/,
  mount options=(rw, move) /{var/,}run/libvirt/qemu/*.pts/       -> /dev/pts/,
  mount options=(rw, move) /{var/,}run/libvirt/qemu/*.shm/       -> /dev/shm/,

48
  network inet stream,
J
Jamie Strandboge 已提交
49 50 51
  network inet dgram,
  network inet6 stream,
  network inet6 dgram,
52
  network netlink raw,
F
Felix Geyer 已提交
53
  network packet dgram,
M
Mike Latimer 已提交
54
  network packet raw,
55

56 57 58
  # for --p2p migrations
  unix (send, receive) type=stream addr=none peer=(label=unconfined addr=none),

J
Jim Fehlig 已提交
59 60
  ptrace (trace) peer=unconfined,
  ptrace (trace) peer=/usr/sbin/libvirtd,
61
  ptrace (trace) peer=/usr/sbin/dnsmasq,
J
Jim Fehlig 已提交
62 63
  ptrace (trace) peer=libvirt-*,

64 65
  signal (send) peer=/usr/sbin/dnsmasq,
  signal (read, send) peer=libvirt-*,
66
  signal (send) set=("kill", "term") peer=unconfined,
67

68 69
  # 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 已提交
70
  / r,
71 72
  /** rwmkl,

F
Felix Geyer 已提交
73 74 75
  /bin/* PUx,
  /sbin/* PUx,
  /usr/bin/* PUx,
76
  /usr/sbin/virtlogd pix,
F
Felix Geyer 已提交
77
  /usr/sbin/* PUx,
I
intrigeri 已提交
78
  /{usr/,}lib/udev/scsi_id PUx,
79
  /usr/{lib,lib64}/xen-common/bin/xen-toolstack PUx,
M
Mike Latimer 已提交
80
  /usr/{lib,lib64}/xen/bin/* Ux,
81
  /usr/lib/xen-*/bin/libxl-save-helper PUx,
82

83 84 85 86
  # Required by nwfilter_ebiptables_driver.c:ebiptablesWriteToTempFile() to
  # read and run an ebtables script.
  /var/lib/libvirt/virtd* ixr,

87
  # force the use of virt-aa-helper
I
intrigeri 已提交
88
  audit deny /{usr/,}sbin/apparmor_parser rwxl,
89 90 91 92 93
  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,
94
  /usr/{lib,lib64}/libvirt/* PUxr,
M
Mike Latimer 已提交
95 96
  /usr/{lib,lib64}/libvirt/libvirt_parthelper ix,
  /usr/{lib,lib64}/libvirt/libvirt_iohelper ix,
F
Felix Geyer 已提交
97 98
  /etc/libvirt/hooks/** rmix,
  /etc/xen/scripts/** rmix,
99 100 101 102

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

103
  /usr/{lib,lib64,lib/qemu,libexec}/qemu-bridge-helper Cx -> qemu_bridge_helper,
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
  # 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,

119
   /usr/{lib,lib64,lib/qemu,libexec}/qemu-bridge-helper rmix,
120
  }
121
}