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