]>
Commit | Line | Data |
---|---|---|
fe185d88 MG |
1 | policy_module(gruntmasterd, 1.0) |
2 | ||
da905f9e MG |
3 | define(`read_file_perms', `{ getattr ioctl read lock open }') |
4 | define(`read_dir_perms', `{ getattr ioctl read lock open search}') | |
5 | define(`everything_file_perms', `{ getattr ioctl read lock open unlink setattr append write create rename link }') | |
6 | define(`everything_dir_perms', `{ getattr ioctl read lock open search unlink setattr write create rename link rmdir remove_name reparent add_name }') | |
7 | define(`domain_read_files', `allow $1 $2 : dir read_dir_perms; allow $1 $2 : file read_file_perms; allow $1 $2 : lnk_file read_file_perms;') | |
8 | define(`domain_everything_files', `allow $1 $2 : dir everything_dir_perms; allow $1 $2 : file everything_file_perms; allow $1 $2 : lnk_file everything_file_perms;') | |
9 | define(`gruntmaster_read', `domain_read_files(gruntmasterd_t, $1)') | |
10 | define(`gruntmaster_everything', `domain_everything_files(gruntmasterd_t, $1)') | |
fe185d88 MG |
11 | |
12 | require{ | |
13 | type bin_t; | |
ac71312a | 14 | type http_port_t; |
fe185d88 MG |
15 | type httpd_sys_content_rw_t; |
16 | type httpd_sys_content_t; | |
17 | type httpd_t; | |
18 | type httpd_tmp_t; | |
ac71312a | 19 | type net_conf_t; |
3f07cf69 | 20 | type port_t; |
fe185d88 MG |
21 | type proc_t; |
22 | type urandom_device_t; | |
23 | } | |
5c5cd38a | 24 | |
da905f9e | 25 | # Types |
5c5cd38a | 26 | type gruntmasterd_t; |
3f07cf69 | 27 | type gruntmasterd_etc_t; |
5c5cd38a | 28 | type gruntmasterd_exec_t; |
5c5cd38a | 29 | type gruntmasterd_log_t; |
3f07cf69 | 30 | type gruntmasterd_tmp_t; |
8a8d1a82 | 31 | type gruntmasterd_var_lib_t; |
5c5cd38a MG |
32 | type gruntmaster_job_t; |
33 | type gruntmaster_job_exec_t; | |
da905f9e MG |
34 | type gruntmaster_compile_t; |
35 | type gruntmaster_compile_exec_t; | |
3f07cf69 MG |
36 | type gruntmaster_paged_t; |
37 | type gruntmaster_paged_exec_t; | |
da905f9e MG |
38 | |
39 | domain_type(gruntmaster_job_t) | |
40 | domain_entry_file(gruntmaster_job_t, gruntmaster_job_exec_t) | |
41 | role system_r types gruntmaster_job_t; | |
fe185d88 | 42 | |
da905f9e MG |
43 | domain_type(gruntmaster_compile_t) |
44 | domain_entry_file(gruntmaster_compile_t, gruntmaster_compile_exec_t) | |
45 | role system_r types gruntmaster_compile_t; | |
3f07cf69 MG |
46 | type_transition gruntmaster_compile_t gruntmasterd_tmp_t : file gruntmaster_job_exec_t; |
47 | ||
48 | init_daemon_domain(gruntmaster_paged_t, gruntmaster_paged_exec_t) | |
49 | type_transition gruntmaster_paged_t httpd_sys_content_t : { file dir } httpd_sys_content_rw_t; | |
fe185d88 | 50 | |
da905f9e MG |
51 | init_daemon_domain(gruntmasterd_t, gruntmasterd_exec_t) |
52 | logging_log_file(gruntmasterd_log_t) | |
53 | logging_log_filetrans(gruntmasterd_t, gruntmasterd_log_t, file) | |
54 | logging_search_logs(gruntmasterd_t) | |
3f07cf69 MG |
55 | type_transition gruntmasterd_t gruntmaster_compile_exec_t : process gruntmaster_compile_t; |
56 | type_transition gruntmasterd_t gruntmaster_job_exec_t : process gruntmaster_job_t; | |
57 | type_transition gruntmasterd_t tmp_t : dir gruntmasterd_tmp_t; | |
58 | files_type(gruntmasterd_tmp_t) | |
59 | files_type(gruntmasterd_etc_t) | |
8a8d1a82 | 60 | files_type(gruntmasterd_var_lib_t) |
da905f9e MG |
61 | |
62 | # Daemon permissions | |
63 | allow gruntmasterd_t { gruntmaster_compile_t gruntmaster_job_t } : process { sigkill siginh rlimitinh transition }; | |
64 | allow gruntmasterd_t bin_t : file { execute execute_no_trans }; | |
65 | allow gruntmasterd_t self : process fork; | |
66 | allow gruntmasterd_t self:fifo_file everything_file_perms; | |
67 | allow gruntmasterd_t urandom_device_t:chr_file read_file_perms; | |
68 | allow gruntmasterd_t { gruntmaster_compile_exec_t gruntmaster_job_exec_t } : file execute; | |
3f07cf69 | 69 | allow gruntmasterd_t port_t:tcp_socket name_connect; |
ac71312a MG |
70 | allow gruntmasterd_t http_port_t:tcp_socket name_connect; |
71 | allow gruntmasterd_t net_conf_t:file { read getattr open }; | |
72 | allow gruntmasterd_t self:udp_socket { write read create connect getattr }; | |
3f07cf69 | 73 | allow gruntmasterd_t self:tcp_socket { read write create ioctl connect }; |
da905f9e | 74 | dontaudit gruntmasterd_t { gruntmaster_compile_t gruntmaster_job_t } : process noatsecure; |
5c5cd38a | 75 | |
3f07cf69 MG |
76 | allow gruntmasterd_t tmp_t : dir { getattr write search add_name }; |
77 | ||
fe185d88 | 78 | gruntmaster_read(bin_t) |
da905f9e | 79 | gruntmaster_read(gruntmaster_compile_exec_t) |
3f07cf69 | 80 | gruntmaster_read(gruntmasterd_etc_t) |
8a8d1a82 | 81 | gruntmaster_read(gruntmasterd_var_lib_t) |
3f07cf69 | 82 | gruntmaster_read(gruntmaster_job_exec_t) |
da905f9e | 83 | gruntmaster_read(httpd_sys_content_t) |
fe185d88 | 84 | gruntmaster_read(lib_t) |
da905f9e | 85 | gruntmaster_read(proc_t) |
fe185d88 | 86 | gruntmaster_read(usr_t) |
fe185d88 | 87 | |
da905f9e | 88 | gruntmaster_everything(gruntmasterd_log_t) |
3f07cf69 | 89 | gruntmaster_everything(gruntmasterd_tmp_t) |
fe185d88 | 90 | |
da905f9e MG |
91 | files_read_etc_files(gruntmasterd_t) |
92 | files_search_etc(gruntmasterd_t) | |
93 | libs_use_ld_so(gruntmasterd_t) | |
94 | libs_use_shared_libs(gruntmasterd_t) | |
95 | miscfiles_read_localization(gruntmasterd_t) | |
5c5cd38a | 96 | |
da905f9e MG |
97 | # Executor and job permissions |
98 | domain_read_files(gruntmaster_job_t, bin_t) | |
99 | domain_read_files(gruntmaster_job_t, usr_t) | |
100 | allow gruntmaster_job_t gruntmaster_job_exec_t : file { execute execute_no_trans }; | |
101 | allow gruntmaster_job_t gruntmasterd_t:fd use; | |
102 | allow gruntmaster_job_t gruntmasterd_t:process sigchld; | |
3f07cf69 MG |
103 | allow gruntmaster_job_t gruntmasterd_tmp_t : dir read_dir_perms; |
104 | allow gruntmaster_job_t gruntmasterd_tmp_t : file { getattr ioctl read write }; | |
da905f9e MG |
105 | allow gruntmaster_job_t init_t:fd use; |
106 | allow gruntmaster_job_t self:process setrlimit; | |
107 | allow gruntmaster_job_t urandom_device_t:chr_file read_file_perms; | |
5c5cd38a | 108 | |
fe185d88 | 109 | libs_use_ld_so(gruntmaster_job_t) |
fe185d88 | 110 | libs_use_shared_libs(gruntmaster_job_t) |
fe185d88 MG |
111 | miscfiles_read_localization(gruntmaster_job_t) |
112 | ||
da905f9e MG |
113 | # Compile permissions |
114 | domain_everything_files(gruntmaster_compile_t, gruntmaster_job_exec_t) | |
115 | domain_everything_files(gruntmaster_compile_t, tmp_t) | |
116 | domain_read_files(gruntmaster_compile_t, bin_t) | |
da905f9e MG |
117 | domain_read_files(gruntmaster_compile_t, lib_t) |
118 | domain_read_files(gruntmaster_compile_t, proc_t) | |
119 | domain_read_files(gruntmaster_compile_t, proc_t) | |
120 | domain_read_files(gruntmaster_compile_t, usr_t) | |
3f07cf69 | 121 | domain_read_files(gruntmaster_compile_t, gruntmasterd_tmp_t) |
da905f9e MG |
122 | allow gruntmaster_compile_t gruntmasterd_t : fifo_file { read write ioctl }; |
123 | allow gruntmaster_compile_t gruntmasterd_t:fd use; | |
124 | allow gruntmaster_compile_t gruntmasterd_t:process sigchld; | |
3f07cf69 | 125 | allow gruntmaster_compile_t gruntmasterd_tmp_t:dir { write add_name }; |
da905f9e MG |
126 | allow gruntmaster_compile_t self : fifo_file { read write ioctl }; |
127 | allow gruntmaster_compile_t self:process signal; | |
128 | allow gruntmaster_compile_t urandom_device_t:chr_file read_file_perms; | |
129 | allow gruntmaster_compile_t { bin_t lib_t } : file { execute execute_no_trans }; | |
130 | ||
131 | libs_use_ld_so(gruntmaster_compile_t) | |
132 | libs_use_shared_libs(gruntmaster_compile_t) | |
133 | miscfiles_read_localization(gruntmaster_compile_t) | |
3f07cf69 MG |
134 | |
135 | # Page generator permissions | |
136 | domain_everything_files(gruntmaster_paged_t, httpd_sys_content_rw_t) | |
137 | domain_read_files(gruntmaster_paged_t, usr_t) | |
138 | domain_read_files(gruntmaster_paged_t, bin_t) | |
139 | allow gruntmaster_paged_t urandom_device_t:chr_file read_file_perms; | |
140 | allow gruntmaster_paged_t port_t:tcp_socket name_connect; | |
141 | allow gruntmaster_paged_t self:tcp_socket { read write create ioctl connect }; | |
142 | ||
143 | libs_use_ld_so(gruntmaster_paged_t) | |
144 | libs_use_shared_libs(gruntmaster_paged_t) | |
145 | miscfiles_read_localization(gruntmaster_paged_t) |