Chris PeBenito 17de1b
## <summary>Munin network-wide load graphing (formerly LRRD)</summary>
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 24e0b9
##	Create a set of derived types for various
Chris PeBenito 24e0b9
##	munin plugins,
Chris PeBenito 24e0b9
## </summary>
Chris PeBenito 24e0b9
## <param name="prefix">
Chris PeBenito 24e0b9
##	<summary>
Chris PeBenito 24e0b9
##	The name to be used for deriving type names.
Chris PeBenito 24e0b9
##	</summary>
Chris PeBenito 24e0b9
## </param>
Chris PeBenito 24e0b9
#
Chris PeBenito 24e0b9
template(`munin_plugin_template',`
Chris PeBenito 24e0b9
	gen_require(`
Chris PeBenito 24e0b9
		type munin_t, munin_exec_t, munin_etc_t;
Chris PeBenito 24e0b9
	')
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	type $1_munin_plugin_t;
Chris PeBenito 24e0b9
	type $1_munin_plugin_exec_t;
Chris PeBenito 24e0b9
	typealias $1_munin_plugin_t alias munin_$1_plugin_t;
Chris PeBenito 24e0b9
	typealias $1_munin_plugin_exec_t alias munin_$1_plugin_exec_t;
Chris PeBenito 24e0b9
	application_domain($1_munin_plugin_t, $1_munin_plugin_exec_t)
Chris PeBenito 24e0b9
	role system_r types $1_munin_plugin_t;
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	type $1_munin_plugin_tmp_t;
Chris PeBenito 24e0b9
	typealias $1_munin_plugin_tmp_t alias munin_$1_plugin_tmp_t;
Chris PeBenito 24e0b9
	files_tmp_file($1_munin_plugin_tmp_t)
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	allow $1_munin_plugin_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	manage_files_pattern($1_munin_plugin_t, $1_munin_plugin_tmp_t, $1_munin_plugin_tmp_t)
Chris PeBenito 24e0b9
	manage_dirs_pattern($1_munin_plugin_t, $1_munin_plugin_tmp_t, $1_munin_plugin_tmp_t)
Chris PeBenito 24e0b9
	files_tmp_filetrans($1_munin_plugin_t, $1_munin_plugin_tmp_t, { dir file })
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	# automatic transition rules from munin domain
Chris PeBenito 24e0b9
	# to specific munin plugin domain
Chris PeBenito 24e0b9
	domtrans_pattern(munin_t, $1_munin_plugin_exec_t, $1_munin_plugin_t)
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	allow $1_munin_plugin_t munin_exec_t:file read_file_perms;
Chris PeBenito 24e0b9
	allow $1_munin_plugin_t munin_t:tcp_socket rw_socket_perms;
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	read_lnk_files_pattern($1_munin_plugin_t, munin_etc_t, munin_etc_t)
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	kernel_read_system_state($1_munin_plugin_t)
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	corecmd_exec_bin($1_munin_plugin_t)
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
	miscfiles_read_localization($1_munin_plugin_t)
Chris PeBenito 24e0b9
')
Chris PeBenito 24e0b9
Chris PeBenito 24e0b9
########################################
Chris PeBenito 24e0b9
## <summary>
Chris PeBenito 17de1b
##	Connect to munin over a unix domain
Chris PeBenito 17de1b
##	stream socket.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`munin_stream_connect',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type munin_var_run_t, munin_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 munin_t:unix_stream_socket connectto;
Chris PeBenito 17de1b
	allow $1 munin_var_run_t:sock_file { getattr write };
Chris PeBenito 17de1b
	files_search_pids($1)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read munin configuration files.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito bbcd3c
## <rolecap/>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`munin_read_config',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type munin_etc_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 munin_etc_t:dir list_dir_perms;
Chris PeBenito 17de1b
	allow $1 munin_etc_t:file read_file_perms;
Chris PeBenito 17de1b
	allow $1 munin_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
	files_search_etc($1)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito da0423
##	Append to the munin log.
Chris PeBenito da0423
## </summary>
Chris PeBenito da0423
## <param name="domain">
Chris PeBenito da0423
##	<summary>
Chris PeBenito da0423
##	Domain allowed access.
Chris PeBenito da0423
##	</summary>
Chris PeBenito da0423
## </param>
Chris PeBenito da0423
## <rolecap/>
Chris PeBenito da0423
#
Chris PeBenito da0423
interface(`munin_append_log',`
Chris PeBenito da0423
	gen_require(`
Chris PeBenito da0423
		type munin_log_t;
Chris PeBenito da0423
	')
Chris PeBenito da0423
Chris PeBenito da0423
	logging_search_logs($1)
Chris PeBenito ce6fee
	allow $1 munin_log_t:dir list_dir_perms;
Chris PeBenito ce6fee
	append_files_pattern($1, munin_log_t, munin_log_t)
Chris PeBenito da0423
')
Chris PeBenito da0423
Chris PeBenito da0423
#######################################
Chris PeBenito da0423
## <summary>
Chris PeBenito 17de1b
##	Search munin library directories.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`munin_search_lib',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type munin_var_lib_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 munin_var_lib_t:dir search_dir_perms;
Chris PeBenito 17de1b
	files_search_var_lib($1)
Chris PeBenito 17de1b
')
Chris PeBenito 6c9118
Chris PeBenito 6c9118
#######################################
Chris PeBenito 6c9118
## <summary>
Chris PeBenito 6c9118
##	Do not audit attempts to search
Chris PeBenito 6c9118
##	munin library directories.
Chris PeBenito 6c9118
## </summary>
Chris PeBenito 6c9118
## <param name="domain">
Chris PeBenito 6c9118
##	<summary>
Dominick Grift 288845
##	Domain to not audit.
Chris PeBenito 6c9118
##	</summary>
Chris PeBenito 6c9118
## </param>
Chris PeBenito 6c9118
#
Chris PeBenito 6c9118
interface(`munin_dontaudit_search_lib',`
Chris PeBenito 6c9118
	gen_require(`
Chris PeBenito 6c9118
		type munin_var_lib_t;
Chris PeBenito 6c9118
	')
Chris PeBenito 6c9118
Chris PeBenito 6c9118
	dontaudit $1 munin_var_lib_t:dir search_dir_perms;
Chris PeBenito 6c9118
')
Chris PeBenito ce6fee
Chris PeBenito ce6fee
########################################
Chris PeBenito ce6fee
## <summary>
Chris PeBenito 24e0b9
##	All of the rules required to administrate
Chris PeBenito ce6fee
##	an munin environment
Chris PeBenito ce6fee
## </summary>
Chris PeBenito ce6fee
## <param name="domain">
Chris PeBenito ce6fee
##	<summary>
Chris PeBenito ce6fee
##	Domain allowed access.
Chris PeBenito ce6fee
##	</summary>
Chris PeBenito ce6fee
## </param>
Chris PeBenito ce6fee
## <param name="role">
Chris PeBenito ce6fee
##	<summary>
Chris PeBenito ce6fee
##	The role to be allowed to manage the munin domain.
Chris PeBenito ce6fee
##	</summary>
Chris PeBenito ce6fee
## </param>
Chris PeBenito ce6fee
## <rolecap/>
Chris PeBenito ce6fee
#
Chris PeBenito ce6fee
interface(`munin_admin',`
Chris PeBenito ce6fee
	gen_require(`
Chris PeBenito ce6fee
		type munin_t, munin_etc_t, munin_tmp_t;
Chris PeBenito ce6fee
		type munin_log_t, munin_var_lib_t, munin_var_run_t;
Chris PeBenito ce6fee
		type httpd_munin_content_t;
Chris PeBenito ce6fee
		type munin_initrc_exec_t;
Chris PeBenito ce6fee
	')
Chris PeBenito ce6fee
Chris PeBenito ce6fee
	allow $1 munin_t:process { ptrace signal_perms };
Chris PeBenito ce6fee
	ps_process_pattern($1, munin_t)
Chris PeBenito ce6fee
Chris PeBenito ce6fee
	init_labeled_script_domtrans($1, munin_initrc_exec_t)
Chris PeBenito ce6fee
	domain_system_change_exemption($1)
Chris PeBenito ce6fee
	role_transition $2 munin_initrc_exec_t system_r;
Chris PeBenito ce6fee
	allow $2 system_r;
Chris PeBenito ce6fee
Chris PeBenito ce6fee
	files_list_tmp($1)
Chris PeBenito ce6fee
	admin_pattern($1, munin_tmp_t)
Chris PeBenito ce6fee
Chris PeBenito ce6fee
	logging_list_logs($1)
Chris PeBenito ce6fee
	admin_pattern($1, munin_log_t)
Chris PeBenito ce6fee
Chris PeBenito ce6fee
	files_list_etc($1)
Chris PeBenito ce6fee
	admin_pattern($1, munin_etc_t)
Chris PeBenito ce6fee
Chris PeBenito ce6fee
	files_list_var_lib($1)
Chris PeBenito ce6fee
	admin_pattern($1, munin_var_lib_t)
Chris PeBenito ce6fee
Chris PeBenito ce6fee
	files_list_pids($1)
Chris PeBenito ce6fee
	admin_pattern($1, munin_var_run_t)
Chris PeBenito ce6fee
Chris PeBenito ce6fee
	admin_pattern($1, httpd_munin_content_t)
Chris PeBenito ce6fee
')