## <summary>Network traffic graphing.</summary>

########################################
## <summary>
##	Read mrtg configuration
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`mrtg_read_config',`
	gen_require(`
		type mrtg_etc_t;
	')

	allow $1 mrtg_etc_t:file read_file_perms;
')

########################################
## <summary>
##	Create and append mrtg log files.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`mrtg_append_create_logs',`
	gen_require(`
		type mrtg_log_t;
	')

	logging_search_logs($1)
	append_files_pattern($1, mrtg_log_t, mrtg_log_t)
	create_files_pattern($1, mrtg_log_t, mrtg_log_t)
')

########################################
## <summary>
##	All of the rules required to
##	administrate an mrtg environment.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
## <param name="role">
##	<summary>
##	Role allowed access.
##	</summary>
## </param>
## <rolecap/>
#
interface(`mrtg_admin',`
	gen_require(`
		type mrtg_t, mrtg_runtime_t, mrtg_initrc_exec_t;
		type mrtg_var_lib_t, mrtg_lock_t, mrtg_log_t;
		type mrtg_etc_t;
	')

	allow $1 mrtg_t:process { ptrace signal_perms };
	ps_process_pattern($1, mrtg_t)

	init_startstop_service($1, $2, mrtg_t, mrtg_initrc_exec_t)

	files_search_etc($1)
	admin_pattern($1, mrtg_etc_t)

	files_search_locks($1)
	admin_pattern($1, mrtg_lock_t)

	logging_search_logs($1)
	admin_pattern($1, mrtg_log_t)

	files_search_runtime($1)
	admin_pattern($1, mrtg_runtime_t)

	files_search_var_lib($1)
	admin_pattern($1, mrtg_var_lib_t)
')
