1 |
commit: 6e964d7e0dd29423a0a4dc95dd0d338b4094fcc4 |
2 |
Author: Dominick Grift <dominick.grift <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Sep 26 10:25:40 2012 +0000 |
4 |
Commit: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be> |
5 |
CommitDate: Thu Sep 27 17:55:05 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=6e964d7e |
7 |
|
8 |
Changes to the cyphesis policy module |
9 |
|
10 |
Ported from Fedora with changes |
11 |
Add init script file |
12 |
Add cyphesis_admin() |
13 |
Remove tmp rules because non-working due to inconsistency |
14 |
Make /usr/bin/cyphesis application executable file so that confined |
15 |
users can at least run it in the calling user domain |
16 |
Module clean up |
17 |
|
18 |
Signed-off-by: Dominick Grift <dominick.grift <AT> gmail.com> |
19 |
Signed-off-by: Sven Vermeulen <sven.vermeulen <AT> siphos.be> |
20 |
|
21 |
--- |
22 |
policy/modules/contrib/cyphesis.fc | 6 +++- |
23 |
policy/modules/contrib/cyphesis.if | 44 +++++++++++++++++++++++++++++++++++- |
24 |
policy/modules/contrib/cyphesis.te | 34 ++++++++++++++------------- |
25 |
3 files changed, 65 insertions(+), 19 deletions(-) |
26 |
|
27 |
diff --git a/policy/modules/contrib/cyphesis.fc b/policy/modules/contrib/cyphesis.fc |
28 |
index c47a772..1813506 100644 |
29 |
--- a/policy/modules/contrib/cyphesis.fc |
30 |
+++ b/policy/modules/contrib/cyphesis.fc |
31 |
@@ -1,5 +1,7 @@ |
32 |
+/etc/rc\.d/init\.d/cyphesis -- gen_context(system_u:object_r:cyphesis_initrc_exec_t,s0) |
33 |
+ |
34 |
/usr/bin/cyphesis -- gen_context(system_u:object_r:cyphesis_exec_t,s0) |
35 |
|
36 |
-/var/log/cyphesis(/.*)? gen_context(system_u:object_r:cyphesis_log_t,s0) |
37 |
+/var/log/cyphesis(/.*)? gen_context(system_u:object_r:cyphesis_log_t,s0) |
38 |
|
39 |
-/var/run/cyphesis(/.*)? gen_context(system_u:object_r:cyphesis_var_run_t,s0) |
40 |
+/var/run/cyphesis(/.*)? gen_context(system_u:object_r:cyphesis_var_run_t,s0) |
41 |
|
42 |
diff --git a/policy/modules/contrib/cyphesis.if b/policy/modules/contrib/cyphesis.if |
43 |
index 9d44538..df8aa4a 100644 |
44 |
--- a/policy/modules/contrib/cyphesis.if |
45 |
+++ b/policy/modules/contrib/cyphesis.if |
46 |
@@ -1,4 +1,4 @@ |
47 |
-## <summary>Cyphesis WorldForge game server</summary> |
48 |
+## <summary>Cyphesis WorldForge game server.</summary> |
49 |
|
50 |
######################################## |
51 |
## <summary> |
52 |
@@ -15,5 +15,47 @@ interface(`cyphesis_domtrans',` |
53 |
type cyphesis_t, cyphesis_exec_t; |
54 |
') |
55 |
|
56 |
+ corecmd_search_bin($1) |
57 |
domtrans_pattern($1, cyphesis_exec_t, cyphesis_t) |
58 |
') |
59 |
+ |
60 |
+######################################## |
61 |
+## <summary> |
62 |
+## All of the rules required to |
63 |
+## administrate an cyphesis environment. |
64 |
+## </summary> |
65 |
+## <param name="domain"> |
66 |
+## <summary> |
67 |
+## Domain allowed access. |
68 |
+## </summary> |
69 |
+## </param> |
70 |
+## <param name="role"> |
71 |
+## <summary> |
72 |
+## Role allowed access. |
73 |
+## </summary> |
74 |
+## </param> |
75 |
+## <rolecap/> |
76 |
+# |
77 |
+interface(`cyphesis_admin',` |
78 |
+ gen_require(` |
79 |
+ type cyphesis_t, cyphesis_initrc_exec_t, cyphesis_log_t; |
80 |
+ type cyphesis_var_run_t, cyphesis_tmp_t; |
81 |
+ ') |
82 |
+ |
83 |
+ allow $1 cyphesis_t:process { ptrace signal_perms }; |
84 |
+ ps_process_pattern($1, cyphesis_t) |
85 |
+ |
86 |
+ init_labeled_script_domtrans($1, cyphesis_initrc_exec_t) |
87 |
+ domain_system_change_exemption($1) |
88 |
+ role_transition $2 cyphesis_initrc_exec_t system_r; |
89 |
+ allow $2 system_r; |
90 |
+ |
91 |
+ logging_search_logs($1) |
92 |
+ admin_pattern($1, cyphesis_log_t) |
93 |
+ |
94 |
+ files_search_pids($1) |
95 |
+ admin_pattern($1, cyphesis_var_run_t) |
96 |
+ |
97 |
+ files_search_tmp($1) |
98 |
+ admin_pattern($1, cyphesis_tmp_t) |
99 |
+') |
100 |
|
101 |
diff --git a/policy/modules/contrib/cyphesis.te b/policy/modules/contrib/cyphesis.te |
102 |
index 25897c9..12feb5b 100644 |
103 |
--- a/policy/modules/contrib/cyphesis.te |
104 |
+++ b/policy/modules/contrib/cyphesis.te |
105 |
@@ -1,4 +1,4 @@ |
106 |
-policy_module(cyphesis, 1.2.0) |
107 |
+policy_module(cyphesis, 1.2.1) |
108 |
|
109 |
######################################## |
110 |
# |
111 |
@@ -8,6 +8,10 @@ policy_module(cyphesis, 1.2.0) |
112 |
type cyphesis_t; |
113 |
type cyphesis_exec_t; |
114 |
init_daemon_domain(cyphesis_t, cyphesis_exec_t) |
115 |
+application_executable_file(cyphesis_exec_t) |
116 |
+ |
117 |
+type cyphesis_initrc_exec_t; |
118 |
+init_script_file(cyphesis_initrc_exec_t) |
119 |
|
120 |
type cyphesis_log_t; |
121 |
logging_log_file(cyphesis_log_t) |
122 |
@@ -20,45 +24,41 @@ files_pid_file(cyphesis_var_run_t) |
123 |
|
124 |
######################################## |
125 |
# |
126 |
-# cyphesis local policy |
127 |
+# Local policy |
128 |
# |
129 |
|
130 |
allow cyphesis_t self:process { setfscreate setsched signal }; |
131 |
allow cyphesis_t self:fifo_file rw_fifo_file_perms; |
132 |
allow cyphesis_t self:tcp_socket create_stream_socket_perms; |
133 |
-allow cyphesis_t self:unix_stream_socket create_stream_socket_perms; |
134 |
-allow cyphesis_t self:unix_dgram_socket create_socket_perms; |
135 |
+allow cyphesis_t self:unix_stream_socket { accept listen }; |
136 |
|
137 |
-manage_files_pattern(cyphesis_t, cyphesis_log_t, cyphesis_log_t) |
138 |
+append_files_pattern(cyphesis_t, cyphesis_log_t, cyphesis_log_t) |
139 |
+create_files_pattern(cyphesis_t, cyphesis_log_t, cyphesis_log_t) |
140 |
+setattr_files_pattern(cyphesis_t, cyphesis_log_t, cyphesis_log_t) |
141 |
logging_log_filetrans(cyphesis_t, cyphesis_log_t, file) |
142 |
|
143 |
-# DAN > Does cyphesis really create a sock_file in /tmp? Why? |
144 |
-allow cyphesis_t cyphesis_tmp_t:sock_file manage_sock_file_perms; |
145 |
-files_tmp_filetrans(cyphesis_t, cyphesis_tmp_t, file) |
146 |
- |
147 |
manage_dirs_pattern(cyphesis_t, cyphesis_var_run_t, cyphesis_var_run_t) |
148 |
manage_files_pattern(cyphesis_t, cyphesis_var_run_t, cyphesis_var_run_t) |
149 |
manage_sock_files_pattern(cyphesis_t, cyphesis_var_run_t, cyphesis_var_run_t) |
150 |
-files_pid_filetrans(cyphesis_t, cyphesis_var_run_t, { dir file sock_file }) |
151 |
+files_pid_filetrans(cyphesis_t, cyphesis_var_run_t, dir) |
152 |
|
153 |
kernel_read_system_state(cyphesis_t) |
154 |
kernel_read_kernel_sysctls(cyphesis_t) |
155 |
|
156 |
-# DAN> What is cyphesis looking for in /bin? |
157 |
corecmd_search_bin(cyphesis_t) |
158 |
corecmd_getattr_bin_files(cyphesis_t) |
159 |
|
160 |
corenet_all_recvfrom_unlabeled(cyphesis_t) |
161 |
corenet_tcp_sendrecv_generic_if(cyphesis_t) |
162 |
corenet_tcp_sendrecv_generic_node(cyphesis_t) |
163 |
-corenet_tcp_sendrecv_all_ports(cyphesis_t) |
164 |
corenet_tcp_bind_generic_node(cyphesis_t) |
165 |
-corenet_tcp_bind_cyphesis_port(cyphesis_t) |
166 |
+ |
167 |
corenet_sendrecv_cyphesis_server_packets(cyphesis_t) |
168 |
+corenet_tcp_bind_cyphesis_port(cyphesis_t) |
169 |
+corenet_tcp_sendrecv_cyphesis_port(cyphesis_t) |
170 |
|
171 |
dev_read_urand(cyphesis_t) |
172 |
|
173 |
-# Init script handling |
174 |
domain_use_interactive_fds(cyphesis_t) |
175 |
|
176 |
files_read_etc_files(cyphesis_t) |
177 |
@@ -70,10 +70,12 @@ miscfiles_read_localization(cyphesis_t) |
178 |
|
179 |
sysnet_dns_name_resolve(cyphesis_t) |
180 |
|
181 |
-# cyphesis wants to talk to avahi via dbus |
182 |
optional_policy(` |
183 |
- avahi_dbus_chat(cyphesis_t) |
184 |
dbus_system_bus_client(cyphesis_t) |
185 |
+ |
186 |
+ optional_policy(` |
187 |
+ avahi_dbus_chat(cyphesis_t) |
188 |
+ ') |
189 |
') |
190 |
|
191 |
optional_policy(` |