Chris PeBenito f1e604
Chris PeBenito 141cff
policy_module(nagios,1.0.2)
Chris PeBenito f1e604
Chris PeBenito f1e604
########################################
Chris PeBenito f1e604
#
Chris PeBenito f1e604
# Declarations
Chris PeBenito f1e604
#
Chris PeBenito f1e604
Chris PeBenito f1e604
type nagios_t;
Chris PeBenito f1e604
type nagios_exec_t;
Chris PeBenito f1e604
init_daemon_domain(nagios_t,nagios_exec_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
type nagios_cgi_t;
Chris PeBenito f1e604
type nagios_cgi_exec_t;
Chris PeBenito f1e604
init_system_domain(nagios_cgi_t,nagios_cgi_exec_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
type nagios_etc_t;
Chris PeBenito f1e604
files_config_file(nagios_etc_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
type nagios_log_t;
Chris PeBenito f1e604
logging_log_file(nagios_log_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
type nagios_tmp_t;
Chris PeBenito f1e604
files_tmp_file(nagios_tmp_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
type nagios_var_run_t;
Chris PeBenito f1e604
files_pid_file(nagios_var_run_t)
Chris PeBenito f1e604
Chris PeBenito 06e277
type nrpe_t;
Chris PeBenito 06e277
type nrpe_exec_t;
Chris PeBenito 06e277
init_daemon_domain(nrpe_t,nrpe_exec_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
type nrpe_etc_t;
Chris PeBenito 06e277
files_config_file(nrpe_etc_t)
Chris PeBenito 06e277
Chris PeBenito f1e604
########################################
Chris PeBenito f1e604
#
Chris PeBenito f1e604
# Nagios local policy
Chris PeBenito f1e604
#
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_t self:capability { dac_override setgid setuid };
Chris PeBenito f1e604
dontaudit nagios_t self:capability sys_tty_config;
Chris PeBenito f1e604
allow nagios_t self:process { setpgid signal_perms };
Chris PeBenito f1e604
allow nagios_t self:fifo_file rw_file_perms;
Chris PeBenito f1e604
allow nagios_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito f1e604
allow nagios_t self:udp_socket create_socket_perms;
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_t nagios_etc_t:file r_file_perms;
Chris PeBenito f1e604
allow nagios_t nagios_etc_t:dir r_dir_perms;
Chris PeBenito f1e604
allow nagios_t nagios_etc_t:lnk_file { getattr read };
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_t nagios_log_t:file manage_file_perms;
Chris PeBenito f1e604
allow nagios_t nagios_log_t:fifo_file manage_file_perms;
Chris PeBenito f1e604
allow nagios_t nagios_log_t:dir rw_dir_perms;
Chris PeBenito f1e604
logging_log_filetrans(nagios_t,nagios_log_t,{ file dir })
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_t nagios_tmp_t:dir create_dir_perms;
Chris PeBenito f1e604
allow nagios_t nagios_tmp_t:file create_file_perms;
Chris PeBenito f1e604
files_tmp_filetrans(nagios_t, nagios_tmp_t, { file dir })
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_t nagios_var_run_t:file create_file_perms;
Chris PeBenito f1e604
allow nagios_t nagios_var_run_t:dir rw_dir_perms;
Chris PeBenito f1e604
files_pid_filetrans(nagios_t,nagios_var_run_t,file)
Chris PeBenito f1e604
Chris PeBenito f1e604
kernel_read_system_state(nagios_t)
Chris PeBenito f1e604
kernel_read_kernel_sysctls(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
corecmd_exec_bin(nagios_t)
Chris PeBenito f1e604
corecmd_exec_shell(nagios_t)
Chris PeBenito f1e604
Chris PeBenito 141cff
corenet_non_ipsec_sendrecv(nagios_t)
Chris PeBenito f1e604
corenet_tcp_sendrecv_generic_if(nagios_t)
Chris PeBenito f1e604
corenet_udp_sendrecv_generic_if(nagios_t)
Chris PeBenito f1e604
corenet_tcp_sendrecv_all_nodes(nagios_t)
Chris PeBenito f1e604
corenet_udp_sendrecv_all_nodes(nagios_t)
Chris PeBenito f1e604
corenet_tcp_sendrecv_all_ports(nagios_t)
Chris PeBenito f1e604
corenet_udp_sendrecv_all_ports(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
dev_read_sysfs(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
domain_use_interactive_fds(nagios_t)
Chris PeBenito f1e604
# for ps
Chris PeBenito f1e604
domain_read_all_domains_state(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
files_read_etc_files(nagios_t)
Chris PeBenito f1e604
files_read_etc_runtime_files(nagios_t)
Chris PeBenito f1e604
files_read_kernel_symbol_table(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
fs_getattr_all_fs(nagios_t)
Chris PeBenito f1e604
fs_search_auto_mountpoints(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
term_dontaudit_use_console(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
init_use_fds(nagios_t)
Chris PeBenito f1e604
init_use_script_ptys(nagios_t)
Chris PeBenito f1e604
# for who
Chris PeBenito f1e604
init_read_utmp(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
libs_use_ld_so(nagios_t)
Chris PeBenito f1e604
libs_use_shared_libs(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
logging_send_syslog_msg(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
miscfiles_read_localization(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
sysnet_read_config(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
userdom_dontaudit_use_unpriv_user_fds(nagios_t)
Chris PeBenito f1e604
userdom_dontaudit_search_sysadm_home_dirs(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
mta_send_mail(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
ifdef(`targeted_policy',`
Chris PeBenito f1e604
	term_dontaudit_use_unallocated_ttys(nagios_t)
Chris PeBenito f1e604
	term_dontaudit_use_generic_ptys(nagios_t)
Chris PeBenito f1e604
	files_dontaudit_read_root_files(nagios_t)
Chris PeBenito f1e604
')
Chris PeBenito f1e604
Chris PeBenito f1e604
optional_policy(`
Chris PeBenito f1e604
	netutils_domtrans_ping(nagios_t)
Chris PeBenito f1e604
	netutils_signal_ping(nagios_t)
Chris PeBenito f1e604
	netutils_kill_ping(nagios_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
	# cjp: leaked file descriptors:
Chris PeBenito f1e604
	#dontaudit ping_t nagios_etc_t:file read;
Chris PeBenito f1e604
	#dontaudit ping_t nagios_log_t:fifo_file read;
Chris PeBenito f1e604
')
Chris PeBenito f1e604
Chris PeBenito f1e604
optional_policy(`
Chris PeBenito f1e604
	nis_use_ypbind(nagios_t)
Chris PeBenito f1e604
')
Chris PeBenito f1e604
Chris PeBenito f1e604
optional_policy(`
Chris PeBenito f1e604
	seutil_sigchld_newrole(nagios_t)
Chris PeBenito f1e604
')
Chris PeBenito f1e604
Chris PeBenito f1e604
optional_policy(`
Chris PeBenito f1e604
	udev_read_db(nagios_t)
Chris PeBenito f1e604
')
Chris PeBenito f1e604
Chris PeBenito f1e604
# cjp: leaked file descriptors:
Chris PeBenito f1e604
# for open file handles
Chris PeBenito f1e604
#dontaudit system_mail_t nagios_etc_t:file read;
Chris PeBenito f1e604
#dontaudit system_mail_t nagios_log_t:fifo_file read;
Chris PeBenito f1e604
Chris PeBenito f1e604
########################################
Chris PeBenito f1e604
#
Chris PeBenito f1e604
# Nagios CGI local policy
Chris PeBenito f1e604
#
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_cgi_t self:process { fork signal_perms };
Chris PeBenito f1e604
allow nagios_cgi_t self:fifo_file rw_file_perms;
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_cgi_t nagios_t:dir r_dir_perms;
Chris PeBenito f1e604
allow nagios_cgi_t nagios_t:file r_file_perms;
Chris PeBenito f1e604
allow nagios_cgi_t nagios_t:lnk_file { getattr read };
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_cgi_t nagios_etc_t:dir r_dir_perms;
Chris PeBenito f1e604
allow nagios_cgi_t nagios_etc_t:file r_file_perms;
Chris PeBenito f1e604
allow nagios_cgi_t nagios_etc_t:lnk_file { getattr read };
Chris PeBenito f1e604
Chris PeBenito f1e604
allow nagios_cgi_t nagios_log_t:dir r_dir_perms;
Chris PeBenito f1e604
allow nagios_cgi_t nagios_log_t:file r_file_perms;
Chris PeBenito f1e604
allow nagios_cgi_t nagios_log_t:lnk_file { getattr read };
Chris PeBenito f1e604
Chris PeBenito f1e604
kernel_read_system_state(nagios_cgi_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
corecmd_exec_bin(nagios_cgi_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
domain_dontaudit_read_all_domains_state(nagios_cgi_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
files_read_etc_files(nagios_cgi_t)
Chris PeBenito f1e604
files_read_etc_runtime_files(nagios_cgi_t)
Chris PeBenito f1e604
files_read_kernel_symbol_table(nagios_cgi_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
libs_use_ld_so(nagios_cgi_t)
Chris PeBenito f1e604
libs_use_shared_libs(nagios_cgi_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
logging_send_syslog_msg(nagios_cgi_t)
Chris PeBenito f1e604
logging_search_logs(nagios_cgi_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
miscfiles_read_localization(nagios_cgi_t)
Chris PeBenito f1e604
Chris PeBenito f1e604
optional_policy(`
Chris PeBenito f1e604
	apache_append_log(nagios_cgi_t)
Chris PeBenito f1e604
')
Chris PeBenito 06e277
Chris PeBenito 06e277
########################################
Chris PeBenito 06e277
#
Chris PeBenito 06e277
# Nagios remote plugin executor local policy
Chris PeBenito 06e277
#
Chris PeBenito 06e277
Chris PeBenito 06e277
dontaudit nrpe_t self:capability sys_tty_config;
Chris PeBenito 06e277
allow nrpe_t self:process { setpgid signal_perms };
Chris PeBenito 06e277
allow nrpe_t self:fifo_file rw_file_perms;
Chris PeBenito 06e277
Chris PeBenito 06e277
allow nrpe_t nrpe_etc_t:file { getattr read };
Chris PeBenito 06e277
files_search_etc(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
kernel_read_system_state(nrpe_t)
Chris PeBenito 06e277
kernel_read_kernel_sysctls(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
corecmd_exec_bin(nrpe_t)
Chris PeBenito 06e277
corecmd_exec_shell(nrpe_t)
Chris PeBenito 06e277
corecmd_exec_ls(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
dev_read_sysfs(nrpe_t)
Chris PeBenito 06e277
dev_read_urand(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
domain_use_interactive_fds(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
files_read_etc_runtime_files(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
fs_search_auto_mountpoints(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
term_dontaudit_use_console(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
init_use_fds(nrpe_t)
Chris PeBenito 06e277
init_use_script_ptys(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
libs_use_ld_so(nrpe_t)
Chris PeBenito 06e277
libs_use_shared_libs(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
logging_send_syslog_msg(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
miscfiles_read_localization(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
userdom_dontaudit_use_unpriv_user_fds(nrpe_t)
Chris PeBenito 06e277
Chris PeBenito 06e277
ifdef(`targeted_policy',`
Chris PeBenito 06e277
        term_dontaudit_use_unallocated_ttys(nrpe_t)
Chris PeBenito 06e277
        term_dontaudit_use_generic_ptys(nrpe_t)
Chris PeBenito 06e277
        files_dontaudit_read_root_files(nrpe_t)
Chris PeBenito 06e277
')
Chris PeBenito 06e277
Chris PeBenito 06e277
optional_policy(`
Chris PeBenito 06e277
	inetd_tcp_service_domain(nrpe_t,nrpe_exec_t)
Chris PeBenito 06e277
')
Chris PeBenito 06e277
Chris PeBenito 06e277
optional_policy(`
Chris PeBenito 06e277
        seutil_sigchld_newrole(nrpe_t)
Chris PeBenito 06e277
')
Chris PeBenito 06e277
Chris PeBenito 06e277
optional_policy(`
Chris PeBenito 06e277
        udev_read_db(nrpe_t)
Chris PeBenito 06e277
')