File selinux/rocketgit.te.tmpl changed (mode: 100644) (index 303d90a..b479288) |
1 |
|
policy_module(rocketgit,1.0.119) |
|
2 |
|
|
|
3 |
|
######################################## |
|
4 |
|
# |
|
5 |
|
# Declarations |
|
6 |
|
# |
|
|
1 |
|
policy_module(rocketgit,1.0.154) |
7 |
2 |
|
|
8 |
3 |
gen_require(` |
gen_require(` |
9 |
|
# really needed httpd_log_t? |
|
10 |
4 |
type httpd_t; |
type httpd_t; |
11 |
|
type httpd_log_t; |
|
12 |
|
type httpd_unit_file_t; |
|
13 |
|
type system_mail_t; |
|
|
5 |
|
type httpd_exec_t; |
14 |
6 |
type unconfined_t; |
type unconfined_t; |
15 |
7 |
role unconfined_r; |
role unconfined_r; |
16 |
8 |
type fs_t; |
type fs_t; |
17 |
9 |
type sshd_t; |
type sshd_t; |
18 |
|
# next are for worker.sh |
|
19 |
|
#class dir mounton; |
|
20 |
|
#class filesystem { getattr mount unmount }; |
|
21 |
|
#class capability { setgid setuid sys_admin }; |
|
22 |
10 |
|
|
23 |
11 |
@@EXTRA_GEN_REQUIRE@@ |
@@EXTRA_GEN_REQUIRE@@ |
24 |
12 |
') |
') |
|
... |
... |
corenet_tcp_bind_all_nodes(rocketgit_t) |
81 |
69 |
###allow rocketgit_t node_t:tcp_socket node_bind; |
###allow rocketgit_t node_t:tcp_socket node_bind; |
82 |
70 |
sysnet_dns_name_resolve(rocketgit_t) |
sysnet_dns_name_resolve(rocketgit_t) |
83 |
71 |
|
|
84 |
|
# builder.php: |
|
85 |
|
#type=AVC msg=audit(1467841975.578:232307): avc: denied { listen } for pid=21318 comm="php" lport=65000 scontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tcontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tclass=tcp_socket permissive=1 |
|
86 |
|
#type=AVC msg=audit(1467841975.808:232308): avc: denied { dac_override } for pid=21319 comm="php" capability=1 scontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tcontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tclass=capability permissive=1 |
|
87 |
|
#type=AVC msg=audit(1467841975.809:232309): avc: denied { fowner } for pid=21319 comm="php" capability=3 scontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tcontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tclass=capability permissive=1 |
|
88 |
|
#type=AVC msg=audit(1467841975.809:232310): avc: denied { fsetid } for pid=21319 comm="php" capability=4 scontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tcontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tclass=capability permissive=1 |
|
89 |
|
#type=AVC msg=audit(1467841975.949:232311): avc: denied { accept } for pid=21318 comm="php" lport=65000 scontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tcontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tclass=tcp_socket permissive=1 |
|
90 |
|
allow rocketgit_t self:capability { dac_override fowner fsetid }; |
|
91 |
|
allow rocketgit_t self:tcp_socket { accept listen }; |
|
|
72 |
|
|
|
73 |
|
# Allow contacting systemd |
|
74 |
|
# type=AVC msg=audit(1485816659.452:676453): avc: denied { sendto } for pid=26711 comm="php-fpm" path="/run/systemd/notify" scontext=system_u:system_r:rocketgit_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=unix_dgram_socket permissive=1 |
|
75 |
|
###kernel_dgram_send(rocketgit_t) |
|
76 |
|
|
|
77 |
|
# Allow php-fpm to write its pid |
|
78 |
|
###init_write_pid_socket(rocketgit_t) |
92 |
79 |
|
|
93 |
80 |
# Allow basic access to net |
# Allow basic access to net |
94 |
81 |
sysnet_read_config(rocketgit_t) |
sysnet_read_config(rocketgit_t) |
|
... |
... |
files_type(rocketgit_usr_t) |
104 |
91 |
read_files_pattern(rocketgit_t, rocketgit_usr_t, rocketgit_usr_t) |
read_files_pattern(rocketgit_t, rocketgit_usr_t, rocketgit_usr_t) |
105 |
92 |
exec_files_pattern(rocketgit_t, rocketgit_usr_t, rocketgit_usr_t) |
exec_files_pattern(rocketgit_t, rocketgit_usr_t, rocketgit_usr_t) |
106 |
93 |
list_dirs_pattern(rocketgit_t, rocketgit_usr_t, rocketgit_usr_t) |
list_dirs_pattern(rocketgit_t, rocketgit_usr_t, rocketgit_usr_t) |
107 |
|
read_files_pattern(httpd_t, rocketgit_usr_t, rocketgit_usr_t) |
|
108 |
94 |
|
|
109 |
95 |
|
|
110 |
96 |
# log files |
# log files |
111 |
97 |
type rocketgit_log_t; |
type rocketgit_log_t; |
112 |
98 |
files_type(rocketgit_log_t) |
files_type(rocketgit_log_t) |
113 |
99 |
manage_files_pattern(rocketgit_t, rocketgit_log_t, rocketgit_log_t) |
manage_files_pattern(rocketgit_t, rocketgit_log_t, rocketgit_log_t) |
114 |
|
# Allow httpd(php-fpm) to create log files - note that it will run as |
|
115 |
|
# 'rocketgit' user. |
|
116 |
|
manage_files_pattern(httpd_t, rocketgit_log_t, rocketgit_log_t) |
|
117 |
100 |
logging_log_filetrans(rocketgit_t, rocketgit_log_t, file) |
logging_log_filetrans(rocketgit_t, rocketgit_log_t, file) |
118 |
101 |
|
|
119 |
102 |
|
|
|
... |
... |
type rocketgit_var_t; |
122 |
105 |
files_type(rocketgit_var_t) |
files_type(rocketgit_var_t) |
123 |
106 |
admin_pattern(rocketgit_t, rocketgit_var_t, rocketgit_var_t) |
admin_pattern(rocketgit_t, rocketgit_var_t, rocketgit_var_t) |
124 |
107 |
filetrans_pattern(rocketgit_t, rocketgit_var_t, rocketgit_var_t, { file dir }) |
filetrans_pattern(rocketgit_t, rocketgit_var_t, rocketgit_var_t, { file dir }) |
125 |
|
read_files_pattern(httpd_t, rocketgit_var_t, rocketgit_var_t) |
|
126 |
|
list_dirs_pattern(httpd_t, rocketgit_var_t, rocketgit_var_t) |
|
127 |
108 |
|
|
128 |
109 |
|
|
129 |
110 |
# sockets |
# sockets |
|
... |
... |
type rocketgit_socket_t; |
131 |
112 |
files_type(rocketgit_socket_t) |
files_type(rocketgit_socket_t) |
132 |
113 |
manage_sock_files_pattern(rocketgit_t, rocketgit_socket_t, rocketgit_socket_t) |
manage_sock_files_pattern(rocketgit_t, rocketgit_socket_t, rocketgit_socket_t) |
133 |
114 |
filetrans_pattern(rocketgit_t, rocketgit_socket_t, rocketgit_socket_t, file) |
filetrans_pattern(rocketgit_t, rocketgit_socket_t, rocketgit_socket_t, file) |
134 |
|
rw_sock_files_pattern(httpd_t, rocketgit_socket_t, rocketgit_socket_t) |
|
135 |
|
# Allow httpd to connect to _domain_ rocketgit_t for event.sock |
|
136 |
|
allow httpd_t rocketgit_t:unix_stream_socket connectto; |
|
137 |
115 |
|
|
138 |
116 |
|
|
139 |
117 |
# locks |
# locks |
|
... |
... |
type rocketgit_lock_t; |
141 |
119 |
files_lock_file(rocketgit_lock_t) |
files_lock_file(rocketgit_lock_t) |
142 |
120 |
manage_files_pattern(rocketgit_t, rocketgit_lock_t, rocketgit_lock_t) |
manage_files_pattern(rocketgit_t, rocketgit_lock_t, rocketgit_lock_t) |
143 |
121 |
filetrans_pattern(rocketgit_t, rocketgit_lock_t, rocketgit_lock_t, file) |
filetrans_pattern(rocketgit_t, rocketgit_lock_t, rocketgit_lock_t, file) |
144 |
|
# we need php-fpm to be able to take locks |
|
145 |
|
manage_files_pattern(httpd_t, rocketgit_lock_t, rocketgit_lock_t) |
|
146 |
|
filetrans_pattern(httpd_t, rocketgit_lock_t, rocketgit_lock_t, file) |
|
147 |
122 |
|
|
148 |
123 |
|
|
149 |
124 |
# conf |
# conf |
|
... |
... |
type rocketgit_conf_t; |
151 |
126 |
files_type(rocketgit_conf_t) |
files_type(rocketgit_conf_t) |
152 |
127 |
read_files_pattern(rocketgit_t, rocketgit_conf_t, rocketgit_conf_t) |
read_files_pattern(rocketgit_t, rocketgit_conf_t, rocketgit_conf_t) |
153 |
128 |
filetrans_pattern(rocketgit_t, rocketgit_conf_t, rocketgit_conf_t, file) |
filetrans_pattern(rocketgit_t, rocketgit_conf_t, rocketgit_conf_t, file) |
154 |
|
read_files_pattern(httpd_t, rocketgit_conf_t, rocketgit_conf_t) |
|
155 |
129 |
|
|
156 |
130 |
|
|
157 |
131 |
# Permit PHP to use nscd socket |
# Permit PHP to use nscd socket |
|
... |
... |
miscfiles_read_localization(rocketgit_t) |
189 |
163 |
files_list_tmp(rocketgit_t) |
files_list_tmp(rocketgit_t) |
190 |
164 |
|
|
191 |
165 |
# Hugetlbfs (for opcache): |
# Hugetlbfs (for opcache): |
192 |
|
# type=AVC msg=audit(1482069602.067:865): avc: denied { read write } for pid=2157 comm="php" path=2F616E6F6E5F6875676570616765202864656C6574656429 dev="hugetlbfs" ino=26965 scontext=system_u:system_r:rocketgit_t:s0-s0:c0.c1023 tcontext=system_u:object_r:hugetlbfs_t:s0 tclass=file permissive=0 |
|
193 |
166 |
fs_rw_hugetlbfs_files(rocketgit_t) |
fs_rw_hugetlbfs_files(rocketgit_t) |
194 |
167 |
fs_exec_hugetlbfs_files(rocketgit_t) |
fs_exec_hugetlbfs_files(rocketgit_t) |
195 |
|
allow rocketgit_t self:process execmem; |
|
196 |
168 |
|
|
197 |
169 |
# worker.sh needs some rights |
# worker.sh needs some rights |
198 |
170 |
type rocketgit_worker_t; |
type rocketgit_worker_t; |
|
... |
... |
cron_system_entry(rocketgit_worker_t, rocketgit_worker_exec_t) |
222 |
194 |
#files_manage_isid_type_symlinks(rocketgit_t) |
#files_manage_isid_type_symlinks(rocketgit_t) |
223 |
195 |
#userdom_read_admin_home_files(rocketgit_t) |
#userdom_read_admin_home_files(rocketgit_t) |
224 |
196 |
#miscfiles_read_hwdata(rocketgit_t) |
#miscfiles_read_hwdata(rocketgit_t) |
|
197 |
|
|
|
198 |
|
# Unit file |
|
199 |
|
type rocketgit_unit_file_t; |
|
200 |
|
systemd_unit_file(rocketgit_unit_file_t) |
|
201 |
|
|
|
202 |
|
|
|
203 |
|
# php-fpm stuff |
|
204 |
|
# allow writing to log files |
|
205 |
|
allow httpd_t rocketgit_log_t:file { append create getattr open setattr }; |
|
206 |
|
# allow using the cache.sock etc. |
|
207 |
|
allow httpd_t rocketgit_socket_t:sock_file write; |
|
208 |
|
# allow reading /etc/rocketgit/php-fpm.conf |
|
209 |
|
allow httpd_t rocketgit_conf_t:file { getattr open read }; |
|
210 |
|
# allow dealing with repos |
|
211 |
|
allow httpd_t rocketgit_var_t:dir { add_name create read remove_name rmdir write }; |
|
212 |
|
allow httpd_t rocketgit_var_t:file { append create getattr link open read rename setattr unlink write }; |
|
213 |
|
allow httpd_t rocketgit_var_t:lnk_file { getattr read }; |
|
214 |
|
# allow git-receive-pack to execute hooks |
|
215 |
|
allow httpd_t rocketgit_exec_t:file { getattr ioctl open read }; |
|
216 |
|
# allow reading /usr/share/rocketgit/{inc,root} files |
|
217 |
|
allow httpd_t rocketgit_usr_t:file { getattr open read }; |
|
218 |
|
# allow connecting to rocketgit_t domain |
|
219 |
|
allow httpd_t rocketgit_t:unix_stream_socket connectto; |
|
220 |
|
|
|
221 |
|
|
|
222 |
|
# Do not polute the logs! |
|
223 |
|
dontaudit rocketgit_t self:process { execmem }; |
|
224 |
|
|
|
225 |
|
|
|
226 |
|
# builder |
|
227 |
|
allow rocketgit_t self:tcp_socket { accept listen }; |