Chris PeBenito 17de1b
Chris PeBenito 5dbda5
policy_module(stunnel,1.1.3)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type stunnel_t;
Chris PeBenito 17de1b
domain_type(stunnel_t)
Chris PeBenito 17de1b
role system_r types stunnel_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type stunnel_exec_t;
Chris PeBenito 17de1b
domain_entry_file(stunnel_t,stunnel_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`distro_gentoo',`
Chris PeBenito 17de1b
	init_daemon_domain(stunnel_t,stunnel_exec_t)
Chris PeBenito 17de1b
',`
Chris PeBenito 17de1b
	inetd_tcp_service_domain(stunnel_t,stunnel_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type stunnel_etc_t;
Chris PeBenito 17de1b
files_type(stunnel_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type stunnel_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(stunnel_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type stunnel_var_run_t;
Chris PeBenito 17de1b
files_pid_file(stunnel_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow stunnel_t self:capability { setgid setuid sys_chroot };
Chris PeBenito 17de1b
allow stunnel_t self:process signal_perms;
Chris PeBenito 17de1b
allow stunnel_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
allow stunnel_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow stunnel_t self:udp_socket create_socket_perms;
Chris PeBenito 5dbda5
allow stunnel_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow stunnel_t stunnel_etc_t:dir { getattr read search };
Chris PeBenito 17de1b
allow stunnel_t stunnel_etc_t:file { read getattr };
Chris PeBenito 17de1b
allow stunnel_t stunnel_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow stunnel_t stunnel_tmp_t:dir create_dir_perms;
Chris PeBenito 17de1b
allow stunnel_t stunnel_tmp_t:file create_file_perms;
Chris PeBenito 17de1b
files_tmp_filetrans(stunnel_t, stunnel_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow stunnel_t stunnel_var_run_t:file create_file_perms;
Chris PeBenito 17de1b
allow stunnel_t stunnel_var_run_t:dir rw_dir_perms;
Chris PeBenito 17de1b
files_pid_filetrans(stunnel_t,stunnel_var_run_t,file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(stunnel_t)
Chris PeBenito 17de1b
kernel_read_system_state(stunnel_t)
Chris PeBenito 17de1b
kernel_read_network_state(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corenet_non_ipsec_sendrecv(stunnel_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(stunnel_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_if(stunnel_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_nodes(stunnel_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_nodes(stunnel_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(stunnel_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(stunnel_t)
Chris PeBenito 17de1b
corenet_tcp_bind_all_nodes(stunnel_t)
Chris PeBenito 5dbda5
corenet_tcp_connect_all_ports(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(stunnel_t)
Chris PeBenito 17de1b
libs_use_shared_libs(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_read_config(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`distro_gentoo', `
Chris PeBenito 17de1b
	dontaudit stunnel_t self:capability sys_tty_config;
Chris PeBenito 17de1b
	allow stunnel_t self:udp_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	dev_read_sysfs(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	fs_search_auto_mountpoints(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	term_dontaudit_use_console(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	domain_use_interactive_fds(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	init_use_fds(stunnel_t)
Chris PeBenito 17de1b
	init_use_script_ptys(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	userdom_dontaudit_use_unpriv_user_fds(stunnel_t)
Chris PeBenito 17de1b
	userdom_dontaudit_search_sysadm_home_dirs(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	ifdef(`targeted_policy', `
Chris PeBenito 17de1b
        	term_dontaudit_use_unallocated_ttys(stunnel_t)
Chris PeBenito 17de1b
        	term_dontaudit_use_generic_ptys(stunnel_t)
Chris PeBenito 17de1b
        	files_dontaudit_read_root_files(stunnel_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		daemontools_service_domain(stunnel_t, stunnel_exec_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
        	seutil_sigchld_newrole(stunnel_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
        	udev_read_db(stunnel_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
',`
Chris PeBenito 17de1b
	allow stunnel_t self:netlink_tcpdiag_socket r_netlink_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	dev_read_urand(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_read_etc_files(stunnel_t)
Chris PeBenito 17de1b
	files_search_home(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
        	kerberos_use(stunnel_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
        	nis_use_ypbind(stunnel_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
        	nscd_socket_use(stunnel_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`stunnel_is_daemon',`
Chris PeBenito 17de1b
	allow stunnel_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# hack since this port has no interfaces since it doesnt
Chris PeBenito 17de1b
	# have net_contexts
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type stunnel_port_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
	allow stunnel_t stunnel_port_t:tcp_socket name_bind;
Chris PeBenito 17de1b
')