Chris PeBenito 9570b2
policy_module(stunnel, 1.9.0)
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 0bfccd
domain_entry_file(stunnel_t, stunnel_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`distro_gentoo',`
Chris PeBenito 0bfccd
	init_daemon_domain(stunnel_t, stunnel_exec_t)
Chris PeBenito 17de1b
',`
Chris PeBenito 0bfccd
	inetd_tcp_service_domain(stunnel_t, stunnel_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type stunnel_etc_t;
Chris PeBenito 8a948c
files_config_file(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 c0868a
allow stunnel_t self:fifo_file rw_fifo_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 17de1b
Chris PeBenito 0b36a2
allow stunnel_t stunnel_etc_t:dir list_dir_perms;
Chris PeBenito 0b36a2
allow stunnel_t stunnel_etc_t:file read_file_perms;
Chris PeBenito 17de1b
allow stunnel_t stunnel_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
manage_dirs_pattern(stunnel_t, stunnel_tmp_t, stunnel_tmp_t)
Chris PeBenito 0bfccd
manage_files_pattern(stunnel_t, stunnel_tmp_t, stunnel_tmp_t)
Chris PeBenito 17de1b
files_tmp_filetrans(stunnel_t, stunnel_tmp_t, { file dir })
Chris PeBenito 17de1b
Dan Walsh 3eaa99
manage_dirs_pattern(stunnel_t, stunnel_var_run_t, stunnel_var_run_t)
Chris PeBenito 0bfccd
manage_files_pattern(stunnel_t, stunnel_var_run_t, stunnel_var_run_t)
Dan Walsh 3eaa99
files_pid_filetrans(stunnel_t, stunnel_var_run_t, { file dir })
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 8f800d
corecmd_exec_bin(stunnel_t)
Chris PeBenito 8f800d
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(stunnel_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(stunnel_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(stunnel_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(stunnel_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(stunnel_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(stunnel_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(stunnel_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(stunnel_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(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 c0cf6e
auth_use_nsswitch(stunnel_t)
Chris PeBenito c0cf6e
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
	domain_use_interactive_fds(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	userdom_dontaudit_use_unpriv_user_fds(stunnel_t)
Chris PeBenito 296273
	userdom_dontaudit_search_user_home_dirs(stunnel_t)
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 6073ea
		seutil_sigchld_newrole(stunnel_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 6073ea
		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 8f800d
	files_read_etc_runtime_files(stunnel_t)
Chris PeBenito 17de1b
	files_search_home(stunnel_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 6073ea
		kerberos_use(stunnel_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 56e1b3
# hack since this port has no interfaces since it doesnt
Chris PeBenito 56e1b3
# have net_contexts
Chris PeBenito 56e1b3
gen_require(`
Chris PeBenito 56e1b3
	type stunnel_port_t;
Chris PeBenito 17de1b
')
Chris PeBenito 56e1b3
allow stunnel_t stunnel_port_t:tcp_socket name_bind;