Oreon-Lime-R2/selinux-policy/selinux-policy-bc228bd/selinux-policy-bc228bd0c249a9e4aa3dcf238c2b1bb138943b07/policy/modules/contrib/nagios.te

660 lines
18 KiB
Text
Raw Permalink Normal View History

policy_module(nagios, 1.13.0)
########################################
#
# Declarations
#
## <desc>
## <p>
## Allow nagios/nrpe to call sudo from NRPE utils scripts.
## </p>
## </desc>
gen_tunable(nagios_run_sudo, false)
## <desc>
## <p>
## Allow nagios run in conjunction with PNP4Nagios.
## </p>
## </desc>
gen_tunable(nagios_run_pnp4nagios, false)
## <desc>
## <p>
## Determine whether Nagios, NRPE can
## access nfs file systems.
## </p>
## </desc>
gen_tunable(nagios_use_nfs, false)
gen_require(`
class passwd rootok;
class passwd passwd;
')
attribute nagios_plugin_domain;
type nagios_t;
type nagios_exec_t;
init_daemon_domain(nagios_t, nagios_exec_t)
type nagios_etc_t;
files_config_file(nagios_etc_t)
type nagios_initrc_exec_t;
init_script_file(nagios_initrc_exec_t)
type nagios_log_t;
logging_log_file(nagios_log_t)
type nagios_tmp_t;
files_tmp_file(nagios_tmp_t)
type nagios_var_run_t;
files_pid_file(nagios_var_run_t)
type nagios_spool_t;
files_spool_file(nagios_spool_t)
type nagios_var_lib_t;
files_type(nagios_var_lib_t)
nagios_plugin_template(admin)
nagios_plugin_template(checkdisk)
nagios_plugin_template(mail)
nagios_plugin_template(services)
nagios_plugin_template(system)
nagios_plugin_template(unconfined)
nagios_plugin_template(eventhandler)
nagios_plugin_template(openshift)
type nagios_eventhandler_plugin_tmp_t;
files_tmp_file(nagios_eventhandler_plugin_tmp_t)
type nagios_system_plugin_tmp_t;
files_tmp_file(nagios_system_plugin_tmp_t)
type nagios_openshift_plugin_tmp_t;
files_tmp_file(nagios_openshift_plugin_tmp_t)
type nrpe_t;
type nrpe_exec_t;
init_daemon_domain(nrpe_t, nrpe_exec_t)
type nrpe_etc_t;
files_config_file(nrpe_etc_t)
type nrpe_var_run_t;
files_pid_file(nrpe_var_run_t)
######################################
#
# Common plugin domain local policy
#
allow nagios_plugin_domain self:fifo_file rw_fifo_file_perms;
allow nrpe_t nagios_plugin_domain:process { signal sigkill };
allow nagios_t nagios_plugin_domain:process signal_perms;
allow nagios_plugin_domain nagios_t:process signal_perms;
# cjp: leaked file descriptor
dontaudit nagios_plugin_domain nrpe_t:tcp_socket { read write };
dontaudit nagios_plugin_domain nagios_log_t:file { read write };
corecmd_exec_bin(nagios_plugin_domain)
dev_read_urand(nagios_plugin_domain)
dev_read_rand(nagios_plugin_domain)
dev_read_sysfs(nagios_plugin_domain)
userdom_use_inherited_user_ptys(nagios_plugin_domain)
userdom_use_inherited_user_ttys(nagios_plugin_domain)
tunable_policy(`nagios_run_sudo',`
init_dbus_chat(nagios_plugin_domain)
')
########################################
#
# Nagios local policy
#
allow nagios_t self:capability { chown dac_read_search setgid setuid };
dontaudit nagios_t self:capability sys_tty_config;
allow nagios_t self:process { setpgid signal_perms };
allow nagios_t self:fifo_file rw_fifo_file_perms;
allow nagios_t self:tcp_socket { accept listen };
allow nagios_t self:unix_stream_socket { connectto };
allow nagios_t nagios_plugin_domain:process signal_perms;
allow nagios_t nagios_eventhandler_plugin_exec_t:dir list_dir_perms;
allow nagios_t nagios_etc_t:dir list_dir_perms;
allow nagios_t nagios_etc_t:file { read_file_perms map };
allow nagios_t nagios_etc_t:lnk_file read_lnk_file_perms;
#allow nagios_t nagios_log_t:dir setattr_dir_perms;
#append_files_pattern(nagios_t, nagios_log_t, nagios_log_t)
#create_files_pattern(nagios_t, nagios_log_t, nagios_log_t)
#setattr_files_pattern(nagios_t, nagios_log_t, nagios_log_t)
manage_files_pattern(nagios_t, nagios_log_t, nagios_log_t)
manage_dirs_pattern(nagios_t, nagios_log_t, nagios_log_t)
logging_log_filetrans(nagios_t, nagios_log_t, { dir file })
allow nagios_t nagios_log_t:file map;
manage_dirs_pattern(nagios_t, nagios_tmp_t, nagios_tmp_t)
manage_files_pattern(nagios_t, nagios_tmp_t, nagios_tmp_t)
files_tmp_filetrans(nagios_t, nagios_tmp_t, { dir file })
manage_files_pattern(nagios_t, nagios_var_run_t, nagios_var_run_t)
files_pid_filetrans(nagios_t, nagios_var_run_t, file)
manage_fifo_files_pattern(nagios_t, nagios_spool_t, nagios_spool_t)
manage_files_pattern(nagios_t, nagios_spool_t, nagios_spool_t)
manage_sock_files_pattern(nagios_t, nagios_spool_t, nagios_spool_t)
files_spool_filetrans(nagios_t, nagios_spool_t, { file fifo_file })
allow nagios_t nagios_spool_t:file map;
manage_files_pattern(nagios_t, nagios_var_lib_t, nagios_var_lib_t)
manage_fifo_files_pattern(nagios_t, nagios_var_lib_t, nagios_var_lib_t)
manage_dirs_pattern(nagios_t, nagios_var_lib_t, nagios_var_lib_t)
files_var_lib_filetrans(nagios_t, nagios_var_lib_t, { dir file fifo_file })
kernel_read_system_state(nagios_t)
kernel_read_kernel_sysctls(nagios_t)
kernel_read_software_raid_state(nagios_t)
corecmd_exec_bin(nagios_t)
corecmd_exec_shell(nagios_t)
corenet_all_recvfrom_netlabel(nagios_t)
corenet_tcp_sendrecv_generic_if(nagios_t)
corenet_tcp_sendrecv_generic_node(nagios_t)
corenet_sendrecv_all_client_packets(nagios_t)
corenet_tcp_connect_all_ports(nagios_t)
corenet_tcp_sendrecv_all_ports(nagios_t)
corenet_dontaudit_tcp_bind_all_reserved_ports(nagios_t)
corenet_dontaudit_udp_bind_all_reserved_ports(nagios_t)
dev_read_sysfs(nagios_t)
dev_read_urand(nagios_t)
domain_use_interactive_fds(nagios_t)
domain_read_all_domains_state(nagios_t)
files_read_etc_runtime_files(nagios_t)
files_read_kernel_symbol_table(nagios_t)
files_search_spool(nagios_t)
fs_getattr_all_fs(nagios_t)
fs_search_auto_mountpoints(nagios_t)
fs_search_cgroup_dirs(nagios_t)
auth_use_nsswitch(nagios_t)
logging_send_syslog_msg(nagios_t)
userdom_dontaudit_use_unpriv_user_fds(nagios_t)
userdom_dontaudit_search_user_home_dirs(nagios_t)
mta_send_mail(nagios_t)
mta_signal_system_mail(nagios_t)
mta_kill_system_mail(nagios_t)
systemd_exec_systemctl(nagios_t)
tunable_policy(`nagios_run_sudo',`
allow nagios_t self:capability { chown setuid setgid sys_resource sys_ptrace };
allow nagios_t self:process { setrlimit setsched };
allow nagios_t self:key write;
allow nagios_t self:passwd { passwd rootok };
auth_rw_lastlog(nagios_t)
auth_rw_faillog(nagios_t)
auth_domtrans_chkpwd(nagios_t)
selinux_compute_access_vector(nagios_t)
systemd_write_inherited_logind_sessions_pipes(nagios_t)
systemd_dbus_chat_logind(nagios_t)
logging_send_audit_msgs(nagios_t)
')
optional_policy(`
apache_systemctl(nagios_t)
')
optional_policy(`
dbus_system_bus_client(nagios_t)
')
optional_policy(`
tunable_policy(`nagios_run_sudo',`
sudo_exec(nagios_t)
sudo_manage_db(nagios_t)
')
')
optional_policy(`
tunable_policy(`nagios_run_sudo',`
init_read_utmp(nagios_t)
')
')
tunable_policy(`nagios_run_pnp4nagios',`
allow nagios_t nagios_log_t:file execute;
')
tunable_policy(`nagios_use_nfs',`
fs_manage_nfs_files(nagios_t)
fs_manage_nfs_dirs(nagios_t)
fs_manage_nfs_symlinks(nagios_t)
')
optional_policy(`
netutils_kill_ping(nagios_t)
')
optional_policy(`
seutil_sigchld_newrole(nagios_t)
')
optional_policy(`
udev_read_db(nagios_t)
')
########################################
#
# CGI local policy
#
optional_policy(`
apache_content_template(nagios)
apache_content_alias_template(nagios, nagios)
typealias nagios_script_t alias nagios_cgi_t;
typealias nagios_script_exec_t alias nagios_cgi_exec_t;
allow nagios_script_t self:process signal_perms;
read_files_pattern(nagios_script_t, nagios_t, nagios_t)
read_lnk_files_pattern(nagios_script_t, nagios_t, nagios_t)
allow nagios_script_t nagios_etc_t:dir list_dir_perms;
allow nagios_script_t nagios_etc_t:file { map read_file_perms };
allow nagios_script_t nagios_etc_t:lnk_file read_lnk_file_perms;
files_search_spool(nagios_script_t)
rw_fifo_files_pattern(nagios_script_t, nagios_spool_t, nagios_spool_t)
read_files_pattern(nagios_script_t, nagios_spool_t, nagios_spool_t)
allow nagios_script_t nagios_spool_t:file map;
allow nagios_script_t nagios_log_t:dir list_dir_perms;
read_files_pattern(nagios_script_t, nagios_etc_t, nagios_log_t)
read_lnk_files_pattern(nagios_script_t, nagios_etc_t, nagios_log_t)
allow nagios_script_t nagios_log_t:file map;
kernel_read_system_state(nagios_script_t)
domain_dontaudit_read_all_domains_state(nagios_script_t)
files_read_etc_runtime_files(nagios_script_t)
files_read_kernel_symbol_table(nagios_script_t)
dev_list_sysfs(nagios_script_t)
logging_send_syslog_msg(nagios_script_t)
')
########################################
#
# Nrpe local policy
#
allow nrpe_t self:capability { setuid setgid kill };
dontaudit nrpe_t self:capability { sys_tty_config sys_resource };
allow nrpe_t self:process { setpgid signal_perms setsched setrlimit };
allow nrpe_t self:fifo_file rw_fifo_file_perms;
allow nrpe_t self:tcp_socket { accept listen };
allow nrpe_t nagios_plugin_domain:process { signal sigkill };
read_files_pattern(nrpe_t, nagios_etc_t, nrpe_etc_t)
manage_files_pattern(nrpe_t, nrpe_var_run_t, nrpe_var_run_t)
files_pid_filetrans(nrpe_t, nrpe_var_run_t, file)
domtrans_pattern(nrpe_t, nagios_checkdisk_plugin_exec_t, nagios_checkdisk_plugin_t)
kernel_read_system_state(nrpe_t)
kernel_read_kernel_sysctls(nrpe_t)
kernel_read_software_raid_state(nrpe_t)
can_exec(nagios_t, nagios_exec_t)
corecmd_exec_bin(nrpe_t)
corecmd_exec_shell(nrpe_t)
corenet_all_recvfrom_unlabeled(nrpe_t)
corenet_all_recvfrom_netlabel(nrpe_t)
corenet_tcp_sendrecv_generic_if(nrpe_t)
corenet_tcp_sendrecv_generic_node(nrpe_t)
corenet_tcp_bind_generic_node(nrpe_t)
corenet_sendrecv_inetd_child_server_packets(nrpe_t)
corenet_tcp_bind_inetd_child_port(nrpe_t)
corenet_tcp_sendrecv_inetd_child_port(nrpe_t)
dev_read_sysfs(nrpe_t)
dev_read_urand(nrpe_t)
domain_use_interactive_fds(nrpe_t)
domain_read_all_domains_state(nrpe_t)
files_list_var(nrpe_t)
files_read_etc_runtime_files(nrpe_t)
fs_getattr_all_fs(nrpe_t)
fs_search_auto_mountpoints(nrpe_t)
auth_use_nsswitch(nrpe_t)
logging_send_syslog_msg(nrpe_t)
userdom_dontaudit_use_unpriv_user_fds(nrpe_t)
tunable_policy(`nagios_run_sudo',`
allow nrpe_t self:capability { setuid setgid sys_resource sys_ptrace };
allow nrpe_t self:process { setrlimit setsched };
allow nrpe_t self:key write;
allow nrpe_t self:passwd { passwd rootok };
auth_rw_lastlog(nrpe_t)
auth_rw_faillog(nrpe_t)
auth_domtrans_chkpwd(nrpe_t)
selinux_compute_access_vector(nrpe_t)
systemd_write_inherited_logind_sessions_pipes(nrpe_t)
systemd_dbus_chat_logind(nrpe_t)
systemd_logind_read_state(nrpe_t)
logging_send_audit_msgs(nrpe_t)
')
optional_policy(`
tunable_policy(`nagios_run_sudo',`
sudo_exec(nrpe_t)
sudo_manage_db(nrpe_t)
')
')
optional_policy(`
tunable_policy(`nagios_run_sudo',`
sssd_read_config(nrpe_t)
sssd_manage_lib_files(nrpe_t)
sssd_read_pid_files(nrpe_t)
sssd_signull(nrpe_t)
')
')
tunable_policy(`nagios_use_nfs',`
fs_manage_nfs_files(nrpe_t)
fs_manage_nfs_dirs(nrpe_t)
fs_manage_nfs_symlinks(nrpe_t)
')
optional_policy(`
dbus_system_bus_client(nrpe_t)
')
optional_policy(`
inetd_tcp_service_domain(nrpe_t, nrpe_exec_t)
')
optional_policy(`
mta_send_mail(nrpe_t)
')
optional_policy(`
seutil_sigchld_newrole(nrpe_t)
')
optional_policy(`
tcpd_wrapped_domain(nrpe_t, nrpe_exec_t)
')
optional_policy(`
udev_read_db(nrpe_t)
')
#####################################
#
# Admin local policy
#
corecmd_read_bin_files(nagios_admin_plugin_t)
corecmd_read_bin_symlinks(nagios_admin_plugin_t)
dev_getattr_all_chr_files(nagios_admin_plugin_t)
dev_getattr_all_blk_files(nagios_admin_plugin_t)
files_getattr_all_dirs(nagios_admin_plugin_t)
files_getattr_all_files(nagios_admin_plugin_t)
files_getattr_all_symlinks(nagios_admin_plugin_t)
files_getattr_all_pipes(nagios_admin_plugin_t)
files_getattr_all_sockets(nagios_admin_plugin_t)
files_getattr_all_file_type_fs(nagios_admin_plugin_t)
######################################
#
# Mail local policy
#
allow nagios_mail_plugin_t self:capability { setuid setgid dac_read_search };
allow nagios_mail_plugin_t self:netlink_route_socket r_netlink_socket_perms;
allow nagios_mail_plugin_t self:tcp_socket create_stream_socket_perms;
allow nagios_mail_plugin_t self:udp_socket create_socket_perms;
kernel_read_kernel_sysctls(nagios_mail_plugin_t)
corecmd_read_bin_files(nagios_mail_plugin_t)
corecmd_read_bin_symlinks(nagios_mail_plugin_t)
logging_send_syslog_msg(nagios_mail_plugin_t)
sysnet_dns_name_resolve(nagios_mail_plugin_t)
optional_policy(`
mta_send_mail(nagios_mail_plugin_t)
')
optional_policy(`
nscd_dontaudit_search_pid(nagios_mail_plugin_t)
')
optional_policy(`
postfix_stream_connect_master(nagios_mail_plugin_t)
postfix_exec_postqueue(nagios_mail_plugin_t)
')
######################################
#
# Disk local policy
#
allow nagios_checkdisk_plugin_t self:capability { sys_admin sys_rawio };
kernel_read_software_raid_state(nagios_checkdisk_plugin_t)
corecmd_exec_bin(nagios_checkdisk_plugin_t)
files_getattr_all_dirs(nagios_checkdisk_plugin_t)
files_getattr_all_mountpoints(nagios_checkdisk_plugin_t)
files_read_etc_runtime_files(nagios_checkdisk_plugin_t)
fs_read_configfs_files(nagios_checkdisk_plugin_t)
fs_read_configfs_dirs(nagios_checkdisk_plugin_t)
fs_getattr_all_fs(nagios_checkdisk_plugin_t)
storage_raw_read_fixed_disk(nagios_checkdisk_plugin_t)
#######################################
#
# Services local policy
#
allow nagios_services_plugin_t self:capability { setuid net_bind_service net_raw };
allow nagios_services_plugin_t self:process { signal sigkill };
allow nagios_services_plugin_t self:tcp_socket create_stream_socket_perms;
allow nagios_services_plugin_t self:udp_socket create_socket_perms;
allow nagios_services_plugin_t self:rawip_socket create_socket_perms;
corecmd_exec_bin(nagios_services_plugin_t)
corenet_all_recvfrom_unlabeled(nagios_services_plugin_t)
corenet_all_recvfrom_netlabel(nagios_services_plugin_t)
corenet_tcp_sendrecv_generic_if(nagios_services_plugin_t)
corenet_udp_sendrecv_generic_if(nagios_services_plugin_t)
corenet_tcp_sendrecv_generic_node(nagios_services_plugin_t)
corenet_udp_sendrecv_generic_node(nagios_services_plugin_t)
corenet_udp_bind_generic_node(nagios_services_plugin_t)
corenet_sendrecv_all_client_packets(nagios_services_plugin_t)
corenet_tcp_connect_all_ports(nagios_services_plugin_t)
corenet_tcp_sendrecv_all_ports(nagios_services_plugin_t)
corenet_sendrecv_dhcpc_server_packets(nagios_services_plugin_t)
corenet_udp_bind_dhcpc_port(nagios_services_plugin_t)
corenet_udp_sendrecv_dhcpc_port(nagios_services_plugin_t)
auth_use_nsswitch(nagios_services_plugin_t)
domain_read_all_domains_state(nagios_services_plugin_t)
optional_policy(`
netutils_domtrans_ping(nagios_services_plugin_t)
netutils_signal_ping(nagios_services_plugin_t)
netutils_kill_ping(nagios_services_plugin_t)
')
optional_policy(`
mysql_stream_connect(nagios_services_plugin_t)
mysql_read_config(nagios_services_plugin_t)
')
optional_policy(`
postgresql_stream_connect(nagios_services_plugin_t)
')
optional_policy(`
snmp_read_snmp_var_lib_files(nagios_services_plugin_t)
')
######################################
#
# System local policy
#
allow nagios_system_plugin_t self:capability { dac_read_search };
dontaudit nagios_system_plugin_t self:capability { setuid setgid };
read_files_pattern(nagios_system_plugin_t, nagios_log_t, nagios_log_t)
allow nagios_system_plugin_t nrpe_exec_t:file read_file_perms;
allow nagios_system_plugin_t nagios_exec_t:file read_file_perms;
manage_files_pattern(nagios_system_plugin_t, nagios_system_plugin_tmp_t, nagios_system_plugin_tmp_t)
manage_dirs_pattern(nagios_system_plugin_t, nagios_system_plugin_tmp_t, nagios_system_plugin_tmp_t)
files_tmp_filetrans(nagios_system_plugin_t, nagios_system_plugin_tmp_t, { dir file })
kernel_read_system_state(nagios_system_plugin_t)
kernel_read_kernel_sysctls(nagios_system_plugin_t)
corecmd_exec_bin(nagios_system_plugin_t)
corecmd_exec_shell(nagios_system_plugin_t)
corecmd_getattr_all_executables(nagios_system_plugin_t)
dev_read_sysfs(nagios_system_plugin_t)
domain_read_all_domains_state(nagios_system_plugin_t)
fs_getattr_all_fs(nagios_system_plugin_t)
auth_read_passwd(nagios_system_plugin_t)
optional_policy(`
init_read_utmp(nagios_system_plugin_t)
')
optional_policy(`
mrtg_read_lib_files(nagios_system_plugin_t)
')
#######################################
#
# Event local policy
#
manage_files_pattern(nagios_eventhandler_plugin_t, nagios_eventhandler_plugin_tmp_t, nagios_eventhandler_plugin_tmp_t)
manage_dirs_pattern(nagios_eventhandler_plugin_t, nagios_eventhandler_plugin_tmp_t, nagios_eventhandler_plugin_tmp_t)
files_tmp_filetrans(nagios_eventhandler_plugin_t, nagios_eventhandler_plugin_tmp_t, { dir file })
corecmd_exec_bin(nagios_eventhandler_plugin_t)
corecmd_exec_shell(nagios_eventhandler_plugin_t)
init_domtrans_script(nagios_eventhandler_plugin_t)
systemd_exec_systemctl(nagios_eventhandler_plugin_t)
allow nagios_t nagios_eventhandler_plugin_exec_t:dir list_dir_perms;
optional_policy(`
unconfined_domain(nagios_eventhandler_plugin_t)
')
########################################
#
# nagios openshift plugin policy
#
allow nagios_openshift_plugin_t self:capability sys_ptrace;
manage_dirs_pattern(nagios_openshift_plugin_t, nagios_openshift_plugin_tmp_t, nagios_openshift_plugin_tmp_t)
manage_files_pattern(nagios_openshift_plugin_t, nagios_openshift_plugin_tmp_t, nagios_openshift_plugin_tmp_t)
files_tmp_filetrans(nagios_openshift_plugin_t, nagios_openshift_plugin_tmp_t, { file dir })
corecmd_exec_bin(nagios_openshift_plugin_t)
corecmd_exec_shell(nagios_openshift_plugin_t)
domain_read_all_domains_state(nagios_openshift_plugin_t)
fs_getattr_all_fs(nagios_openshift_plugin_t)
optional_policy(`
apache_read_config(nagios_openshift_plugin_t)
')
######################################
#
# nagios plugin domain policy
#
optional_policy(`
unconfined_domain(nagios_unconfined_plugin_t)
')
optional_policy(`
systemd_dbus_chat_logind(nagios_unconfined_plugin_t)
')