Fix test failure introduced several commits ago
[gruntmaster-daemon.git] / selinux / gruntmasterd.te
1 policy_module(gruntmasterd, 1.0)
2
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)')
11
12 require{
13 type bin_t;
14 type http_port_t;
15 type httpd_sys_content_rw_t;
16 type httpd_sys_content_t;
17 type httpd_t;
18 type httpd_tmp_t;
19 type net_conf_t;
20 type port_t;
21 type proc_t;
22 type urandom_device_t;
23 }
24
25 # Types
26 type gruntmasterd_t;
27 type gruntmasterd_etc_t;
28 type gruntmasterd_exec_t;
29 type gruntmasterd_log_t;
30 type gruntmasterd_tmp_t;
31 type gruntmasterd_var_lib_t;
32 type gruntmaster_job_t;
33 type gruntmaster_job_exec_t;
34 type gruntmaster_compile_t;
35 type gruntmaster_compile_exec_t;
36 type gruntmaster_paged_t;
37 type gruntmaster_paged_exec_t;
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;
42
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;
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;
50
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)
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)
60 files_type(gruntmasterd_var_lib_t)
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;
69 allow gruntmasterd_t port_t:tcp_socket name_connect;
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 };
73 allow gruntmasterd_t self:tcp_socket { read write create ioctl connect };
74 dontaudit gruntmasterd_t { gruntmaster_compile_t gruntmaster_job_t } : process noatsecure;
75
76 allow gruntmasterd_t tmp_t : dir { getattr write search add_name };
77
78 gruntmaster_read(bin_t)
79 gruntmaster_read(gruntmaster_compile_exec_t)
80 gruntmaster_read(gruntmasterd_etc_t)
81 gruntmaster_read(gruntmasterd_var_lib_t)
82 gruntmaster_read(gruntmaster_job_exec_t)
83 gruntmaster_read(httpd_sys_content_t)
84 gruntmaster_read(lib_t)
85 gruntmaster_read(proc_t)
86 gruntmaster_read(usr_t)
87
88 gruntmaster_everything(gruntmasterd_log_t)
89 gruntmaster_everything(gruntmasterd_tmp_t)
90
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)
96
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;
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 };
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;
108
109 libs_use_ld_so(gruntmaster_job_t)
110 libs_use_shared_libs(gruntmaster_job_t)
111 miscfiles_read_localization(gruntmaster_job_t)
112
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)
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)
121 domain_read_files(gruntmaster_compile_t, gruntmasterd_tmp_t)
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;
125 allow gruntmaster_compile_t gruntmasterd_tmp_t:dir { write add_name };
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)
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)
This page took 0.056161 seconds and 4 git commands to generate.