Blob Blame History Raw
## <summary>Simple network management protocol services</summary>

########################################
## <summary>
##	Use snmp over a TCP connection.  (Deprecated)
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`snmp_tcp_connect',`
	refpolicywarn(`$0($*) has been deprecated.')
')

########################################
## <summary>
##	Send and receive UDP traffic to SNMP  (Deprecated)
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`snmp_udp_chat',`
	refpolicywarn(`$0($*) has been deprecated.')
')

########################################
## <summary>
##	Read snmpd libraries.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`snmp_read_snmp_var_lib_files',`
	gen_require(`
		type snmpd_var_lib_t;
	')

	allow $1 snmpd_var_lib_t:dir list_dir_perms;
	read_files_pattern($1,snmpd_var_lib_t,snmpd_var_lib_t)
	read_lnk_files_pattern($1,snmpd_var_lib_t,snmpd_var_lib_t)
')

########################################
## <summary>
##	dontaudit Read snmpd libraries.
## </summary>
## <param name="domain">
##	<summary>
##	Domain to not audit.
##	</summary>
## </param>
#
interface(`snmp_dontaudit_read_snmp_var_lib_files',`
	gen_require(`
		type snmpd_var_lib_t;
	')
	dontaudit $1 snmpd_var_lib_t:dir list_dir_perms;
	dontaudit $1 snmpd_var_lib_t:file read_file_perms;
	dontaudit $1 snmpd_var_lib_t:lnk_file { getattr read };
')

########################################
## <summary>
##	dontaudit write snmpd libraries files.
## </summary>
## <param name="domain">
##	<summary>
##	Domain to not audit.
##	</summary>
## </param>
#
interface(`snmp_dontaudit_write_snmp_var_lib_files',`
	gen_require(`
		type snmpd_var_lib_t;
	')

	dontaudit $1 snmpd_var_lib_t:file write;
')

########################################
## <summary>
##	All of the rules required to administrate 
##	an snmp environment
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
## <param name="role">
##	<summary>
##	The role to be allowed to manage the snmp domain.
##	</summary>
## </param>
## <param name="terminal">
##	<summary>
##	The type of the user terminal.
##	</summary>
## </param>
## <rolecap/>
#
interface(`snmp_admin',`
	gen_require(`
		type snmp_t, snmp_log_t;
		type snmp_var_lib_t, snmp_var_run_t;
	')

	allow $1 snmp_t:process { ptrace signal_perms getattr };
	ps_process_pattern($1, snmp_t)
	        
	logging_list_logs($1)
	manage_files_pattern($1, snmp_log_t, snmp_log_t)

	files_list_var_lib($1)
	manage_files_pattern($1, snmp_var_lib_t, snmp_var_lib_t)

	files_list_pids($1)
	manage_files_pattern($1, snmp_var_run_t, snmp_var_run_t)
')