Gentoo Archives: gentoo-commits

From: Sven Vermeulen <swift@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/contrib/
Date: Mon, 31 Mar 2014 18:49:27
Message-Id: 1396287663.447936782bfb89286beb2373ca41ae460e862750.swift@gentoo
1 commit: 447936782bfb89286beb2373ca41ae460e862750
2 Author: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be>
3 AuthorDate: Mon Mar 31 17:24:43 2014 +0000
4 Commit: Sven Vermeulen <swift <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 31 17:41:03 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=44793678
7
8 Qemu socket support
9
10 The VDE switch implementation in Qemu, depending on how it is called
11 command-line, requires Qemu to create a socket through which network
12 communication is to be handled.
13
14 Without this, qemu fails to start.
15
16 ---
17 policy/modules/contrib/qemu.if | 20 ++++++++++++++++++++
18 policy/modules/contrib/qemu.te | 9 +++++++++
19 policy/modules/contrib/vde.te | 4 ++++
20 3 files changed, 33 insertions(+)
21
22 diff --git a/policy/modules/contrib/qemu.if b/policy/modules/contrib/qemu.if
23 index eaf56b8..ea947bc 100644
24 --- a/policy/modules/contrib/qemu.if
25 +++ b/policy/modules/contrib/qemu.if
26 @@ -374,3 +374,23 @@ interface(`qemu_entry_type',`
27
28 domain_entry_file($1, qemu_exec_t)
29 ')
30 +
31 +# Gentoo specific but cannot use ifdef distro_gentoo here
32 +
33 +#######################################
34 +## <summary>
35 +## Read/write to qemu socket files in /var/run
36 +## </summary>
37 +## <param name="domain">
38 +## <summary>
39 +## Domain allowed access.
40 +## </summary>
41 +## </param>
42 +#
43 +interface(`qemu_rw_pid_sock_files',`
44 + gen_require(`
45 + type qemu_var_run_t;
46 + ')
47 +
48 + allow $1 qemu_var_run_t:sock_file rw_sock_file_perms;
49 +')
50
51 diff --git a/policy/modules/contrib/qemu.te b/policy/modules/contrib/qemu.te
52 index 9a6a082..cf647bb 100644
53 --- a/policy/modules/contrib/qemu.te
54 +++ b/policy/modules/contrib/qemu.te
55 @@ -62,9 +62,18 @@ ifdef(`distro_gentoo',`
56 #
57 # Local policy
58 #
59 + type qemu_var_run_t;
60 + files_pid_file(qemu_var_run_t)
61 +
62 + # VNC/GDB support
63 allow qemu_t self:tcp_socket create_stream_socket_perms;
64 allow qemu_t self:udp_socket create_socket_perms;
65
66 + # Network related socket
67 + allow qemu_t qemu_var_run_t:sock_file manage_sock_file_perms;
68 +
69 + files_pid_filetrans(qemu_t, qemu_var_run_t, sock_file)
70 +
71 optional_policy(`
72 vde_connect(qemu_t)
73 ')
74
75 diff --git a/policy/modules/contrib/vde.te b/policy/modules/contrib/vde.te
76 index 3b89491..56f668d 100644
77 --- a/policy/modules/contrib/vde.te
78 +++ b/policy/modules/contrib/vde.te
79 @@ -47,3 +47,7 @@ miscfiles_read_localization(vde_t)
80 corenet_rw_tun_tap_dev(vde_t)
81
82 logging_send_syslog_msg(vde_t)
83 +
84 +optional_policy(`
85 + qemu_rw_pid_sock_files(vde_t)
86 +')