diff --git a/refpolicy/Changelog b/refpolicy/Changelog index fb54e81..f068614 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -8,6 +8,7 @@ postgresql samba snmp + stunnel tftp vpn zebra diff --git a/refpolicy/policy/modules/services/stunnel.fc b/refpolicy/policy/modules/services/stunnel.fc new file mode 100644 index 0000000..e60e77e --- /dev/null +++ b/refpolicy/policy/modules/services/stunnel.fc @@ -0,0 +1,6 @@ + +/etc/stunnel(/.*)? context_template(system_u:object_r:stunnel_etc_t,s0) + +/usr/sbin/stunnel -- context_template(system_u:object_r:stunnel_exec_t,s0) + +/var/run/stunnel(/.*)? context_template(system_u:object_r:stunnel_var_run_t,s0) diff --git a/refpolicy/policy/modules/services/stunnel.if b/refpolicy/policy/modules/services/stunnel.if new file mode 100644 index 0000000..d137c27 --- /dev/null +++ b/refpolicy/policy/modules/services/stunnel.if @@ -0,0 +1 @@ +## SSL Tunneling Proxy diff --git a/refpolicy/policy/modules/services/stunnel.te b/refpolicy/policy/modules/services/stunnel.te new file mode 100644 index 0000000..26c99c1 --- /dev/null +++ b/refpolicy/policy/modules/services/stunnel.te @@ -0,0 +1,140 @@ + +policy_module(stunnel,1.0) + +######################################## +# +# Declarations +# + +type stunnel_t; +domain_type(stunnel_t) +role system_r types stunnel_t; + +type stunnel_exec_t; +domain_entry_file(stunnel_t,stunnel_exec_t) + +ifdef(`distro_gentoo',` + init_daemon_domain(stunnel_t,stunnel_exec_t) +',` + inetd_tcp_service_domain(stunnel_t,stunnel_exec_t) +') + +type stunnel_etc_t; +files_type(stunnel_etc_t) + +type stunnel_tmp_t; +files_tmp_file(stunnel_tmp_t) + +type stunnel_var_run_t; +files_pid_file(stunnel_var_run_t) + +######################################## +# +# Local policy +# + +allow stunnel_t self:capability { setgid setuid sys_chroot }; +allow stunnel_t self:process signal_perms; +allow stunnel_t self:fifo_file rw_file_perms; +allow stunnel_t self:tcp_socket create_stream_socket_perms; + +allow stunnel_t stunnel_etc_t:dir { getattr read search }; +allow stunnel_t stunnel_etc_t:file { read getattr }; +allow stunnel_t stunnel_etc_t:lnk_file { getattr read }; + +allow stunnel_t stunnel_tmp_t:dir create_dir_perms; +allow stunnel_t stunnel_tmp_t:file create_file_perms; +files_create_tmp_files(stunnel_t, stunnel_tmp_t, { file dir }) + +allow stunnel_t stunnel_var_run_t:file create_file_perms; +allow stunnel_t stunnel_var_run_t:dir rw_dir_perms; +files_create_pid(stunnel_t,stunnel_var_run_t) + +kernel_read_kernel_sysctl(stunnel_t) +kernel_read_system_state(stunnel_t) +kernel_read_network_state(stunnel_t) + +corenet_tcp_sendrecv_all_if(stunnel_t) +corenet_udp_sendrecv_all_if(stunnel_t) +corenet_raw_sendrecv_all_if(stunnel_t) +corenet_tcp_sendrecv_all_nodes(stunnel_t) +corenet_udp_sendrecv_all_nodes(stunnel_t) +corenet_raw_sendrecv_all_nodes(stunnel_t) +corenet_tcp_sendrecv_all_ports(stunnel_t) +corenet_udp_sendrecv_all_ports(stunnel_t) +corenet_tcp_bind_all_nodes(stunnel_t) +corenet_udp_bind_all_nodes(stunnel_t) +#corenet_tcp_bind_stunnel_port(stunnel_t) + +fs_getattr_all_fs(stunnel_t) + +libs_use_ld_so(stunnel_t) +libs_use_shared_libs(stunnel_t) + +logging_send_syslog_msg(stunnel_t) + +miscfiles_read_localization(stunnel_t) + +sysnet_read_config(stunnel_t) + +ifdef(`distro_gentoo', ` + dontaudit stunnel_t self:capability sys_tty_config; + allow stunnel_t self:udp_socket create_socket_perms; + + dev_read_sysfs(stunnel_t) + + fs_search_auto_mountpoints(stunnel_t) + + term_dontaudit_use_console(stunnel_t) + + domain_use_wide_inherit_fd(stunnel_t) + + init_use_fd(stunnel_t) + init_use_script_pty(stunnel_t) + + userdom_dontaudit_use_unpriv_user_fd(stunnel_t) + userdom_dontaudit_search_sysadm_home_dir(stunnel_t) + + ifdef(`targeted_policy', ` + term_dontaudit_use_unallocated_tty(stunnel_t) + term_dontaudit_use_generic_pty(stunnel_t) + files_dontaudit_read_root_file(stunnel_t) + ') + + optional_policy(`mount.te',` + mount_send_nfs_client_request(stunnel_t) + ') + + optional_policy(`selinuxutil.te',` + seutil_sigchld_newrole(stunnel_t) + ') + + optional_policy(`udev.te', ` + udev_read_db(stunnel_t) + ') + + ifdef(`TODO',` + optional_policy(`rhgb.te',` + rhgb_domain(stunnel_t) + ') + ') dnl end TODO +', ` + allow stunnel_t self:netlink_tcpdiag_socket r_netlink_socket_perms; + + dev_read_urand(stunnel_t) + + files_read_etc_files(stunnel_t) + files_search_home(stunnel_t) + + optional_policy(`kerberos.te',` + kerberos_use(stunnel_t) + ') + + optional_policy(`nis.te',` + nis_use_ypbind(stunnel_t) + ') + + optional_policy(`nscd.te',` + nscd_use_socket(stunnel_t) + ') +')