1 |
commit: 41f2cdfadbb7cb1fd016839b923846a9946f3cab |
2 |
Author: Jason Zaman <jason <AT> perfinion <DOT> com> |
3 |
AuthorDate: Sat Jul 11 09:15:45 2015 +0000 |
4 |
Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jul 30 16:41:27 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=41f2cdfa |
7 |
|
8 |
Introduce ipsec_admin interface |
9 |
|
10 |
policy/modules/roles/sysadm.te | 8 +------ |
11 |
policy/modules/system/ipsec.if | 51 ++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 52 insertions(+), 7 deletions(-) |
13 |
|
14 |
diff --git a/policy/modules/roles/sysadm.te b/policy/modules/roles/sysadm.te |
15 |
index 1ee88cd..5901b2f 100644 |
16 |
--- a/policy/modules/roles/sysadm.te |
17 |
+++ b/policy/modules/roles/sysadm.te |
18 |
@@ -473,13 +473,7 @@ optional_policy(` |
19 |
') |
20 |
|
21 |
optional_policy(` |
22 |
- # allow system administrator to use the ipsec script to look |
23 |
- # at things (e.g., ipsec auto --status) |
24 |
- # probably should create an ipsec_admin role for this kind of thing |
25 |
- ipsec_exec_mgmt(sysadm_t) |
26 |
- ipsec_stream_connect(sysadm_t) |
27 |
- # for lsof |
28 |
- ipsec_getattr_key_sockets(sysadm_t) |
29 |
+ ipsec_admin(sysadm_t, sysadm_r) |
30 |
') |
31 |
|
32 |
optional_policy(` |
33 |
|
34 |
diff --git a/policy/modules/system/ipsec.if b/policy/modules/system/ipsec.if |
35 |
index 0d4c8d3..3d64054 100644 |
36 |
--- a/policy/modules/system/ipsec.if |
37 |
+++ b/policy/modules/system/ipsec.if |
38 |
@@ -369,3 +369,54 @@ interface(`ipsec_run_setkey',` |
39 |
ipsec_domtrans_setkey($1) |
40 |
role $2 types setkey_t; |
41 |
') |
42 |
+ |
43 |
+######################################## |
44 |
+## <summary> |
45 |
+## All of the rules required to |
46 |
+## administrate an ipsec environment. |
47 |
+## </summary> |
48 |
+## <param name="domain"> |
49 |
+## <summary> |
50 |
+## Domain allowed access. |
51 |
+## </summary> |
52 |
+## </param> |
53 |
+## <param name="role"> |
54 |
+## <summary> |
55 |
+## Role allowed access. |
56 |
+## </summary> |
57 |
+## </param> |
58 |
+## <rolecap/> |
59 |
+# |
60 |
+interface(`ipsec_admin',` |
61 |
+ gen_require(` |
62 |
+ type ipsec_t, ipsec_initrc_exec_t, ipsec_conf_file_t; |
63 |
+ type ipsec_key_file_t, ipsec_log_t, ipsec_tmp_t; |
64 |
+ type ipsec_var_run_t, ipsec_mgmt_lock_t; |
65 |
+ type ipsec_mgmt_var_run_t, racoon_tmp_t; |
66 |
+ ') |
67 |
+ |
68 |
+ allow $1 ipsec_t:process { ptrace signal_perms }; |
69 |
+ ps_process_pattern($1, ipsec_t) |
70 |
+ |
71 |
+ init_startstop_service($1, $2, ipsec_t, ipsec_initrc_exec_t) |
72 |
+ |
73 |
+ ipsec_exec_mgmt($1) |
74 |
+ ipsec_stream_connect($1) |
75 |
+ # for lsof |
76 |
+ ipsec_getattr_key_sockets($1) |
77 |
+ |
78 |
+ files_search_etc($1) |
79 |
+ admin_pattern($1, { ipsec_conf_file_t ipsec_key_file_t }) |
80 |
+ |
81 |
+ files_search_tmp($1) |
82 |
+ admin_pattern($1, { ipsec_tmp_t racoon_tmp_t }) |
83 |
+ |
84 |
+ files_search_pids($1) |
85 |
+ admin_pattern($1, { ipsec_var_run_t ipsec_mgmt_var_run_t }) |
86 |
+ |
87 |
+ files_search_locks($1) |
88 |
+ admin_pattern($1, ipsec_mgmt_lock_t) |
89 |
+ |
90 |
+ logging_search_logs($1) |
91 |
+ admin_pattern($1, ipsec_log_t) |
92 |
+') |