Chris PeBenito 679626
Chris PeBenito 679626
policy_module(mrtg,1.0.0)
Chris PeBenito 679626
Chris PeBenito 679626
########################################
Chris PeBenito 679626
#
Chris PeBenito 679626
# Declarations
Chris PeBenito 679626
#
Chris PeBenito 679626
Chris PeBenito 679626
type mrtg_t;
Chris PeBenito 679626
type mrtg_exec_t;
Chris PeBenito 679626
init_system_domain(mrtg_t,mrtg_exec_t)
Chris PeBenito 679626
Chris PeBenito 679626
type mrtg_etc_t;
Chris PeBenito 679626
files_config_file(mrtg_etc_t)
Chris PeBenito 679626
Chris PeBenito 679626
type mrtg_lock_t;
Chris PeBenito 679626
files_lock_file(mrtg_lock_t)
Chris PeBenito 679626
Chris PeBenito 679626
type mrtg_log_t;
Chris PeBenito 679626
logging_log_file(mrtg_log_t)
Chris PeBenito 679626
Chris PeBenito 679626
type mrtg_var_lib_t;
Chris PeBenito 679626
files_type(mrtg_var_lib_t)
Chris PeBenito 679626
Chris PeBenito 679626
########################################
Chris PeBenito 679626
#
Chris PeBenito 679626
# Local policy
Chris PeBenito 679626
#
Chris PeBenito 679626
Chris PeBenito 679626
allow mrtg_t self:capability { setgid setuid };
Chris PeBenito 679626
dontaudit mrtg_t self:capability sys_tty_config;
Chris PeBenito 679626
allow mrtg_t self:process signal_perms;
Chris PeBenito 679626
allow mrtg_t self:fifo_file { getattr read write ioctl };
Chris PeBenito 679626
allow mrtg_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 679626
allow mrtg_t self:tcp_socket create_socket_perms;
Chris PeBenito 679626
allow mrtg_t self:udp_socket create_socket_perms;
Chris PeBenito 679626
Chris PeBenito 679626
allow mrtg_t mrtg_etc_t:file r_file_perms;
Chris PeBenito 679626
allow mrtg_t mrtg_etc_t:dir r_dir_perms;
Chris PeBenito 679626
allow mrtg_t mrtg_etc_t:lnk_file { getattr read };
Chris PeBenito 679626
files_search_etc(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
allow mrtg_t mrtg_lock_t:dir rw_dir_perms;
Chris PeBenito 679626
allow mrtg_t mrtg_lock_t:file create_file_perms;
Chris PeBenito 679626
allow mrtg_t mrtg_lock_t:lnk_file create_lnk_perms;
Chris PeBenito 679626
Chris PeBenito 679626
allow mrtg_t mrtg_log_t:file create_file_perms;
Chris PeBenito 679626
allow mrtg_t mrtg_log_t:dir rw_dir_perms;
Chris PeBenito 679626
logging_filetrans_log(mrtg_t,mrtg_log_t,{ file dir })
Chris PeBenito 679626
Chris PeBenito 679626
allow mrtg_t mrtg_var_lib_t:dir rw_dir_perms;
Chris PeBenito 679626
allow mrtg_t mrtg_var_lib_t:file create_file_perms;
Chris PeBenito 679626
allow mrtg_t mrtg_var_lib_t:lnk_file create_lnk_perms;
Chris PeBenito 679626
Chris PeBenito 679626
# read config files
Chris PeBenito 679626
dontaudit mrtg_t mrtg_etc_t:dir write;
Chris PeBenito 679626
dontaudit mrtg_t mrtg_etc_t:file { write ioctl };
Chris PeBenito 679626
files_read_etc_files(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
kernel_read_system_state(mrtg_t)
Chris PeBenito 679626
kernel_read_network_state(mrtg_t)
Chris PeBenito 679626
kernel_read_kernel_sysctls(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
corecmd_exec_bin(mrtg_t)
Chris PeBenito 679626
corecmd_exec_sbin(mrtg_t)
Chris PeBenito 679626
corecmd_exec_shell(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
corenet_non_ipsec_sendrecv(mrtg_t)
Chris PeBenito 679626
corenet_tcp_sendrecv_generic_if(mrtg_t)
Chris PeBenito 679626
corenet_udp_sendrecv_generic_if(mrtg_t)
Chris PeBenito 679626
corenet_raw_sendrecv_generic_if(mrtg_t)
Chris PeBenito 679626
corenet_tcp_sendrecv_all_nodes(mrtg_t)
Chris PeBenito 679626
corenet_udp_sendrecv_all_nodes(mrtg_t)
Chris PeBenito 679626
corenet_raw_sendrecv_all_nodes(mrtg_t)
Chris PeBenito 679626
corenet_tcp_sendrecv_all_ports(mrtg_t)
Chris PeBenito 679626
corenet_udp_sendrecv_all_ports(mrtg_t)
Chris PeBenito 679626
corenet_tcp_bind_all_nodes(mrtg_t)
Chris PeBenito 679626
corenet_udp_bind_all_nodes(mrtg_t)
Chris PeBenito 679626
corenet_tcp_connect_all_ports(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
dev_read_sysfs(mrtg_t)
Chris PeBenito 679626
dev_read_urand(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
domain_use_wide_inherit_fd(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
files_read_usr_files(mrtg_t)
Chris PeBenito 679626
files_search_var(mrtg_t)
Chris PeBenito 679626
files_search_locks(mrtg_t)
Chris PeBenito 679626
files_search_var_lib(mrtg_t)
Chris PeBenito 679626
files_search_spool(mrtg_t)
Chris PeBenito 679626
files_getattr_tmp_dirs(mrtg_t)
Chris PeBenito 679626
# for uptime
Chris PeBenito 679626
files_read_etc_runtime_files(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
fs_search_auto_mountpoints(mrtg_t)
Chris PeBenito 679626
fs_getattr_xattr_fs(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
term_dontaudit_use_console(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
init_use_fd(mrtg_t)
Chris PeBenito 1815ba
init_use_script_ptys(mrtg_t)
Chris PeBenito 679626
# for uptime
Chris PeBenito 679626
init_read_utmp(mrtg_t)
Chris PeBenito 679626
init_dontaudit_write_utmp(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 1815ba
libs_read_lib_files(mrtg_t)
Chris PeBenito 679626
libs_use_ld_so(mrtg_t)
Chris PeBenito 679626
libs_use_shared_libs(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
logging_send_syslog_msg(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
miscfiles_read_localization(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
selinux_dontaudit_getattr_dir(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
# Use the network.
Chris PeBenito 679626
sysnet_read_config(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
userdom_dontaudit_use_unpriv_user_fd(mrtg_t)
Chris PeBenito 679626
userdom_use_sysadm_terms(mrtg_t)
Chris PeBenito 679626
Chris PeBenito 679626
ifdef(`distro_redhat',`
Chris PeBenito 679626
	allow mrtg_t mrtg_etc_t:dir rw_dir_perms;
Chris PeBenito 679626
	allow mrtg_t mrtg_lock_t:file create_file_perms;
Chris PeBenito 679626
	type_transition mrtg_t mrtg_etc_t:file mrtg_lock_t;
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
ifdef(`targeted_policy',`
Chris PeBenito 1815ba
	term_dontaudit_use_unallocated_ttys(mrtg_t)
Chris PeBenito 1815ba
	term_dontaudit_use_generic_ptys(mrtg_t)
Chris PeBenito 679626
	files_dontaudit_read_root_files(mrtg_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
optional_policy(`apache',`
Chris PeBenito 679626
	apache_manage_sys_content(mrtg_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
optional_policy(`cron',`
Chris PeBenito 679626
	cron_system_entry(mrtg_t,mrtg_exec_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
optional_policy(`hostname',`
Chris PeBenito 679626
	hostname_exec(mrtg_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
optional_policy(`nis',`
Chris PeBenito 679626
	nis_use_ypbind(mrtg_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
optional_policy(`selinuxutil',`
Chris PeBenito 679626
	seutil_sigchld_newrole(mrtg_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
optional_policy(`quota',`
Chris PeBenito 679626
	quota_dontaudit_getattr_db(mrtg_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
optional_policy(`snmp',`
Chris PeBenito 679626
	snmp_udp_chat(mrtg_t)
Chris PeBenito 1815ba
	snmp_read_snmp_var_lib_files(mrtg_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
optional_policy(`udev',`
Chris PeBenito 679626
	udev_read_db(mrtg_t)
Chris PeBenito 679626
')
Chris PeBenito 679626
Chris PeBenito 679626
ifdef(`TODO',`
Chris PeBenito 679626
	# should not need this!
Chris PeBenito 679626
	dontaudit mrtg_t { staff_home_dir_t sysadm_home_dir_t }:dir { search read getattr };
Chris PeBenito 679626
	dontaudit mrtg_t { boot_t device_t file_t lost_found_t }:dir getattr;
Chris PeBenito 679626
	dontaudit mrtg_t root_t:lnk_file getattr;
Chris PeBenito 679626
')