Chris PeBenito 200f45
Chris PeBenito 200f45
policy_module(stunnel,1.0)
Chris PeBenito 200f45
Chris PeBenito 200f45
########################################
Chris PeBenito 200f45
#
Chris PeBenito 200f45
# Declarations
Chris PeBenito 200f45
#
Chris PeBenito 200f45
Chris PeBenito 200f45
type stunnel_t;
Chris PeBenito 200f45
domain_type(stunnel_t)
Chris PeBenito 200f45
role system_r types stunnel_t;
Chris PeBenito 200f45
Chris PeBenito 200f45
type stunnel_exec_t;
Chris PeBenito 200f45
domain_entry_file(stunnel_t,stunnel_exec_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
ifdef(`distro_gentoo',`
Chris PeBenito 200f45
	init_daemon_domain(stunnel_t,stunnel_exec_t)
Chris PeBenito 200f45
',`
Chris PeBenito 200f45
	inetd_tcp_service_domain(stunnel_t,stunnel_exec_t)
Chris PeBenito 200f45
')
Chris PeBenito 200f45
Chris PeBenito 200f45
type stunnel_etc_t;
Chris PeBenito 200f45
files_type(stunnel_etc_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
type stunnel_tmp_t;
Chris PeBenito 200f45
files_tmp_file(stunnel_tmp_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
type stunnel_var_run_t;
Chris PeBenito 200f45
files_pid_file(stunnel_var_run_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
########################################
Chris PeBenito 200f45
#
Chris PeBenito 200f45
# Local policy
Chris PeBenito 200f45
#
Chris PeBenito 200f45
Chris PeBenito 200f45
allow stunnel_t self:capability { setgid setuid sys_chroot };
Chris PeBenito 200f45
allow stunnel_t self:process signal_perms;
Chris PeBenito 200f45
allow stunnel_t self:fifo_file rw_file_perms;
Chris PeBenito 200f45
allow stunnel_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 200f45
Chris PeBenito 200f45
allow stunnel_t stunnel_etc_t:dir { getattr read search };
Chris PeBenito 200f45
allow stunnel_t stunnel_etc_t:file { read getattr };
Chris PeBenito 200f45
allow stunnel_t stunnel_etc_t:lnk_file { getattr read };
Chris PeBenito 200f45
Chris PeBenito 200f45
allow stunnel_t stunnel_tmp_t:dir create_dir_perms;
Chris PeBenito 200f45
allow stunnel_t stunnel_tmp_t:file create_file_perms;
Chris PeBenito 200f45
files_create_tmp_files(stunnel_t, stunnel_tmp_t, { file dir })
Chris PeBenito 200f45
Chris PeBenito 200f45
allow stunnel_t stunnel_var_run_t:file create_file_perms;
Chris PeBenito 200f45
allow stunnel_t stunnel_var_run_t:dir rw_dir_perms;
Chris PeBenito 200f45
files_create_pid(stunnel_t,stunnel_var_run_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
kernel_read_kernel_sysctl(stunnel_t)
Chris PeBenito 200f45
kernel_read_system_state(stunnel_t)
Chris PeBenito 200f45
kernel_read_network_state(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
corenet_tcp_sendrecv_all_if(stunnel_t)
Chris PeBenito 200f45
corenet_udp_sendrecv_all_if(stunnel_t)
Chris PeBenito 200f45
corenet_raw_sendrecv_all_if(stunnel_t)
Chris PeBenito 200f45
corenet_tcp_sendrecv_all_nodes(stunnel_t)
Chris PeBenito 200f45
corenet_udp_sendrecv_all_nodes(stunnel_t)
Chris PeBenito 200f45
corenet_raw_sendrecv_all_nodes(stunnel_t)
Chris PeBenito 200f45
corenet_tcp_sendrecv_all_ports(stunnel_t)
Chris PeBenito 200f45
corenet_udp_sendrecv_all_ports(stunnel_t)
Chris PeBenito 200f45
corenet_tcp_bind_all_nodes(stunnel_t)
Chris PeBenito 200f45
corenet_udp_bind_all_nodes(stunnel_t)
Chris PeBenito 200f45
#corenet_tcp_bind_stunnel_port(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
fs_getattr_all_fs(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
libs_use_ld_so(stunnel_t)
Chris PeBenito 200f45
libs_use_shared_libs(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
logging_send_syslog_msg(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
miscfiles_read_localization(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
sysnet_read_config(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
ifdef(`distro_gentoo', `
Chris PeBenito 200f45
	dontaudit stunnel_t self:capability sys_tty_config;
Chris PeBenito 200f45
	allow stunnel_t self:udp_socket create_socket_perms;
Chris PeBenito 200f45
Chris PeBenito 200f45
	dev_read_sysfs(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	fs_search_auto_mountpoints(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	term_dontaudit_use_console(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	domain_use_wide_inherit_fd(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	init_use_fd(stunnel_t)
Chris PeBenito 200f45
	init_use_script_pty(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	userdom_dontaudit_use_unpriv_user_fd(stunnel_t)
Chris PeBenito 200f45
	userdom_dontaudit_search_sysadm_home_dir(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	ifdef(`targeted_policy', `
Chris PeBenito 200f45
        	term_dontaudit_use_unallocated_tty(stunnel_t)
Chris PeBenito 200f45
        	term_dontaudit_use_generic_pty(stunnel_t)
Chris PeBenito 200f45
        	files_dontaudit_read_root_file(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito 200f45
	optional_policy(`mount.te',`
Chris PeBenito 200f45
        	mount_send_nfs_client_request(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito 200f45
	optional_policy(`selinuxutil.te',`
Chris PeBenito 200f45
        	seutil_sigchld_newrole(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito 200f45
	optional_policy(`udev.te', `
Chris PeBenito 200f45
        	udev_read_db(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito 200f45
	ifdef(`TODO',`
Chris PeBenito 200f45
	optional_policy(`rhgb.te',`
Chris PeBenito 200f45
        	rhgb_domain(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
	') dnl end TODO
Chris PeBenito 200f45
', `
Chris PeBenito 200f45
	allow stunnel_t self:netlink_tcpdiag_socket r_netlink_socket_perms;
Chris PeBenito 200f45
Chris PeBenito 200f45
	dev_read_urand(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	files_read_etc_files(stunnel_t)
Chris PeBenito 200f45
	files_search_home(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	optional_policy(`kerberos.te',`
Chris PeBenito 200f45
        	kerberos_use(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito 200f45
	optional_policy(`nis.te',`
Chris PeBenito 200f45
        	nis_use_ypbind(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito 200f45
	optional_policy(`nscd.te',`
Chris PeBenito 200f45
        	nscd_use_socket(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
')