Chris PeBenito ab58ad
# DESC: selinux policy for stunnel
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author:   petre rodan <kaiowas@gentoo.org>
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
ifdef(`distro_gentoo', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
daemon_domain(stunnel)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
can_network(stunnel_t)
Chris PeBenito ab58ad
allow stunnel_t port_type:tcp_socket name_connect;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow stunnel_t self:capability { setgid setuid sys_chroot };
Chris PeBenito ab58ad
allow stunnel_t self:fifo_file { read write };
Chris PeBenito ab58ad
allow stunnel_t self:tcp_socket { read write };
Chris PeBenito ab58ad
allow stunnel_t self:unix_stream_socket { connect create };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
r_dir_file(stunnel_t, etc_t)
Chris PeBenito ab58ad
', `
Chris PeBenito ab58ad
inetd_child_domain(stunnel, tcp)
Chris PeBenito ab58ad
allow stunnel_t self:capability sys_chroot;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
bool stunnel_is_daemon false;
Chris PeBenito ab58ad
if (stunnel_is_daemon) {
Chris PeBenito ab58ad
# Policy to run stunnel as a daemon should go here.
Chris PeBenito ab58ad
allow stunnel_t self:tcp_socket rw_stream_socket_perms;
Chris PeBenito ab58ad
allow stunnel_t stunnel_port_t:tcp_socket name_bind;
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
type stunnel_etc_t, file_type, sysadmfile;
Chris PeBenito ab58ad
r_dir_file(stunnel_t, stunnel_etc_t)
Chris PeBenito ab58ad
allow stunnel_t stunnel_port_t:tcp_socket { name_bind };
Chris PeBenito ab58ad