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