Chris PeBenito 200f45
Chris PeBenito 5ea24b
policy_module(stunnel,1.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 4614e8
allow stunnel_t self:udp_socket create_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 103fe2
files_tmp_filetrans(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 1c1ac6
files_pid_filetrans(stunnel_t,stunnel_var_run_t,file)
Chris PeBenito 200f45
Chris PeBenito 445522
kernel_read_kernel_sysctls(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 bd7037
corenet_non_ipsec_sendrecv(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 15722e
	domain_use_interactive_fds(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 1c1ac6
	init_use_fds(stunnel_t)
Chris PeBenito 1815ba
	init_use_script_ptys(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 15722e
	userdom_dontaudit_use_unpriv_user_fds(stunnel_t)
Chris PeBenito 103fe2
	userdom_dontaudit_search_sysadm_home_dirs(stunnel_t)
Chris PeBenito 200f45
Chris PeBenito 200f45
	ifdef(`targeted_policy', `
Chris PeBenito 1815ba
        	term_dontaudit_use_unallocated_ttys(stunnel_t)
Chris PeBenito 1815ba
        	term_dontaudit_use_generic_ptys(stunnel_t)
Chris PeBenito 9e04f5
        	files_dontaudit_read_root_files(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 44d5d9
		daemontools_service_domain(stunnel_t, stunnel_exec_t)
Chris PeBenito 44d5d9
	')
Chris PeBenito 44d5d9
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 200f45
        	mount_send_nfs_client_request(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 200f45
        	seutil_sigchld_newrole(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 200f45
        	udev_read_db(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 2629c6
',`
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 bb7170
	optional_policy(`
Chris PeBenito 200f45
        	kerberos_use(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 200f45
        	nis_use_ypbind(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 1815ba
        	nscd_socket_use(stunnel_t)
Chris PeBenito 200f45
	')
Chris PeBenito 200f45
')
Chris PeBenito 4614e8
Chris PeBenito 4614e8
tunable_policy(`stunnel_is_daemon',`
Chris PeBenito 4614e8
	allow stunnel_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 4614e8
Chris PeBenito 4614e8
	# hack since this port has no interfaces since it doesnt
Chris PeBenito 4614e8
	# have net_contexts
Chris PeBenito 4614e8
	gen_require(`
Chris PeBenito 4614e8
		type stunnel_port_t;
Chris PeBenito 4614e8
	')
Chris PeBenito 4614e8
	allow stunnel_t stunnel_port_t:tcp_socket name_bind;
Chris PeBenito 4614e8
')