1 |
commit: b49bdbc0c5cba13cc94db4d7fe28dab4ab589a34 |
2 |
Author: Dominick Grift <dominick.grift <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Oct 31 11:31:39 2012 +0000 |
4 |
Commit: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be> |
5 |
CommitDate: Wed Oct 31 18:06:49 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=b49bdbc0 |
7 |
|
8 |
Changes to the wm policy module |
9 |
|
10 |
Ported from Fedora with changes |
11 |
|
12 |
Implement wm_domain attribute to write policy that applies to all |
13 |
wm_domains efficiently |
14 |
|
15 |
Left out some rules related to pulseaudio (will be re-added later in a |
16 |
different shape) |
17 |
|
18 |
Allows wm to create user home dirs and file for config data content |
19 |
|
20 |
This because we do not have private types for user config and data |
21 |
content yet |
22 |
|
23 |
Also allows wm to create user tmp sockets, this is broken since this is |
24 |
for gconfd and that dir in tmp is problably labeled gconf_tmp_t |
25 |
|
26 |
Should probably take a good look at gconf tmp file context spec for |
27 |
sockets, implement a gnome_gconfd_tmp_filetrans and use that instead |
28 |
|
29 |
Signed-off-by: Dominick Grift <dominick.grift <AT> gmail.com> |
30 |
|
31 |
--- |
32 |
policy/modules/contrib/wm.if | 79 ++++++++++++++++++++++++++---------------- |
33 |
policy/modules/contrib/wm.te | 35 +++++++++++++++++- |
34 |
2 files changed, 82 insertions(+), 32 deletions(-) |
35 |
|
36 |
diff --git a/policy/modules/contrib/wm.if b/policy/modules/contrib/wm.if |
37 |
index a115e8c..8791e25 100644 |
38 |
--- a/policy/modules/contrib/wm.if |
39 |
+++ b/policy/modules/contrib/wm.if |
40 |
@@ -1,4 +1,4 @@ |
41 |
-## <summary>X Window Managers</summary> |
42 |
+## <summary>X Window Managers.</summary> |
43 |
|
44 |
####################################### |
45 |
## <summary> |
46 |
@@ -29,41 +29,37 @@ |
47 |
# |
48 |
template(`wm_role_template',` |
49 |
gen_require(` |
50 |
+ attribute wm_domain; |
51 |
type wm_exec_t; |
52 |
- class dbus send_msg; |
53 |
') |
54 |
|
55 |
- type $1_wm_t; |
56 |
- domain_type($1_wm_t) |
57 |
- domain_entry_file($1_wm_t, wm_exec_t) |
58 |
+ ######################################## |
59 |
+ # |
60 |
+ # Declarations |
61 |
+ # |
62 |
+ |
63 |
+ type $1_wm_t, wm_domain; |
64 |
+ userdom_user_application_domain($1_wm_t, wm_exec_t) |
65 |
role $2 types $1_wm_t; |
66 |
|
67 |
- allow $1_wm_t self:fifo_file rw_fifo_file_perms; |
68 |
- allow $1_wm_t self:process getsched; |
69 |
- allow $1_wm_t self:shm create_shm_perms; |
70 |
+ ######################################## |
71 |
+ # |
72 |
+ # Policy |
73 |
+ # |
74 |
|
75 |
allow $1_wm_t $3:unix_stream_socket connectto; |
76 |
allow $3 $1_wm_t:unix_stream_socket connectto; |
77 |
- allow $3 $1_wm_t:process { signal sigchld signull }; |
78 |
- allow $1_wm_t $3:process { signull sigkill }; |
79 |
|
80 |
- allow $1_wm_t $3:dbus send_msg; |
81 |
- allow $3 $1_wm_t:dbus send_msg; |
82 |
+ allow $3 $1_wm_t:process { ptrace signal_perms }; |
83 |
+ ps_process_pattern($3, $1_wm_t) |
84 |
|
85 |
- domtrans_pattern($3, wm_exec_t, $1_wm_t) |
86 |
+ allow $1_wm_t $3:process { signull sigkill }; |
87 |
|
88 |
- kernel_read_system_state($1_wm_t) |
89 |
+ domtrans_pattern($3, wm_exec_t, $1_wm_t) |
90 |
|
91 |
corecmd_bin_domtrans($1_wm_t, $3) |
92 |
corecmd_shell_domtrans($1_wm_t, $3) |
93 |
|
94 |
- dev_read_urand($1_wm_t) |
95 |
- |
96 |
- files_read_etc_files($1_wm_t) |
97 |
- files_read_usr_files($1_wm_t) |
98 |
- |
99 |
- fs_getattr_tmpfs($1_wm_t) |
100 |
- |
101 |
mls_file_read_all_levels($1_wm_t) |
102 |
mls_file_write_all_levels($1_wm_t) |
103 |
mls_xwin_read_all_levels($1_wm_t) |
104 |
@@ -72,18 +68,13 @@ template(`wm_role_template',` |
105 |
|
106 |
auth_use_nsswitch($1_wm_t) |
107 |
|
108 |
- application_signull($1_wm_t) |
109 |
- |
110 |
- miscfiles_read_fonts($1_wm_t) |
111 |
- miscfiles_read_localization($1_wm_t) |
112 |
- |
113 |
optional_policy(` |
114 |
dbus_system_bus_client($1_wm_t) |
115 |
dbus_spec_session_bus_client($1, $1_wm_t) |
116 |
- ') |
117 |
|
118 |
- optional_policy(` |
119 |
- pulseaudio_stream_connect($1_wm_t) |
120 |
+ optional_policy(` |
121 |
+ wm_dbus_chat($1, $3) |
122 |
+ ') |
123 |
') |
124 |
|
125 |
optional_policy(` |
126 |
@@ -94,7 +85,7 @@ template(`wm_role_template',` |
127 |
|
128 |
######################################## |
129 |
## <summary> |
130 |
-## Execute the wm program in the wm domain. |
131 |
+## Execute wm in the caller domain. |
132 |
## </summary> |
133 |
## <param name="domain"> |
134 |
## <summary> |
135 |
@@ -107,5 +98,33 @@ interface(`wm_exec',` |
136 |
type wm_exec_t; |
137 |
') |
138 |
|
139 |
+ corecmd_search_bin($1) |
140 |
can_exec($1, wm_exec_t) |
141 |
') |
142 |
+ |
143 |
+######################################## |
144 |
+## <summary> |
145 |
+## Send and receive messages from |
146 |
+## specified wm over dbus. |
147 |
+## </summary> |
148 |
+## <param name="role_prefix"> |
149 |
+## <summary> |
150 |
+## The prefix of the user domain (e.g., user |
151 |
+## is the prefix for user_t). |
152 |
+## </summary> |
153 |
+## </param> |
154 |
+## <param name="domain"> |
155 |
+## <summary> |
156 |
+## Domain allowed access. |
157 |
+## </summary> |
158 |
+## </param> |
159 |
+# |
160 |
+interface(`wm_dbus_chat',` |
161 |
+ gen_require(` |
162 |
+ type $1_wm_t; |
163 |
+ class dbus send_msg; |
164 |
+ ') |
165 |
+ |
166 |
+ allow $2 $1_wm_t:dbus send_msg; |
167 |
+ allow $1_wm_t $2:dbus send_msg; |
168 |
+') |
169 |
|
170 |
diff --git a/policy/modules/contrib/wm.te b/policy/modules/contrib/wm.te |
171 |
index 10ed15f..fdc97cc 100644 |
172 |
--- a/policy/modules/contrib/wm.te |
173 |
+++ b/policy/modules/contrib/wm.te |
174 |
@@ -1,9 +1,40 @@ |
175 |
-policy_module(wm, 1.2.2) |
176 |
+policy_module(wm, 1.2.3) |
177 |
|
178 |
######################################## |
179 |
# |
180 |
# Declarations |
181 |
# |
182 |
|
183 |
+attribute wm_domain; |
184 |
+ |
185 |
type wm_exec_t; |
186 |
-corecmd_executable_file(wm_exec_t) |
187 |
+application_executable_file(wm_exec_t) |
188 |
+ |
189 |
+######################################## |
190 |
+# |
191 |
+# Common wm domain local policy |
192 |
+# |
193 |
+ |
194 |
+allow wm_domain self:fifo_file rw_fifo_file_perms; |
195 |
+allow wm_domain self:process getsched; |
196 |
+allow wm_domain self:shm create_shm_perms; |
197 |
+ |
198 |
+kernel_read_system_state(wm_domain) |
199 |
+ |
200 |
+dev_read_urand(wm_domain) |
201 |
+ |
202 |
+files_read_usr_files(wm_domain) |
203 |
+ |
204 |
+miscfiles_read_fonts(wm_domain) |
205 |
+miscfiles_read_localization(wm_domain) |
206 |
+ |
207 |
+userdom_manage_user_tmp_sockets(wm_domain) |
208 |
+userdom_tmp_filetrans_user_tmp(wm_domain, sock_file) |
209 |
+ |
210 |
+userdom_manage_user_home_content_dirs(wm_domain) |
211 |
+userdom_manage_user_home_content_files(wm_domain) |
212 |
+userdom_user_home_dir_filetrans_user_home_content(wm_domain, { dir file }) |
213 |
+ |
214 |
+optional_policy(` |
215 |
+ pulseaudio_stream_connect(wm_domain) |
216 |
+') |