| 1 |
## <summary>policy for cockpit</summary> |
| 2 |
|
| 3 |
######################################## |
| 4 |
## <summary> |
| 5 |
## Execute TEMPLATE in the cockpit domin. |
| 6 |
## </summary> |
| 7 |
## <param name="domain"> |
| 8 |
## <summary> |
| 9 |
## Domain allowed to transition. |
| 10 |
## </summary> |
| 11 |
## </param> |
| 12 |
# |
| 13 |
interface(`cockpit_ws_domtrans',` |
| 14 |
gen_require(` |
| 15 |
type cockpit_ws_t, cockpit_ws_exec_t; |
| 16 |
') |
| 17 |
|
| 18 |
corecmd_search_bin($1) |
| 19 |
domtrans_pattern($1, cockpit_ws_exec_t, cockpit_ws_t) |
| 20 |
') |
| 21 |
|
| 22 |
######################################## |
| 23 |
## <summary> |
| 24 |
## Execute TEMPLATE in the cockpit domin. |
| 25 |
## </summary> |
| 26 |
## <param name="domain"> |
| 27 |
## <summary> |
| 28 |
## Domain allowed to transition. |
| 29 |
## </summary> |
| 30 |
## </param> |
| 31 |
# |
| 32 |
interface(`cockpit_session_domtrans',` |
| 33 |
gen_require(` |
| 34 |
type cockpit_session_t, cockpit_session_exec_t; |
| 35 |
') |
| 36 |
|
| 37 |
corecmd_search_bin($1) |
| 38 |
domtrans_pattern($1, cockpit_session_exec_t, cockpit_session_t) |
| 39 |
') |
| 40 |
|
| 41 |
######################################## |
| 42 |
## <summary> |
| 43 |
## Read and write cockpit_session_t unnamed pipes. |
| 44 |
## </summary> |
| 45 |
## <param name="domain"> |
| 46 |
## <summary> |
| 47 |
## Domain allowed access. |
| 48 |
## </summary> |
| 49 |
## </param> |
| 50 |
# |
| 51 |
interface(`cockpit_rw_pipes',` |
| 52 |
gen_require(` |
| 53 |
type cockpit_session_t; |
| 54 |
') |
| 55 |
|
| 56 |
allow $1 cockpit_session_t:fifo_file rw_fifo_file_perms; |
| 57 |
') |
| 58 |
|
| 59 |
######################################## |
| 60 |
## <summary> |
| 61 |
## Create cockpit unix_stream_sockets. |
| 62 |
## </summary> |
| 63 |
## <param name="domain"> |
| 64 |
## <summary> |
| 65 |
## Domain allowed access. |
| 66 |
## </summary> |
| 67 |
## </param> |
| 68 |
# |
| 69 |
interface(`cockpit_manage_unix_stream_sockets',` |
| 70 |
gen_require(` |
| 71 |
type cockpit_ws_t; |
| 72 |
') |
| 73 |
|
| 74 |
allow $1 cockpit_ws_t:unix_stream_socket { create_stream_socket_perms connectto }; |
| 75 |
') |
| 76 |
|
| 77 |
######################################## |
| 78 |
## <summary> |
| 79 |
## Search cockpit lib directories. |
| 80 |
## </summary> |
| 81 |
## <param name="domain"> |
| 82 |
## <summary> |
| 83 |
## Domain allowed access. |
| 84 |
## </summary> |
| 85 |
## </param> |
| 86 |
# |
| 87 |
interface(`cockpit_search_lib',` |
| 88 |
gen_require(` |
| 89 |
type cockpit_var_lib_t; |
| 90 |
') |
| 91 |
|
| 92 |
allow $1 cockpit_var_lib_t:dir search_dir_perms; |
| 93 |
files_search_var_lib($1) |
| 94 |
') |
| 95 |
|
| 96 |
######################################## |
| 97 |
## <summary> |
| 98 |
## Read cockpit lib files. |
| 99 |
## </summary> |
| 100 |
## <param name="domain"> |
| 101 |
## <summary> |
| 102 |
## Domain allowed access. |
| 103 |
## </summary> |
| 104 |
## </param> |
| 105 |
# |
| 106 |
interface(`cockpit_read_lib_files',` |
| 107 |
gen_require(` |
| 108 |
type cockpit_var_lib_t; |
| 109 |
') |
| 110 |
|
| 111 |
files_search_var_lib($1) |
| 112 |
read_files_pattern($1, cockpit_var_lib_t, cockpit_var_lib_t) |
| 113 |
') |
| 114 |
|
| 115 |
######################################## |
| 116 |
## <summary> |
| 117 |
## Manage cockpit lib files. |
| 118 |
## </summary> |
| 119 |
## <param name="domain"> |
| 120 |
## <summary> |
| 121 |
## Domain allowed access. |
| 122 |
## </summary> |
| 123 |
## </param> |
| 124 |
# |
| 125 |
interface(`cockpit_manage_lib_files',` |
| 126 |
gen_require(` |
| 127 |
type cockpit_var_lib_t; |
| 128 |
') |
| 129 |
|
| 130 |
files_search_var_lib($1) |
| 131 |
manage_files_pattern($1, cockpit_var_lib_t, cockpit_var_lib_t) |
| 132 |
') |
| 133 |
|
| 134 |
######################################## |
| 135 |
## <summary> |
| 136 |
## Manage cockpit lib directories. |
| 137 |
## </summary> |
| 138 |
## <param name="domain"> |
| 139 |
## <summary> |
| 140 |
## Domain allowed access. |
| 141 |
## </summary> |
| 142 |
## </param> |
| 143 |
# |
| 144 |
interface(`cockpit_manage_lib_dirs',` |
| 145 |
gen_require(` |
| 146 |
type cockpit_var_lib_t; |
| 147 |
') |
| 148 |
|
| 149 |
files_search_var_lib($1) |
| 150 |
manage_dirs_pattern($1, cockpit_var_lib_t, cockpit_var_lib_t) |
| 151 |
') |
| 152 |
|
| 153 |
######################################## |
| 154 |
## <summary> |
| 155 |
## Read cockpit pid files. |
| 156 |
## </summary> |
| 157 |
## <param name="domain"> |
| 158 |
## <summary> |
| 159 |
## Domain allowed access. |
| 160 |
## </summary> |
| 161 |
## </param> |
| 162 |
# |
| 163 |
interface(`cockpit_read_pid_files',` |
| 164 |
gen_require(` |
| 165 |
type cockpit_var_run_t; |
| 166 |
') |
| 167 |
|
| 168 |
read_files_pattern($1, cockpit_var_run_t, cockpit_var_run_t) |
| 169 |
read_lnk_files_pattern($1, cockpit_var_run_t, cockpit_var_run_t) |
| 170 |
') |
| 171 |
|
| 172 |
######################################## |
| 173 |
## <summary> |
| 174 |
## Manage cockpit pid dirs. |
| 175 |
## </summary> |
| 176 |
## <param name="domain"> |
| 177 |
## <summary> |
| 178 |
## Domain allowed access. |
| 179 |
## </summary> |
| 180 |
## </param> |
| 181 |
# |
| 182 |
interface(`cockpit_manage_pid_dirs',` |
| 183 |
gen_require(` |
| 184 |
type cockpit_var_run_t; |
| 185 |
') |
| 186 |
|
| 187 |
manage_dirs_pattern($1, cockpit_var_run_t, cockpit_var_run_t) |
| 188 |
') |
| 189 |
|
| 190 |
######################################## |
| 191 |
## <summary> |
| 192 |
## Manage cockpit pid dirs. |
| 193 |
## </summary> |
| 194 |
## <param name="domain"> |
| 195 |
## <summary> |
| 196 |
## Domain allowed access. |
| 197 |
## </summary> |
| 198 |
## </param> |
| 199 |
# |
| 200 |
interface(`cockpit_manage_pid_files',` |
| 201 |
gen_require(` |
| 202 |
type cockpit_var_run_t; |
| 203 |
') |
| 204 |
|
| 205 |
manage_files_pattern($1, cockpit_var_run_t, cockpit_var_run_t) |
| 206 |
') |
| 207 |
|
| 208 |
######################################## |
| 209 |
## <summary> |
| 210 |
## Execute cockpit server in the cockpit domain. |
| 211 |
## </summary> |
| 212 |
## <param name="domain"> |
| 213 |
## <summary> |
| 214 |
## Domain allowed to transition. |
| 215 |
## </summary> |
| 216 |
## </param> |
| 217 |
# |
| 218 |
interface(`cockpit_systemctl',` |
| 219 |
gen_require(` |
| 220 |
type cockpit_ws_t; |
| 221 |
type cockpit_unit_file_t; |
| 222 |
') |
| 223 |
|
| 224 |
systemd_exec_systemctl($1) |
| 225 |
init_reload_services($1) |
| 226 |
systemd_read_fifo_file_passwd_run($1) |
| 227 |
allow $1 cockpit_unit_file_t:file read_file_perms; |
| 228 |
allow $1 cockpit_unit_file_t:service manage_service_perms; |
| 229 |
|
| 230 |
ps_process_pattern($1, cockpit_ws_t) |
| 231 |
') |
| 232 |
|
| 233 |
|
| 234 |
######################################## |
| 235 |
## <summary> |
| 236 |
## All of the rules required to administrate |
| 237 |
## an cockpit environment |
| 238 |
## </summary> |
| 239 |
## <param name="domain"> |
| 240 |
## <summary> |
| 241 |
## Domain allowed access. |
| 242 |
## </summary> |
| 243 |
## </param> |
| 244 |
## <rolecap/> |
| 245 |
# |
| 246 |
interface(`cockpit_admin',` |
| 247 |
gen_require(` |
| 248 |
type cockpit_ws_t; |
| 249 |
type cockpit_session_t; |
| 250 |
type cockpit_var_lib_t; |
| 251 |
type cockpit_var_run_t; |
| 252 |
type cockpit_unit_file_t; |
| 253 |
') |
| 254 |
|
| 255 |
allow $1 cockpit_ws_t:process { signal_perms }; |
| 256 |
ps_process_pattern($1, cockpit_ws_t) |
| 257 |
|
| 258 |
allow $1 cockpit_session_t:process { signal_perms }; |
| 259 |
ps_process_pattern($1, cockpit_session_t) |
| 260 |
|
| 261 |
tunable_policy(`deny_ptrace',`',` |
| 262 |
allow $1 cockpit_ws_t:process ptrace; |
| 263 |
allow $1 cockpit_session_t:process ptrace; |
| 264 |
') |
| 265 |
|
| 266 |
files_search_var_lib($1) |
| 267 |
admin_pattern($1, cockpit_var_lib_t) |
| 268 |
|
| 269 |
files_search_pids($1) |
| 270 |
admin_pattern($1, cockpit_var_run_t) |
| 271 |
|
| 272 |
cockpit_systemctl($1) |
| 273 |
admin_pattern($1, cockpit_unit_file_t) |
| 274 |
allow $1 cockpit_unit_file_t:service all_service_perms; |
| 275 |
optional_policy(` |
| 276 |
systemd_passwd_agent_exec($1) |
| 277 |
systemd_read_fifo_file_passwd_run($1) |
| 278 |
') |
| 279 |
') |