Chris PeBenito ccc597
Chris PeBenito ccc597
policy_module(snmp,1.0)
Chris PeBenito ccc597
Chris PeBenito ccc597
########################################
Chris PeBenito ccc597
#
Chris PeBenito ccc597
# Declarations
Chris PeBenito ccc597
#
Chris PeBenito ccc597
type snmpd_t;
Chris PeBenito ccc597
type snmpd_exec_t;
Chris PeBenito ccc597
init_daemon_domain(snmpd_t,snmpd_exec_t)
Chris PeBenito ccc597
Chris PeBenito 9bbc75
type snmpd_etc_t;
Chris PeBenito 9bbc75
files_config_file(snmpd_etc_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
type snmpd_log_t;
Chris PeBenito ccc597
logging_log_file(snmpd_log_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
type snmpd_var_run_t;
Chris PeBenito ccc597
files_pid_file(snmpd_var_run_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
type snmpd_var_lib_t;
Chris PeBenito ccc597
files_type(snmpd_var_lib_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
########################################
Chris PeBenito ccc597
#
Chris PeBenito ccc597
# Local policy
Chris PeBenito ccc597
#
Chris PeBenito ccc597
allow snmpd_t self:capability { dac_override kill net_admin sys_nice sys_tty_config };
Chris PeBenito 7ac225
dontaudit snmpd_t self:capability sys_tty_config;
Chris PeBenito ccc597
allow snmpd_t self:fifo_file rw_file_perms;
Chris PeBenito ccc597
allow snmpd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 77f6e2
allow snmpd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 77f6e2
allow snmpd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 162dfc
allow snmpd_t self:udp_socket connected_stream_socket_perms;
Chris PeBenito ccc597
Chris PeBenito ccc597
allow snmpd_t snmpd_etc_t:file { getattr read };
Chris PeBenito ccc597
Chris PeBenito ccc597
allow snmpd_t snmpd_log_t:file create_file_perms;
Chris PeBenito ccc597
logging_create_log(snmpd_t,snmpd_log_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
allow snmpd_t snmpd_var_lib_t:file create_file_perms;
Chris PeBenito 77f6e2
allow snmpd_t snmpd_var_lib_t:sock_file create_file_perms;
Chris PeBenito ccc597
allow snmpd_t snmpd_var_lib_t:dir create_dir_perms;
Chris PeBenito ccc597
files_create_usr(snmpd_t,snmpd_var_lib_t)
Chris PeBenito 77f6e2
files_create_var(snmpd_t,snmpd_var_lib_t,{ file dir sock_file })
Chris PeBenito ccc597
files_create_var_lib(snmpd_t,snmpd_var_lib_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
allow snmpd_t snmpd_var_run_t:file create_file_perms;
Chris PeBenito ccc597
allow snmpd_t snmpd_var_run_t:dir rw_dir_perms;
Chris PeBenito ccc597
files_create_pid(snmpd_t,snmpd_var_run_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
kernel_read_kernel_sysctl(snmpd_t)
Chris PeBenito ccc597
kernel_read_net_sysctl(snmpd_t)
Chris PeBenito ccc597
kernel_read_proc_symlinks(snmpd_t)
Chris PeBenito ccc597
kernel_read_system_state(snmpd_t)
Chris PeBenito ccc597
kernel_read_network_state(snmpd_t)
Chris PeBenito 44fc06
kernel_tcp_recvfrom(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
corenet_tcp_sendrecv_all_if(snmpd_t)
Chris PeBenito 162dfc
corenet_udp_sendrecv_all_if(snmpd_t)
Chris PeBenito ccc597
corenet_raw_sendrecv_all_if(snmpd_t)
Chris PeBenito ccc597
corenet_tcp_sendrecv_all_nodes(snmpd_t)
Chris PeBenito 162dfc
corenet_udp_sendrecv_all_nodes(snmpd_t)
Chris PeBenito ccc597
corenet_raw_sendrecv_all_nodes(snmpd_t)
Chris PeBenito ccc597
corenet_tcp_sendrecv_all_ports(snmpd_t)
Chris PeBenito 162dfc
corenet_udp_sendrecv_all_ports(snmpd_t)
Chris PeBenito ccc597
corenet_tcp_bind_all_nodes(snmpd_t)
Chris PeBenito 162dfc
corenet_udp_bind_all_nodes(snmpd_t)
Chris PeBenito ccc597
corenet_tcp_bind_snmp_port(snmpd_t)
Chris PeBenito ccc597
corenet_udp_bind_snmp_port(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
dev_list_sysfs(snmpd_t)
Chris PeBenito ccc597
dev_read_sysfs(snmpd_t)
Chris PeBenito ccc597
dev_read_urand(snmpd_t)
Chris PeBenito ccc597
dev_read_rand(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
fs_getattr_all_fs(snmpd_t)
Chris PeBenito ccc597
fs_search_auto_mountpoints(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
storage_dontaudit_read_fixed_disk(snmpd_t)
Chris PeBenito ccc597
storage_dontaudit_read_removable_device(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
term_dontaudit_use_console(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
corecmd_exec_bin(snmpd_t)
Chris PeBenito ccc597
corecmd_exec_sbin(snmpd_t)
Chris PeBenito ccc597
corecmd_exec_shell(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
domain_use_wide_inherit_fd(snmpd_t)
Chris PeBenito 77f6e2
domain_signull_all_domains(snmpd_t)
Chris PeBenito ccc597
domain_read_all_domains_state(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
files_read_etc_files(snmpd_t)
Chris PeBenito ccc597
files_read_usr_files(snmpd_t)
Chris PeBenito ccc597
files_read_etc_runtime_files(snmpd_t)
Chris PeBenito ccc597
files_search_home(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
init_read_script_pid(snmpd_t)
Chris PeBenito ccc597
init_use_fd(snmpd_t)
Chris PeBenito ccc597
init_use_script_pty(snmpd_t)
Chris PeBenito ccc597
init_dontaudit_write_script_pid(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
libs_use_ld_so(snmpd_t)
Chris PeBenito ccc597
libs_use_shared_libs(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
logging_send_syslog_msg(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
miscfiles_read_localization(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
seutil_dontaudit_search_config(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
sysnet_read_config(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
userdom_dontaudit_use_unpriv_user_fd(snmpd_t)
Chris PeBenito ccc597
userdom_dontaudit_search_sysadm_home_dir(snmpd_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
ifdef(`distro_redhat', `
Chris PeBenito ccc597
	optional_policy(`rpm.te', `
Chris PeBenito ccc597
		rpm_read_db(snmpd_t)
Chris PeBenito ccc597
	')
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito ccc597
ifdef(`targeted_policy', `
Chris PeBenito ccc597
	term_dontaudit_use_unallocated_tty(snmpd_t)
Chris PeBenito ccc597
	term_dontaudit_use_generic_pty(snmpd_t)
Chris PeBenito ccc597
	files_dontaudit_read_root_file(snmpd_t)
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito fa6757
optional_policy(`nis.te',`
Chris PeBenito fa6757
	nis_use_ypbind(snmpd_t)
Chris PeBenito fa6757
')
Chris PeBenito fa6757
Chris PeBenito ccc597
optional_policy(`nscd.te',`
Chris PeBenito ccc597
	nscd_use_socket(snmpd_t)
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito ccc597
optional_policy(`selinuxutil.te',`
Chris PeBenito ccc597
	seutil_sigchld_newrole(snmpd_t)
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito ccc597
optional_policy(`udev.te', `
Chris PeBenito ccc597
	udev_read_db(snmpd_t)
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito ccc597
ifdef(`TODO',`
Chris PeBenito ccc597
can_udp_send(sysadm_t, snmpd_t)
Chris PeBenito ccc597
can_udp_send(snmpd_t, sysadm_t)
Chris PeBenito ccc597
Chris PeBenito ccc597
ifdef(`distro_redhat', `
Chris PeBenito ccc597
	optional_policy(`rpm.te', `
Chris PeBenito ccc597
		dontaudit snmpd_t rpm_var_lib_t:dir write;
Chris PeBenito ccc597
		dontaudit snmpd_t rpm_var_lib_t:file write;
Chris PeBenito ccc597
	')
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito ccc597
dontaudit snmpd_t rpc_pipefs_t:dir getattr;
Chris PeBenito ccc597
allow snmpd_t rpc_pipefs_t:dir getattr;
Chris PeBenito ccc597
Chris PeBenito ccc597
optional_policy(`amanda.te', `
Chris PeBenito ccc597
	dontaudit snmpd_t amanda_dumpdates_t:file { getattr read };
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito ccc597
optional_policy(`cupsd.te', `
Chris PeBenito ccc597
	allow snmpd_t cupsd_rw_etc_t:file { getattr read };
Chris PeBenito ccc597
')
Chris PeBenito ccc597
Chris PeBenito ccc597
allow snmpd_t var_lib_nfs_t:dir search;
Chris PeBenito ccc597
Chris PeBenito ccc597
optional_policy(`rhgb.te',`
Chris PeBenito ccc597
	rhgb_domain(snmpd_t)
Chris PeBenito ccc597
')
Chris PeBenito ccc597
') dnl end TODO