Chris PeBenito 17de1b
Chris PeBenito 465510
policy_module(openvpn,1.0.3)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# main openvpn domain
Chris PeBenito 17de1b
type openvpn_t;
Chris PeBenito 17de1b
type openvpn_exec_t;
Chris PeBenito 17de1b
init_daemon_domain(openvpn_t, openvpn_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# configuration files
Chris PeBenito 17de1b
type openvpn_etc_t;
Chris PeBenito 17de1b
files_type(openvpn_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# log files
Chris PeBenito 17de1b
type openvpn_var_log_t;
Chris PeBenito 17de1b
logging_log_file(openvpn_var_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid files
Chris PeBenito 17de1b
type openvpn_var_run_t;
Chris PeBenito 17de1b
files_pid_file(openvpn_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# openvpn local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow openvpn_t self:capability { net_admin setgid setuid };
Chris PeBenito 17de1b
allow openvpn_t self:unix_dgram_socket { create_socket_perms sendto };
Chris PeBenito 17de1b
allow openvpn_t self:unix_stream_socket { create_stream_socket_perms connectto };
Chris PeBenito 17de1b
allow openvpn_t self:udp_socket create_socket_perms;
Chris PeBenito 17de1b
allow openvpn_t self:tcp_socket create_socket_perms;
Chris PeBenito 465510
allow openvpn_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow openvpn_t openvpn_etc_t:dir r_dir_perms;
Chris PeBenito 17de1b
allow openvpn_t openvpn_etc_t:file r_file_perms;
Chris PeBenito 17de1b
allow openvpn_t openvpn_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow openvpn_t openvpn_var_log_t:file create_file_perms;
Chris PeBenito 17de1b
logging_log_filetrans(openvpn_t,openvpn_var_log_t,file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow openvpn_t openvpn_var_run_t:file create_file_perms;
Chris PeBenito 17de1b
files_pid_filetrans(openvpn_t, openvpn_var_run_t, file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(openvpn_t)
Chris PeBenito 17de1b
kernel_read_net_sysctls(openvpn_t)
Chris PeBenito 17de1b
kernel_read_network_state(openvpn_t)
Chris PeBenito 17de1b
kernel_read_system_state(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(openvpn_t)
Chris PeBenito 17de1b
corecmd_exec_sbin(openvpn_t)
Chris PeBenito 17de1b
corecmd_exec_shell(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corenet_non_ipsec_sendrecv(openvpn_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(openvpn_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_if(openvpn_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_generic_node(openvpn_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_generic_node(openvpn_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(openvpn_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(openvpn_t)
Chris PeBenito 17de1b
corenet_tcp_bind_all_nodes(openvpn_t)
Chris PeBenito 17de1b
corenet_udp_bind_all_nodes(openvpn_t)
Chris PeBenito 17de1b
corenet_tcp_bind_openvpn_port(openvpn_t)
Chris PeBenito 17de1b
corenet_udp_bind_openvpn_port(openvpn_t)
Chris PeBenito 17de1b
corenet_sendrecv_openvpn_server_packets(openvpn_t)
Chris PeBenito 17de1b
corenet_rw_tun_tap_dev(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 465510
dev_search_sysfs(openvpn_t)
Chris PeBenito 17de1b
dev_read_rand(openvpn_t)
Chris PeBenito 17de1b
dev_read_urand(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(openvpn_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 465510
init_use_fds(openvpn_t)
Chris PeBenito 465510
Chris PeBenito 17de1b
libs_use_ld_so(openvpn_t)
Chris PeBenito 17de1b
libs_use_shared_libs(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 465510
sysnet_dns_name_resolve(openvpn_t)
Chris PeBenito 17de1b
sysnet_exec_ifconfig(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 465510
	# Need to interact with terminals if config option "auth-user-pass" is used
Chris PeBenito 465510
	term_use_generic_ptys(openvpn_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	daemontools_service_domain(openvpn_t,openvpn_exec_t)
Chris PeBenito 17de1b
')