Chris PeBenito 31b7c0
#DESC Net Saint / NAGIOS - network monitoring server
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Author:  Russell Coker <russell@coker.com.au>
Chris PeBenito 31b7c0
# X-Debian-Packages: netsaint, nagios
Chris PeBenito 31b7c0
# Depends: mta.te
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#################################
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Rules for the nagios_t domain.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# nagios_exec_t is the type of the netsaint/nagios executable.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
daemon_domain(nagios, `, privmail')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
etcdir_domain(nagios)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
logdir_domain(nagios)
Chris PeBenito 31b7c0
allow nagios_t nagios_log_t:fifo_file create_file_perms;
Chris PeBenito 31b7c0
allow initrc_t nagios_log_t:dir rw_dir_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
tmp_domain(nagios)
Chris PeBenito 31b7c0
allow system_mail_t nagios_tmp_t:file { getattr read };
Chris PeBenito 31b7c0
# for open file handles
Chris PeBenito 31b7c0
dontaudit system_mail_t nagios_etc_t:file read;
Chris PeBenito 31b7c0
dontaudit system_mail_t nagios_log_t:fifo_file read;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Use the network.
Chris PeBenito 31b7c0
allow nagios_t self:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow nagios_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 31b7c0
allow nagios_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Use capabilities
Chris PeBenito 31b7c0
allow nagios_t self:capability { dac_override setgid setuid };
Chris PeBenito 31b7c0
allow nagios_t self:process setpgid;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow nagios_t { bin_t sbin_t }:dir search;
Chris PeBenito 31b7c0
allow nagios_t bin_t:lnk_file read;
Chris PeBenito 31b7c0
can_exec(nagios_t, { shell_exec_t bin_t })
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow nagios_t proc_t:file { getattr read };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
can_network_server(nagios_t)
Chris PeBenito 31b7c0
can_ypbind(nagios_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# read config files
Chris PeBenito 31b7c0
allow nagios_t { etc_t etc_runtime_t }:file { getattr read };
Chris PeBenito 31b7c0
allow nagios_t etc_t:lnk_file read;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow nagios_t etc_t:dir r_dir_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# for ps
Chris PeBenito 31b7c0
r_dir_file(nagios_t, domain)
Chris PeBenito 31b7c0
allow nagios_t boot_t:dir search;
Chris PeBenito 31b7c0
allow nagios_t system_map_t:file { getattr read };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# for who
Chris PeBenito 31b7c0
allow nagios_t initrc_var_run_t:file { getattr read lock };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
system_domain(nagios_cgi)
Chris PeBenito 31b7c0
allow nagios_cgi_t device_t:dir search;
Chris PeBenito 31b7c0
r_dir_file(nagios_cgi_t, nagios_etc_t)
Chris PeBenito 31b7c0
allow nagios_cgi_t var_log_t:dir search;
Chris PeBenito 31b7c0
r_dir_file(nagios_cgi_t, nagios_log_t)
Chris PeBenito 31b7c0
allow nagios_cgi_t self:process { fork signal_perms };
Chris PeBenito 31b7c0
allow nagios_cgi_t self:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow nagios_cgi_t bin_t:dir search;
Chris PeBenito 31b7c0
can_exec(nagios_cgi_t, bin_t)
Chris PeBenito 31b7c0
read_locale(nagios_cgi_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# for ps
Chris PeBenito 31b7c0
allow nagios_cgi_t { etc_runtime_t etc_t }:file { getattr read };
Chris PeBenito 31b7c0
r_dir_file(nagios_cgi_t, { proc_t self nagios_t })
Chris PeBenito 31b7c0
allow nagios_cgi_t boot_t:dir search;
Chris PeBenito 31b7c0
allow nagios_cgi_t system_map_t:file { getattr read };
Chris PeBenito 31b7c0
dontaudit nagios_cgi_t domain:dir getattr;
Chris PeBenito 31b7c0
allow nagios_cgi_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`apache.te', `
Chris PeBenito 31b7c0
r_dir_file(httpd_t, nagios_etc_t)
Chris PeBenito 31b7c0
domain_auto_trans({ httpd_t httpd_suexec_t }, nagios_cgi_exec_t, nagios_cgi_t)
Chris PeBenito 31b7c0
allow nagios_cgi_t httpd_log_t:file append;
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
ifdef(`ping.te', `
Chris PeBenito 31b7c0
domain_auto_trans(nagios_t, ping_exec_t, ping_t)
Chris PeBenito 31b7c0
allow nagios_t ping_t:process { sigkill signal };
Chris PeBenito 31b7c0
dontaudit ping_t nagios_etc_t:file read;
Chris PeBenito 31b7c0
dontaudit ping_t nagios_log_t:fifo_file read;
Chris PeBenito 31b7c0
')