selinux-policy/policy/modules/services/openvpn.te

152 lines
4.3 KiB
Plaintext
Raw Normal View History

2010-05-24 19:32:01 +00:00
policy_module(openvpn, 1.10.0)
2006-04-14 20:07:01 +00:00
########################################
#
# Declarations
#
2007-09-06 18:34:40 +00:00
## <desc>
## <p>
## Allow openvpn to read home directories
## </p>
2007-09-06 18:34:40 +00:00
## </desc>
gen_tunable(openvpn_enable_homedirs, false)
2007-09-06 18:34:40 +00:00
2006-04-14 20:07:01 +00:00
# main openvpn domain
type openvpn_t;
type openvpn_exec_t;
init_daemon_domain(openvpn_t, openvpn_exec_t)
# configuration files
type openvpn_etc_t;
2008-10-08 20:03:24 +00:00
files_config_file(openvpn_etc_t)
2009-03-23 14:56:43 +00:00
type openvpn_etc_rw_t;
files_config_file(openvpn_etc_rw_t)
2010-08-26 13:41:21 +00:00
type openvpn_tmp_t;
files_tmp_file(openvpn_tmp_t)
2008-10-08 20:03:24 +00:00
type openvpn_initrc_exec_t;
init_script_file(openvpn_initrc_exec_t)
2006-04-14 20:07:01 +00:00
# log files
type openvpn_var_log_t;
logging_log_file(openvpn_var_log_t)
# pid files
type openvpn_var_run_t;
files_pid_file(openvpn_var_run_t)
########################################
#
# openvpn local policy
#
allow openvpn_t self:capability { dac_read_search dac_override ipc_lock net_bind_service net_admin setgid setuid sys_chroot sys_tty_config };
2007-09-06 18:34:40 +00:00
allow openvpn_t self:process { signal getsched };
2009-03-23 14:56:43 +00:00
allow openvpn_t self:fifo_file rw_fifo_file_perms;
2006-04-14 20:07:01 +00:00
allow openvpn_t self:unix_dgram_socket { create_socket_perms sendto };
allow openvpn_t self:unix_stream_socket { create_stream_socket_perms connectto };
allow openvpn_t self:udp_socket create_socket_perms;
allow openvpn_t self:tcp_socket server_stream_socket_perms;
allow openvpn_t self:tun_socket { create_socket_perms relabelfrom };
allow openvpn_t self:netlink_route_socket rw_netlink_socket_perms;
2006-04-14 20:07:01 +00:00
2008-10-08 20:03:24 +00:00
can_exec(openvpn_t, openvpn_etc_t)
read_files_pattern(openvpn_t, openvpn_etc_t, openvpn_etc_t)
read_lnk_files_pattern(openvpn_t, openvpn_etc_t, openvpn_etc_t)
2006-04-14 20:07:01 +00:00
2009-03-23 14:56:43 +00:00
manage_files_pattern(openvpn_t, openvpn_etc_t, openvpn_etc_rw_t)
filetrans_pattern(openvpn_t, openvpn_etc_t, openvpn_etc_rw_t, file)
2010-08-26 13:41:21 +00:00
manage_files_pattern(openvpn_t, openvpn_tmp_t, openvpn_tmp_t)
files_tmp_filetrans(openvpn_t, openvpn_tmp_t, file)
2006-12-12 20:08:08 +00:00
allow openvpn_t openvpn_var_log_t:file manage_file_perms;
logging_log_filetrans(openvpn_t, openvpn_var_log_t, file)
2006-04-14 20:07:01 +00:00
2010-08-26 13:41:21 +00:00
manage_dirs_pattern(openvpn_t, openvpn_var_run_t, openvpn_var_run_t)
2007-09-06 18:34:40 +00:00
manage_files_pattern(openvpn_t, openvpn_var_run_t, openvpn_var_run_t)
files_pid_filetrans(openvpn_t, openvpn_var_run_t, { file dir })
2006-04-14 20:07:01 +00:00
kernel_read_kernel_sysctls(openvpn_t)
2006-04-14 20:07:01 +00:00
kernel_read_net_sysctls(openvpn_t)
kernel_read_network_state(openvpn_t)
kernel_read_system_state(openvpn_t)
2010-08-26 13:41:21 +00:00
kernel_request_load_module(openvpn_t)
2006-04-14 20:07:01 +00:00
corecmd_exec_bin(openvpn_t)
corecmd_exec_shell(openvpn_t)
corenet_all_recvfrom_unlabeled(openvpn_t)
corenet_all_recvfrom_netlabel(openvpn_t)
corenet_tcp_sendrecv_generic_if(openvpn_t)
corenet_udp_sendrecv_generic_if(openvpn_t)
2006-04-14 20:07:01 +00:00
corenet_tcp_sendrecv_generic_node(openvpn_t)
corenet_udp_sendrecv_generic_node(openvpn_t)
corenet_tcp_sendrecv_all_ports(openvpn_t)
corenet_udp_sendrecv_all_ports(openvpn_t)
corenet_tcp_bind_generic_node(openvpn_t)
corenet_udp_bind_generic_node(openvpn_t)
2006-04-14 20:07:01 +00:00
corenet_tcp_bind_openvpn_port(openvpn_t)
corenet_udp_bind_openvpn_port(openvpn_t)
corenet_tcp_bind_http_port(openvpn_t)
2007-09-06 18:34:40 +00:00
corenet_tcp_connect_openvpn_port(openvpn_t)
2008-10-08 20:03:24 +00:00
corenet_tcp_connect_http_port(openvpn_t)
corenet_tcp_connect_http_cache_port(openvpn_t)
2008-10-08 20:03:24 +00:00
corenet_rw_tun_tap_dev(openvpn_t)
corenet_sendrecv_openvpn_server_packets(openvpn_t)
corenet_sendrecv_openvpn_client_packets(openvpn_t)
corenet_sendrecv_http_client_packets(openvpn_t)
2006-04-14 20:07:01 +00:00
dev_search_sysfs(openvpn_t)
2006-04-14 20:07:01 +00:00
dev_read_rand(openvpn_t)
dev_read_urand(openvpn_t)
files_read_etc_files(openvpn_t)
files_read_etc_runtime_files(openvpn_t)
auth_use_pam(openvpn_t)
2006-04-14 20:07:01 +00:00
logging_send_syslog_msg(openvpn_t)
miscfiles_read_localization(openvpn_t)
miscfiles_read_all_certs(openvpn_t)
2006-04-14 20:07:01 +00:00
sysnet_dns_name_resolve(openvpn_t)
2006-04-14 20:07:01 +00:00
sysnet_exec_ifconfig(openvpn_t)
sysnet_manage_config(openvpn_t)
2009-03-23 14:56:43 +00:00
sysnet_etc_filetrans_config(openvpn_t)
2006-04-14 20:07:01 +00:00
2008-11-05 16:10:46 +00:00
userdom_use_user_terminals(openvpn_t)
2010-08-26 13:41:21 +00:00
userdom_read_home_certs(openvpn_t)
userdom_attach_admin_tun_iface(openvpn_t)
2008-11-05 16:10:46 +00:00
2007-09-06 18:34:40 +00:00
tunable_policy(`openvpn_enable_homedirs',`
userdom_search_user_home_dirs(openvpn_t)
2007-09-06 18:34:40 +00:00
')
tunable_policy(`openvpn_enable_homedirs && use_nfs_home_dirs',`
fs_read_nfs_files(openvpn_t)
')
tunable_policy(`openvpn_enable_homedirs && use_samba_home_dirs',`
fs_read_cifs_files(openvpn_t)
')
2006-04-14 20:07:01 +00:00
optional_policy(`
daemontools_service_domain(openvpn_t, openvpn_exec_t)
2006-04-14 20:07:01 +00:00
')
2007-09-06 18:34:40 +00:00
optional_policy(`
2008-11-05 16:10:46 +00:00
dbus_system_bus_client(openvpn_t)
2007-09-06 18:34:40 +00:00
dbus_connect_system_bus(openvpn_t)
networkmanager_dbus_chat(openvpn_t)
')
2010-08-26 13:41:21 +00:00
optional_policy(`
unconfined_attach_tun_iface(openvpn_t)
')