## Simple network management protocol services.
########################################
##
## Send null signals to snmp.
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_signull',`
gen_require(`
type snmpd_t;
')
allow $1 snmpd_t:process signull;
')
########################################
##
## Connect to snmpd with a unix
## domain stream socket.
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_stream_connect',`
gen_require(`
type snmpd_t, snmpd_var_lib_t;
')
files_search_var_lib($1)
stream_connect_pattern($1, snmpd_var_lib_t, snmpd_var_lib_t, snmpd_t)
')
########################################
##
## Connect to snmp over the TCP network.
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_tcp_connect',`
gen_require(`
type snmpd_t;
')
corenet_tcp_recvfrom_labeled($1, snmpd_t)
corenet_tcp_sendrecv_snmp_port($1)
corenet_tcp_connect_snmp_port($1)
corenet_sendrecv_snmp_client_packets($1)
')
########################################
##
## Send and receive UDP traffic to SNMP (Deprecated)
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_udp_chat',`
refpolicywarn(`$0($*) has been deprecated.')
')
########################################
##
## Read snmpd lib content.
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_read_snmp_var_lib_files',`
gen_require(`
type snmpd_var_lib_t;
')
files_search_var_lib($1)
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)
')
#######################################
##
## Read snmpd libraries directories
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_read_snmp_var_lib_dirs',`
gen_require(`
type snmpd_var_lib_t;
')
files_search_var_lib($1)
allow $1 snmpd_var_lib_t:dir list_dir_perms;
')
########################################
##
## Manage snmpd libraries directories
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_manage_var_lib_dirs',`
gen_require(`
type snmpd_var_lib_t;
')
allow $1 snmpd_var_lib_t:dir manage_dir_perms;
')
########################################
##
## Manage snmpd libraries.
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_manage_var_lib_files',`
gen_require(`
type snmpd_var_lib_t;
')
files_search_var_lib($1)
allow $1 snmpd_var_lib_t:dir list_dir_perms;
manage_files_pattern($1, snmpd_var_lib_t, snmpd_var_lib_t)
')
########################################
##
## Manage snmpd libraries.
##
##
##
## Domain allowed access.
##
##
#
interface(`snmp_manage_var_lib_sock_files',`
gen_require(`
type snmpd_var_lib_t;
')
files_search_var_lib($1)
allow $1 snmpd_var_lib_t:dir list_dir_perms;
manage_sock_files_pattern($1, snmpd_var_lib_t, snmpd_var_lib_t)
')
########################################
##
## Do not audit attempts to manage
## snmpd lib content.
##
##
##
## Domain to not audit.
##
##
#
interface(`snmp_dontaudit_manage_snmp_var_lib_files',`
gen_require(`
type snmpd_var_lib_t;
')
dontaudit $1 snmpd_var_lib_t:dir manage_dir_perms;
dontaudit $1 snmpd_var_lib_t:file manage_file_perms;
dontaudit $1 snmpd_var_lib_t:lnk_file manage_lnk_file_perms;
')
########################################
##
## Do not audit attempts to read
## snmpd lib content.
##
##
##
## Domain to not audit.
##
##
#
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 read_lnk_file_perms;
')
########################################
##
## Do not audit attempts to write
## snmpd lib files.
##
##
##
## Domain to not audit.
##
##
#
interface(`snmp_dontaudit_write_snmp_var_lib_files',`
gen_require(`
type snmpd_var_lib_t;
')
dontaudit $1 snmpd_var_lib_t:file write;
')
########################################
##
## All of the rules required to
## administrate an snmp environment.
##
##
##
## Domain allowed access.
##
##
##
##
## Role allowed access.
##
##
##
#
interface(`snmp_admin',`
gen_require(`
type snmpd_t, snmpd_log_t, snmpd_initrc_exec_t;
type snmpd_var_lib_t, snmpd_var_run_t;
')
allow $1 snmpd_t:process signal_perms;
ps_process_pattern($1, snmpd_t)
tunable_policy(`deny_ptrace',`',`
allow $1 snmpd_t:process ptrace;
')
init_labeled_script_domtrans($1, snmpd_initrc_exec_t)
domain_system_change_exemption($1)
role_transition $2 snmpd_initrc_exec_t system_r;
allow $2 system_r;
logging_list_logs($1)
admin_pattern($1, snmpd_log_t)
files_list_var_lib($1)
admin_pattern($1, snmpd_var_lib_t)
files_list_pids($1)
admin_pattern($1, snmpd_var_run_t)
')