1 |
commit: 6554059451b70152a69c7d5a2e5b95fa7d6e296d |
2 |
Author: Dominick Grift <dominick.grift <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Oct 30 11:13:08 2012 +0000 |
4 |
Commit: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be> |
5 |
CommitDate: Tue Oct 30 18:33:14 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=65540594 |
7 |
|
8 |
Changes to the uptime policy module |
9 |
|
10 |
Add init script file |
11 |
Add uptime_admin() |
12 |
|
13 |
Signed-off-by: Dominick Grift <dominick.grift <AT> gmail.com> |
14 |
|
15 |
--- |
16 |
policy/modules/contrib/uptime.fc | 5 +++- |
17 |
policy/modules/contrib/uptime.if | 43 +++++++++++++++++++++++++++++++++++++- |
18 |
policy/modules/contrib/uptime.te | 10 ++++---- |
19 |
3 files changed, 51 insertions(+), 7 deletions(-) |
20 |
|
21 |
diff --git a/policy/modules/contrib/uptime.fc b/policy/modules/contrib/uptime.fc |
22 |
index e30d6fc..a72670a 100644 |
23 |
--- a/policy/modules/contrib/uptime.fc |
24 |
+++ b/policy/modules/contrib/uptime.fc |
25 |
@@ -1,6 +1,9 @@ |
26 |
- |
27 |
/etc/uptimed\.conf -- gen_context(system_u:object_r:uptimed_etc_t,s0) |
28 |
|
29 |
+/etc/rc\.d/init\.d/uptimed -- gen_context(system_u:object_r:uptimed_initrc_exec_t,s0) |
30 |
+ |
31 |
/usr/sbin/uptimed -- gen_context(system_u:object_r:uptimed_exec_t,s0) |
32 |
|
33 |
+/var/run/uptimed\.pid -- gen_context(system_u:object_r:uptimed_var_run_t,s0) |
34 |
+ |
35 |
/var/spool/uptimed(/.*)? gen_context(system_u:object_r:uptimed_spool_t,s0) |
36 |
|
37 |
diff --git a/policy/modules/contrib/uptime.if b/policy/modules/contrib/uptime.if |
38 |
index 447abf7..01a3234 100644 |
39 |
--- a/policy/modules/contrib/uptime.if |
40 |
+++ b/policy/modules/contrib/uptime.if |
41 |
@@ -1 +1,42 @@ |
42 |
-## <summary>Uptime daemon</summary> |
43 |
+## <summary>Daemon to record and keep track of system up times.</summary> |
44 |
+ |
45 |
+######################################## |
46 |
+## <summary> |
47 |
+## All of the rules required to |
48 |
+## administrate an uptime environment. |
49 |
+## </summary> |
50 |
+## <param name="domain"> |
51 |
+## <summary> |
52 |
+## Domain allowed access. |
53 |
+## </summary> |
54 |
+## </param> |
55 |
+## <param name="role"> |
56 |
+## <summary> |
57 |
+## Role allowed access. |
58 |
+## </summary> |
59 |
+## </param> |
60 |
+## <rolecap/> |
61 |
+# |
62 |
+interface(`uptime_admin',` |
63 |
+ gen_require(` |
64 |
+ type uptimed_t, uptimed_initrc_exec_t. uptimed_etc_t; |
65 |
+ type uptimed_spool_t, uptimed_var_run_t; |
66 |
+ ') |
67 |
+ |
68 |
+ allow $1 uptimed_t:process { ptrace signal_perms }; |
69 |
+ ps_process_pattern($1, uptimed_t) |
70 |
+ |
71 |
+ init_labeled_script_domtrans($1, uptimed_initrc_exec_t) |
72 |
+ domain_system_change_exemption($1) |
73 |
+ role_transition $2 uptimed_initrc_exec_t system_r; |
74 |
+ allow $2 system_r; |
75 |
+ |
76 |
+ files_search_etc($1) |
77 |
+ admin_pattern($1, uptimed_etc_t) |
78 |
+ |
79 |
+ files_search_spool($1) |
80 |
+ admin_pattern($1, uptimed_spool_t) |
81 |
+ |
82 |
+ files_search_pids($1) |
83 |
+ admin_pattern($1, uptimed_var_run_t) |
84 |
+') |
85 |
|
86 |
diff --git a/policy/modules/contrib/uptime.te b/policy/modules/contrib/uptime.te |
87 |
index c2cf97e..09741f6 100644 |
88 |
--- a/policy/modules/contrib/uptime.te |
89 |
+++ b/policy/modules/contrib/uptime.te |
90 |
@@ -1,4 +1,4 @@ |
91 |
-policy_module(uptime, 1.4.0) |
92 |
+policy_module(uptime, 1.4.1) |
93 |
|
94 |
######################################## |
95 |
# |
96 |
@@ -12,6 +12,9 @@ init_daemon_domain(uptimed_t, uptimed_exec_t) |
97 |
type uptimed_etc_t alias etc_uptimed_t; |
98 |
files_config_file(uptimed_etc_t) |
99 |
|
100 |
+type uptimed_initrc_exec_t; |
101 |
+init_script_file(uptimed_initrc_exec_t) |
102 |
+ |
103 |
type uptimed_spool_t; |
104 |
files_type(uptimed_spool_t) |
105 |
|
106 |
@@ -25,12 +28,9 @@ files_pid_file(uptimed_var_run_t) |
107 |
|
108 |
dontaudit uptimed_t self:capability sys_tty_config; |
109 |
allow uptimed_t self:process signal_perms; |
110 |
-allow uptimed_t self:fifo_file write_file_perms; |
111 |
+allow uptimed_t self:fifo_file rw_fifo_file_perms; |
112 |
|
113 |
allow uptimed_t uptimed_etc_t:file read_file_perms; |
114 |
-files_search_etc(uptimed_t) |
115 |
- |
116 |
-allow uptimed_t uptimed_spool_t:file manage_file_perms; |
117 |
|
118 |
manage_files_pattern(uptimed_t, uptimed_var_run_t, uptimed_var_run_t) |
119 |
files_pid_filetrans(uptimed_t, uptimed_var_run_t, file) |