Fix test failure introduced several commits ago
[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;
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 26type gruntmasterd_t;
3f07cf69 27type gruntmasterd_etc_t;
5c5cd38a 28type gruntmasterd_exec_t;
5c5cd38a 29type gruntmasterd_log_t;
3f07cf69 30type gruntmasterd_tmp_t;
8a8d1a82 31type gruntmasterd_var_lib_t;
5c5cd38a
MG
32type gruntmaster_job_t;
33type gruntmaster_job_exec_t;
da905f9e
MG
34type gruntmaster_compile_t;
35type gruntmaster_compile_exec_t;
3f07cf69
MG
36type gruntmaster_paged_t;
37type gruntmaster_paged_exec_t;
da905f9e
MG
38
39domain_type(gruntmaster_job_t)
40domain_entry_file(gruntmaster_job_t, gruntmaster_job_exec_t)
41role system_r types gruntmaster_job_t;
fe185d88 42
da905f9e
MG
43domain_type(gruntmaster_compile_t)
44domain_entry_file(gruntmaster_compile_t, gruntmaster_compile_exec_t)
45role system_r types gruntmaster_compile_t;
3f07cf69
MG
46type_transition gruntmaster_compile_t gruntmasterd_tmp_t : file gruntmaster_job_exec_t;
47
48init_daemon_domain(gruntmaster_paged_t, gruntmaster_paged_exec_t)
49type_transition gruntmaster_paged_t httpd_sys_content_t : { file dir } httpd_sys_content_rw_t;
fe185d88 50
da905f9e
MG
51init_daemon_domain(gruntmasterd_t, gruntmasterd_exec_t)
52logging_log_file(gruntmasterd_log_t)
53logging_log_filetrans(gruntmasterd_t, gruntmasterd_log_t, file)
54logging_search_logs(gruntmasterd_t)
3f07cf69
MG
55type_transition gruntmasterd_t gruntmaster_compile_exec_t : process gruntmaster_compile_t;
56type_transition gruntmasterd_t gruntmaster_job_exec_t : process gruntmaster_job_t;
57type_transition gruntmasterd_t tmp_t : dir gruntmasterd_tmp_t;
58files_type(gruntmasterd_tmp_t)
59files_type(gruntmasterd_etc_t)
8a8d1a82 60files_type(gruntmasterd_var_lib_t)
da905f9e
MG
61
62# Daemon permissions
63allow gruntmasterd_t { gruntmaster_compile_t gruntmaster_job_t } : process { sigkill siginh rlimitinh transition };
64allow gruntmasterd_t bin_t : file { execute execute_no_trans };
65allow gruntmasterd_t self : process fork;
66allow gruntmasterd_t self:fifo_file everything_file_perms;
67allow gruntmasterd_t urandom_device_t:chr_file read_file_perms;
68allow gruntmasterd_t { gruntmaster_compile_exec_t gruntmaster_job_exec_t } : file execute;
3f07cf69 69allow gruntmasterd_t port_t:tcp_socket name_connect;
ac71312a
MG
70allow gruntmasterd_t http_port_t:tcp_socket name_connect;
71allow gruntmasterd_t net_conf_t:file { read getattr open };
72allow gruntmasterd_t self:udp_socket { write read create connect getattr };
3f07cf69 73allow gruntmasterd_t self:tcp_socket { read write create ioctl connect };
da905f9e 74dontaudit gruntmasterd_t { gruntmaster_compile_t gruntmaster_job_t } : process noatsecure;
5c5cd38a 75
3f07cf69
MG
76allow gruntmasterd_t tmp_t : dir { getattr write search add_name };
77
fe185d88 78gruntmaster_read(bin_t)
da905f9e 79gruntmaster_read(gruntmaster_compile_exec_t)
3f07cf69 80gruntmaster_read(gruntmasterd_etc_t)
8a8d1a82 81gruntmaster_read(gruntmasterd_var_lib_t)
3f07cf69 82gruntmaster_read(gruntmaster_job_exec_t)
da905f9e 83gruntmaster_read(httpd_sys_content_t)
fe185d88 84gruntmaster_read(lib_t)
da905f9e 85gruntmaster_read(proc_t)
fe185d88 86gruntmaster_read(usr_t)
fe185d88 87
da905f9e 88gruntmaster_everything(gruntmasterd_log_t)
3f07cf69 89gruntmaster_everything(gruntmasterd_tmp_t)
fe185d88 90
da905f9e
MG
91files_read_etc_files(gruntmasterd_t)
92files_search_etc(gruntmasterd_t)
93libs_use_ld_so(gruntmasterd_t)
94libs_use_shared_libs(gruntmasterd_t)
95miscfiles_read_localization(gruntmasterd_t)
5c5cd38a 96
da905f9e
MG
97# Executor and job permissions
98domain_read_files(gruntmaster_job_t, bin_t)
99domain_read_files(gruntmaster_job_t, usr_t)
100allow gruntmaster_job_t gruntmaster_job_exec_t : file { execute execute_no_trans };
101allow gruntmaster_job_t gruntmasterd_t:fd use;
102allow gruntmaster_job_t gruntmasterd_t:process sigchld;
3f07cf69
MG
103allow gruntmaster_job_t gruntmasterd_tmp_t : dir read_dir_perms;
104allow gruntmaster_job_t gruntmasterd_tmp_t : file { getattr ioctl read write };
da905f9e
MG
105allow gruntmaster_job_t init_t:fd use;
106allow gruntmaster_job_t self:process setrlimit;
107allow gruntmaster_job_t urandom_device_t:chr_file read_file_perms;
5c5cd38a 108
fe185d88 109libs_use_ld_so(gruntmaster_job_t)
fe185d88 110libs_use_shared_libs(gruntmaster_job_t)
fe185d88
MG
111miscfiles_read_localization(gruntmaster_job_t)
112
da905f9e
MG
113# Compile permissions
114domain_everything_files(gruntmaster_compile_t, gruntmaster_job_exec_t)
115domain_everything_files(gruntmaster_compile_t, tmp_t)
116domain_read_files(gruntmaster_compile_t, bin_t)
da905f9e
MG
117domain_read_files(gruntmaster_compile_t, lib_t)
118domain_read_files(gruntmaster_compile_t, proc_t)
119domain_read_files(gruntmaster_compile_t, proc_t)
120domain_read_files(gruntmaster_compile_t, usr_t)
3f07cf69 121domain_read_files(gruntmaster_compile_t, gruntmasterd_tmp_t)
da905f9e
MG
122allow gruntmaster_compile_t gruntmasterd_t : fifo_file { read write ioctl };
123allow gruntmaster_compile_t gruntmasterd_t:fd use;
124allow gruntmaster_compile_t gruntmasterd_t:process sigchld;
3f07cf69 125allow gruntmaster_compile_t gruntmasterd_tmp_t:dir { write add_name };
da905f9e
MG
126allow gruntmaster_compile_t self : fifo_file { read write ioctl };
127allow gruntmaster_compile_t self:process signal;
128allow gruntmaster_compile_t urandom_device_t:chr_file read_file_perms;
129allow gruntmaster_compile_t { bin_t lib_t } : file { execute execute_no_trans };
130
131libs_use_ld_so(gruntmaster_compile_t)
132libs_use_shared_libs(gruntmaster_compile_t)
133miscfiles_read_localization(gruntmaster_compile_t)
3f07cf69
MG
134
135# Page generator permissions
136domain_everything_files(gruntmaster_paged_t, httpd_sys_content_rw_t)
137domain_read_files(gruntmaster_paged_t, usr_t)
138domain_read_files(gruntmaster_paged_t, bin_t)
139allow gruntmaster_paged_t urandom_device_t:chr_file read_file_perms;
140allow gruntmaster_paged_t port_t:tcp_socket name_connect;
141allow gruntmaster_paged_t self:tcp_socket { read write create ioctl connect };
142
143libs_use_ld_so(gruntmaster_paged_t)
144libs_use_shared_libs(gruntmaster_paged_t)
145miscfiles_read_localization(gruntmaster_paged_t)
This page took 0.048451 seconds and 4 git commands to generate.