]> git.ipfire.org Git - people/stevee/selinux-policy.git/blob - policy/modules/services/nagios.te
Bump module versions for release.
[people/stevee/selinux-policy.git] / policy / modules / services / nagios.te
1
2 policy_module(nagios, 1.9.0)
3
4 ########################################
5 #
6 # Declarations
7 #
8
9 type nagios_t;
10 type nagios_exec_t;
11 init_daemon_domain(nagios_t, nagios_exec_t)
12
13 type nagios_etc_t;
14 files_config_file(nagios_etc_t)
15
16 type nagios_initrc_exec_t;
17 init_script_file(nagios_initrc_exec_t)
18
19 type nagios_log_t;
20 logging_log_file(nagios_log_t)
21
22 type nagios_tmp_t;
23 files_tmp_file(nagios_tmp_t)
24
25 type nagios_var_run_t;
26 files_pid_file(nagios_var_run_t)
27
28 type nagios_spool_t;
29 files_type(nagios_spool_t)
30
31 nagios_plugin_template(admin)
32 nagios_plugin_template(checkdisk)
33 nagios_plugin_template(mail)
34 nagios_plugin_template(services)
35 nagios_plugin_template(system)
36 nagios_plugin_template(unconfined)
37
38 type nagios_system_plugin_tmp_t;
39 files_tmp_file(nagios_system_plugin_tmp_t)
40
41 type nrpe_t;
42 type nrpe_exec_t;
43 init_daemon_domain(nrpe_t, nrpe_exec_t)
44
45 type nrpe_etc_t;
46 files_config_file(nrpe_etc_t)
47
48 type nrpe_var_run_t;
49 files_pid_file(nrpe_var_run_t)
50
51 ########################################
52 #
53 # Nagios local policy
54 #
55
56 allow nagios_t self:capability { dac_override setgid setuid };
57 dontaudit nagios_t self:capability sys_tty_config;
58 allow nagios_t self:process { setpgid signal_perms };
59 allow nagios_t self:fifo_file rw_file_perms;
60 allow nagios_t self:tcp_socket create_stream_socket_perms;
61 allow nagios_t self:udp_socket create_socket_perms;
62
63 read_files_pattern(nagios_t, nagios_etc_t, nagios_etc_t)
64 read_lnk_files_pattern(nagios_t, nagios_etc_t, nagios_etc_t)
65 allow nagios_t nagios_etc_t:dir list_dir_perms;
66
67 manage_files_pattern(nagios_t, nagios_log_t, nagios_log_t)
68 manage_fifo_files_pattern(nagios_t, nagios_log_t, nagios_log_t)
69 logging_log_filetrans(nagios_t, nagios_log_t, { file dir })
70
71 manage_dirs_pattern(nagios_t, nagios_tmp_t, nagios_tmp_t)
72 manage_files_pattern(nagios_t, nagios_tmp_t, nagios_tmp_t)
73 files_tmp_filetrans(nagios_t, nagios_tmp_t, { file dir })
74
75 manage_files_pattern(nagios_t, nagios_var_run_t, nagios_var_run_t)
76 files_pid_filetrans(nagios_t, nagios_var_run_t, file)
77
78 manage_fifo_files_pattern(nagios_t, nagios_spool_t, nagios_spool_t)
79 files_spool_filetrans(nagios_t, nagios_spool_t, fifo_file)
80
81 kernel_read_system_state(nagios_t)
82 kernel_read_kernel_sysctls(nagios_t)
83
84 corecmd_exec_bin(nagios_t)
85 corecmd_exec_shell(nagios_t)
86
87 corenet_all_recvfrom_unlabeled(nagios_t)
88 corenet_all_recvfrom_netlabel(nagios_t)
89 corenet_tcp_sendrecv_generic_if(nagios_t)
90 corenet_udp_sendrecv_generic_if(nagios_t)
91 corenet_tcp_sendrecv_generic_node(nagios_t)
92 corenet_udp_sendrecv_generic_node(nagios_t)
93 corenet_tcp_sendrecv_all_ports(nagios_t)
94 corenet_udp_sendrecv_all_ports(nagios_t)
95 corenet_tcp_connect_all_ports(nagios_t)
96
97 corenet_dontaudit_tcp_bind_all_reserved_ports(nagios_t)
98 corenet_dontaudit_udp_bind_all_reserved_ports(nagios_t)
99
100 dev_read_sysfs(nagios_t)
101 dev_read_urand(nagios_t)
102
103 domain_use_interactive_fds(nagios_t)
104 # for ps
105 domain_read_all_domains_state(nagios_t)
106
107 files_read_etc_files(nagios_t)
108 files_read_etc_runtime_files(nagios_t)
109 files_read_kernel_symbol_table(nagios_t)
110 files_search_spool(nagios_t)
111
112 fs_getattr_all_fs(nagios_t)
113 fs_search_auto_mountpoints(nagios_t)
114
115 # for who
116 init_read_utmp(nagios_t)
117
118 auth_use_nsswitch(nagios_t)
119
120 logging_send_syslog_msg(nagios_t)
121
122 miscfiles_read_localization(nagios_t)
123
124 userdom_dontaudit_use_unpriv_user_fds(nagios_t)
125 userdom_dontaudit_search_user_home_dirs(nagios_t)
126
127 mta_send_mail(nagios_t)
128
129 optional_policy(`
130 netutils_domtrans_ping(nagios_t)
131 netutils_signal_ping(nagios_t)
132 netutils_kill_ping(nagios_t)
133 ')
134
135 optional_policy(`
136 seutil_sigchld_newrole(nagios_t)
137 ')
138
139 optional_policy(`
140 udev_read_db(nagios_t)
141 ')
142
143 ########################################
144 #
145 # Nagios CGI local policy
146 #
147 optional_policy(`
148 apache_content_template(nagios)
149 typealias httpd_nagios_script_t alias nagios_cgi_t;
150 typealias httpd_nagios_script_exec_t alias nagios_cgi_exec_t;
151
152 allow httpd_nagios_script_t self:process signal_perms;
153
154 read_files_pattern(httpd_nagios_script_t, nagios_t, nagios_t)
155 read_lnk_files_pattern(httpd_nagios_script_t, nagios_t, nagios_t)
156
157 files_search_spool(httpd_nagios_script_t)
158 rw_fifo_files_pattern(httpd_nagios_script_t, nagios_spool_t, nagios_spool_t)
159
160 allow httpd_nagios_script_t nagios_etc_t:dir list_dir_perms;
161 read_files_pattern(httpd_nagios_script_t, nagios_etc_t, nagios_etc_t)
162 read_lnk_files_pattern(httpd_nagios_script_t, nagios_etc_t, nagios_etc_t)
163
164 allow httpd_nagios_script_t nagios_log_t:dir list_dir_perms;
165 read_files_pattern(httpd_nagios_script_t, nagios_etc_t, nagios_log_t)
166 read_lnk_files_pattern(httpd_nagios_script_t, nagios_etc_t, nagios_log_t)
167
168 kernel_read_system_state(httpd_nagios_script_t)
169
170 domain_dontaudit_read_all_domains_state(httpd_nagios_script_t)
171
172 files_read_etc_runtime_files(httpd_nagios_script_t)
173 files_read_kernel_symbol_table(httpd_nagios_script_t)
174
175 logging_send_syslog_msg(httpd_nagios_script_t)
176 ')
177
178 ########################################
179 #
180 # Nagios remote plugin executor local policy
181 #
182
183 allow nrpe_t self:capability { setuid setgid };
184 dontaudit nrpe_t self:capability {sys_tty_config sys_resource};
185 allow nrpe_t self:process { setpgid signal_perms setsched setrlimit };
186 allow nrpe_t self:fifo_file rw_fifo_file_perms;
187 allow nrpe_t self:tcp_socket create_stream_socket_perms;
188
189 domtrans_pattern(nrpe_t, nagios_checkdisk_plugin_exec_t, nagios_checkdisk_plugin_t)
190
191 read_files_pattern(nrpe_t, nagios_etc_t, nagios_etc_t)
192 files_search_etc(nrpe_t)
193
194 manage_files_pattern(nrpe_t, nrpe_var_run_t, nrpe_var_run_t)
195 files_pid_filetrans(nrpe_t, nrpe_var_run_t, file)
196
197 kernel_read_system_state(nrpe_t)
198 kernel_read_kernel_sysctls(nrpe_t)
199
200 corecmd_exec_bin(nrpe_t)
201 corecmd_exec_shell(nrpe_t)
202
203 corenet_tcp_bind_generic_node(nrpe_t)
204 corenet_tcp_bind_inetd_child_port(nrpe_t)
205 corenet_sendrecv_unlabeled_packets(nrpe_t)
206
207 dev_read_sysfs(nrpe_t)
208 dev_read_urand(nrpe_t)
209
210 domain_use_interactive_fds(nrpe_t)
211 domain_read_all_domains_state(nrpe_t)
212
213 files_read_etc_runtime_files(nrpe_t)
214 files_read_etc_files(nrpe_t)
215
216 fs_getattr_all_fs(nrpe_t)
217 fs_search_auto_mountpoints(nrpe_t)
218
219 auth_use_nsswitch(nrpe_t)
220
221 logging_send_syslog_msg(nrpe_t)
222
223 miscfiles_read_localization(nrpe_t)
224
225 userdom_dontaudit_use_unpriv_user_fds(nrpe_t)
226
227 optional_policy(`
228 inetd_tcp_service_domain(nrpe_t, nrpe_exec_t)
229 ')
230
231 optional_policy(`
232 mta_send_mail(nrpe_t)
233 ')
234
235 optional_policy(`
236 seutil_sigchld_newrole(nrpe_t)
237 ')
238
239 optional_policy(`
240 tcpd_wrapped_domain(nrpe_t, nrpe_exec_t)
241 ')
242
243 optional_policy(`
244 udev_read_db(nrpe_t)
245 ')
246
247 #####################################
248 #
249 # local policy for admin check plugins
250 #
251
252 corecmd_read_bin_files(nagios_admin_plugin_t)
253 corecmd_read_bin_symlinks(nagios_admin_plugin_t)
254
255 dev_read_urand(nagios_admin_plugin_t)
256 dev_getattr_all_chr_files(nagios_admin_plugin_t)
257 dev_getattr_all_blk_files(nagios_admin_plugin_t)
258
259 files_read_etc_files(nagios_admin_plugin_t)
260 # for check_file_age plugin
261 files_getattr_all_dirs(nagios_admin_plugin_t)
262 files_getattr_all_files(nagios_admin_plugin_t)
263 files_getattr_all_symlinks(nagios_admin_plugin_t)
264 files_getattr_all_pipes(nagios_admin_plugin_t)
265 files_getattr_all_sockets(nagios_admin_plugin_t)
266 files_getattr_all_file_type_fs(nagios_admin_plugin_t)
267
268 ######################################
269 #
270 # local policy for mail check plugins
271 #
272
273 allow nagios_mail_plugin_t self:capability { setuid setgid dac_override };
274
275 allow nagios_mail_plugin_t self:netlink_route_socket r_netlink_socket_perms;
276 allow nagios_mail_plugin_t self:tcp_socket create_stream_socket_perms;
277 allow nagios_mail_plugin_t self:udp_socket create_socket_perms;
278
279 kernel_read_system_state(nagios_mail_plugin_t)
280 kernel_read_kernel_sysctls(nagios_mail_plugin_t)
281
282 corecmd_read_bin_files(nagios_mail_plugin_t)
283 corecmd_read_bin_symlinks(nagios_mail_plugin_t)
284
285 dev_read_urand(nagios_mail_plugin_t)
286
287 files_read_etc_files(nagios_mail_plugin_t)
288
289 logging_send_syslog_msg(nagios_mail_plugin_t)
290
291 sysnet_read_config(nagios_mail_plugin_t)
292
293 optional_policy(`
294 mta_send_mail(nagios_mail_plugin_t)
295 ')
296
297 optional_policy(`
298 nscd_dontaudit_search_pid(nagios_mail_plugin_t)
299 ')
300
301 optional_policy(`
302 postfix_stream_connect_master(nagios_mail_plugin_t)
303 posftix_exec_postqueue(nagios_mail_plugin_t)
304 ')
305
306 ######################################
307 #
308 # local policy for disk check plugins
309 #
310
311 # needed by ioctl()
312 allow nagios_checkdisk_plugin_t self:capability { sys_admin sys_rawio };
313
314 files_read_etc_runtime_files(nagios_checkdisk_plugin_t)
315
316 fs_getattr_all_fs(nagios_checkdisk_plugin_t)
317
318 storage_raw_read_fixed_disk(nagios_checkdisk_plugin_t)
319
320 #######################################
321 #
322 # local policy for service check plugins
323 #
324
325 allow nagios_services_plugin_t self:capability { net_bind_service net_raw };
326 allow nagios_services_plugin_t self:process { signal sigkill };
327
328 allow nagios_services_plugin_t self:tcp_socket create_stream_socket_perms;
329 allow nagios_services_plugin_t self:udp_socket create_socket_perms;
330
331 corecmd_exec_bin(nagios_services_plugin_t)
332
333 corenet_tcp_connect_all_ports(nagios_services_plugin_t)
334 corenet_udp_bind_dhcpc_port(nagios_services_plugin_t)
335
336 auth_use_nsswitch(nagios_services_plugin_t)
337
338 domain_read_all_domains_state(nagios_services_plugin_t)
339
340 files_read_usr_files(nagios_services_plugin_t)
341
342 optional_policy(`
343 netutils_domtrans_ping(nagios_services_plugin_t)
344 ')
345
346 optional_policy(`
347 mysql_stream_connect(nagios_services_plugin_t)
348 ')
349
350 optional_policy(`
351 snmp_read_snmp_var_lib_files(nagios_services_plugin_t)
352 ')
353
354 ######################################
355 #
356 # local policy for system check plugins
357 #
358
359 allow nagios_system_plugin_t self:capability dac_override;
360 dontaudit nagios_system_plugin_t self:capability { setuid setgid };
361
362 # check_log
363 manage_files_pattern(nagios_system_plugin_t, nagios_system_plugin_tmp_t, nagios_system_plugin_tmp_t)
364 manage_dirs_pattern(nagios_system_plugin_t, nagios_system_plugin_tmp_t, nagios_system_plugin_tmp_t)
365 files_tmp_filetrans(nagios_system_plugin_t, nagios_system_plugin_tmp_t, { dir file })
366
367 kernel_read_system_state(nagios_system_plugin_t)
368 kernel_read_kernel_sysctls(nagios_system_plugin_t)
369
370 corecmd_exec_bin(nagios_system_plugin_t)
371 corecmd_exec_shell(nagios_system_plugin_t)
372
373 dev_read_sysfs(nagios_system_plugin_t)
374 dev_read_urand(nagios_system_plugin_t)
375
376 domain_read_all_domains_state(nagios_system_plugin_t)
377
378 files_read_etc_files(nagios_system_plugin_t)
379
380 # needed by check_users plugin
381 optional_policy(`
382 init_read_utmp(nagios_system_plugin_t)
383 ')
384
385 ########################################
386 #
387 # Unconfined plugin policy
388 #
389
390 optional_policy(`
391 unconfined_domain(nagios_unconfined_plugin_t)
392 ')