Chris PeBenito 17de1b
Chris PeBenito 32103f
policy_module(openvpn, 1.9.1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 72f82c
## <desc>
Chris PeBenito 72f82c
## 

Chris PeBenito 72f82c
## Allow openvpn to read home directories
Chris PeBenito 72f82c
## 

Chris PeBenito 72f82c
## </desc>
Chris PeBenito 0bfccd
gen_tunable(openvpn_enable_homedirs, false)
Chris PeBenito 72f82c
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 967fd1
files_config_file(openvpn_etc_t)
Chris PeBenito 967fd1
Chris PeBenito 8f800d
type openvpn_etc_rw_t;
Chris PeBenito 8f800d
files_config_file(openvpn_etc_rw_t)
Chris PeBenito 8f800d
Chris PeBenito 967fd1
type openvpn_initrc_exec_t;
Chris PeBenito 967fd1
init_script_file(openvpn_initrc_exec_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
Jeremy Solt d3b590
allow openvpn_t self:capability { dac_read_search dac_override ipc_lock net_bind_service net_admin setgid setuid sys_chroot sys_tty_config };
Chris PeBenito 72f82c
allow openvpn_t self:process { signal getsched };
Chris PeBenito 8f800d
allow openvpn_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 72f82c
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 6b19be
allow openvpn_t self:tcp_socket server_stream_socket_perms;
Paul Moore 9dc3cd
allow openvpn_t self:tun_socket create;
Chris PeBenito a5e213
allow openvpn_t self:netlink_route_socket rw_netlink_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 967fd1
can_exec(openvpn_t, openvpn_etc_t)
Chris PeBenito 0bfccd
read_files_pattern(openvpn_t, openvpn_etc_t, openvpn_etc_t)
Chris PeBenito 0bfccd
read_lnk_files_pattern(openvpn_t, openvpn_etc_t, openvpn_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 8f800d
manage_files_pattern(openvpn_t, openvpn_etc_t, openvpn_etc_rw_t)
Chris PeBenito 8f800d
filetrans_pattern(openvpn_t, openvpn_etc_t, openvpn_etc_rw_t, file)
Chris PeBenito 8f800d
Chris PeBenito c0868a
allow openvpn_t openvpn_var_log_t:file manage_file_perms;
Chris PeBenito 0bfccd
logging_log_filetrans(openvpn_t, openvpn_var_log_t, file)
Chris PeBenito 17de1b
Chris PeBenito 72f82c
manage_files_pattern(openvpn_t, openvpn_var_run_t, openvpn_var_run_t)
Chris PeBenito 72f82c
files_pid_filetrans(openvpn_t, openvpn_var_run_t, { file dir })
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_shell(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(openvpn_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(openvpn_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(openvpn_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_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 c12621
corenet_tcp_bind_generic_node(openvpn_t)
Chris PeBenito c12621
corenet_udp_bind_generic_node(openvpn_t)
Chris PeBenito 17de1b
corenet_tcp_bind_openvpn_port(openvpn_t)
Chris PeBenito 17de1b
corenet_udp_bind_openvpn_port(openvpn_t)
Jeremy Solt d3b590
corenet_tcp_bind_http_port(openvpn_t)
Chris PeBenito 72f82c
corenet_tcp_connect_openvpn_port(openvpn_t)
Chris PeBenito 967fd1
corenet_tcp_connect_http_port(openvpn_t)
Chris PeBenito f2f296
corenet_tcp_connect_http_cache_port(openvpn_t)
Chris PeBenito 967fd1
corenet_rw_tun_tap_dev(openvpn_t)
Chris PeBenito 967fd1
corenet_sendrecv_openvpn_server_packets(openvpn_t)
Chris PeBenito 967fd1
corenet_sendrecv_openvpn_client_packets(openvpn_t)
Chris PeBenito 967fd1
corenet_sendrecv_http_client_packets(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
Jeremy Solt d3b590
auth_use_pam(openvpn_t)
Jeremy Solt d3b590
Chris PeBenito 17de1b
logging_send_syslog_msg(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(openvpn_t)
Chris PeBenito 72f82c
miscfiles_read_certs(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 465510
sysnet_dns_name_resolve(openvpn_t)
Chris PeBenito 17de1b
sysnet_exec_ifconfig(openvpn_t)
Jeremy Solt d3b590
sysnet_manage_config(openvpn_t)
Chris PeBenito 8f800d
sysnet_etc_filetrans_config(openvpn_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
userdom_use_user_terminals(openvpn_t)
Chris PeBenito 296273
Chris PeBenito 72f82c
tunable_policy(`openvpn_enable_homedirs',`
Chris PeBenito 296273
	userdom_read_user_home_content_files(openvpn_t)
Chris PeBenito 72f82c
')
Chris PeBenito 72f82c
Chris PeBenito f2f296
tunable_policy(`openvpn_enable_homedirs && use_nfs_home_dirs',`
Chris PeBenito f2f296
        fs_read_nfs_files(openvpn_t)
Chris PeBenito f2f296
        fs_read_nfs_symlinks(openvpn_t)
Chris PeBenito f2f296
')  
Chris PeBenito f2f296
Chris PeBenito f2f296
tunable_policy(`openvpn_enable_homedirs && use_samba_home_dirs',`
Chris PeBenito f2f296
        fs_read_cifs_files(openvpn_t)
Chris PeBenito f2f296
        fs_read_cifs_symlinks(openvpn_t)
Chris PeBenito f2f296
')  
Chris PeBenito f2f296
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 0bfccd
	daemontools_service_domain(openvpn_t, openvpn_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 72f82c
Chris PeBenito 72f82c
optional_policy(`
Chris PeBenito 296273
	dbus_system_bus_client(openvpn_t)
Chris PeBenito 72f82c
	dbus_connect_system_bus(openvpn_t)
Chris PeBenito 72f82c
Chris PeBenito 72f82c
	networkmanager_dbus_chat(openvpn_t)
Chris PeBenito 72f82c
')