Chris PeBenito 29af4c
policy_module(ipsec, 1.11.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 832c1b
## <desc>
Chris PeBenito 832c1b
## 

Chris PeBenito 832c1b
## Allow racoon to read shadow
Chris PeBenito 832c1b
## 

Chris PeBenito 832c1b
## </desc>
Chris PeBenito 832c1b
gen_tunable(racoon_read_shadow, false)
Chris PeBenito 832c1b
Chris PeBenito 17de1b
type ipsec_t;
Chris PeBenito 17de1b
type ipsec_exec_t;
Chris PeBenito 3f67f7
init_daemon_domain(ipsec_t, ipsec_exec_t)
Chris PeBenito 17de1b
role system_r types ipsec_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# type for ipsec configuration file(s) - not for keys
Chris PeBenito 17de1b
type ipsec_conf_file_t;
Chris PeBenito 17de1b
files_type(ipsec_conf_file_t)
Chris PeBenito 17de1b
Chris PeBenito 832c1b
type ipsec_initrc_exec_t;
Chris PeBenito 832c1b
init_script_file(ipsec_initrc_exec_t)
Chris PeBenito 832c1b
Chris PeBenito 17de1b
# type for file(s) containing ipsec keys - RSA or preshared
Chris PeBenito 17de1b
type ipsec_key_file_t;
Chris PeBenito 17de1b
files_type(ipsec_key_file_t)
Chris PeBenito 17de1b
Chris PeBenito 90e65f
type ipsec_log_t;
Chris PeBenito 90e65f
logging_log_file(ipsec_log_t)
Chris PeBenito 90e65f
Chris PeBenito 6b19be
# Default type for IPSEC SPD entries
Chris PeBenito 6b19be
type ipsec_spd_t;
Chris PeBenito 6b19be
Chris PeBenito 90e65f
type ipsec_tmp_t;
Chris PeBenito 90e65f
files_tmp_file(ipsec_tmp_t)
Chris PeBenito 90e65f
Chris PeBenito 17de1b
# type for runtime files, including pluto.ctl
Chris PeBenito 17de1b
type ipsec_var_run_t;
Chris PeBenito 17de1b
files_pid_file(ipsec_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ipsec_mgmt_t;
Chris PeBenito 17de1b
type ipsec_mgmt_exec_t;
Chris PeBenito 3f67f7
init_system_domain(ipsec_mgmt_t, ipsec_mgmt_exec_t)
Chris PeBenito 17de1b
corecmd_shell_entry_type(ipsec_mgmt_t)
Chris PeBenito 17de1b
role system_r types ipsec_mgmt_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ipsec_mgmt_lock_t;
Chris PeBenito 17de1b
files_lock_file(ipsec_mgmt_lock_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ipsec_mgmt_var_run_t;
Chris PeBenito 17de1b
files_pid_file(ipsec_mgmt_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 6b19be
type racoon_t;
Chris PeBenito 6b19be
type racoon_exec_t;
Chris PeBenito 3f67f7
init_daemon_domain(racoon_t, racoon_exec_t)
Chris PeBenito 6b19be
role system_r types racoon_t;
Chris PeBenito 6b19be
Chris PeBenito 832c1b
type racoon_tmp_t;
Chris PeBenito 832c1b
files_tmp_file(racoon_tmp_t)
Chris PeBenito 832c1b
Chris PeBenito 6b19be
type setkey_t;
Chris PeBenito 6b19be
type setkey_exec_t;
Chris PeBenito 3f67f7
init_system_domain(setkey_t, setkey_exec_t)
Chris PeBenito 6b19be
role system_r types setkey_t;
Chris PeBenito 6b19be
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# ipsec Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 90e65f
allow ipsec_t self:capability { net_admin dac_override dac_read_search setpcap sys_nice };
Dan Walsh 3eaa99
dontaudit ipsec_t self:capability { sys_ptrace sys_tty_config };
Chris PeBenito 832c1b
allow ipsec_t self:process { getcap setcap getsched signal setsched };
Chris PeBenito 17de1b
allow ipsec_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito d6605b
allow ipsec_t self:udp_socket create_socket_perms;
Chris PeBenito d6605b
allow ipsec_t self:key_socket create_socket_perms;
Chris PeBenito d6605b
allow ipsec_t self:fifo_file read_fifo_file_perms;
Chris PeBenito d6605b
allow ipsec_t self:netlink_xfrm_socket { create_netlink_socket_perms nlmsg_write };
Chris PeBenito 17de1b
Chris PeBenito 832c1b
allow ipsec_t ipsec_initrc_exec_t:file read_file_perms;
Chris PeBenito 832c1b
Chris PeBenito c0868a
allow ipsec_t ipsec_conf_file_t:dir list_dir_perms;
Chris PeBenito 3f67f7
read_files_pattern(ipsec_t, ipsec_conf_file_t, ipsec_conf_file_t)
Chris PeBenito 3f67f7
read_lnk_files_pattern(ipsec_t, ipsec_conf_file_t, ipsec_conf_file_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow ipsec_t ipsec_key_file_t:dir list_dir_perms;
Chris PeBenito 832c1b
manage_files_pattern(ipsec_t, ipsec_key_file_t, ipsec_key_file_t)
Chris PeBenito 3f67f7
read_lnk_files_pattern(ipsec_t, ipsec_key_file_t, ipsec_key_file_t)
Chris PeBenito 17de1b
Chris PeBenito 90e65f
manage_dirs_pattern(ipsec_t, ipsec_tmp_t, ipsec_tmp_t)
Chris PeBenito 90e65f
manage_files_pattern(ipsec_t, ipsec_tmp_t, ipsec_tmp_t)
Chris PeBenito 90e65f
files_tmp_filetrans(ipsec_t, ipsec_tmp_t, { dir file }) 
Chris PeBenito 90e65f
Dan Walsh 3eaa99
manage_dirs_pattern(ipsec_t, ipsec_var_run_t, ipsec_var_run_t)
Chris PeBenito e0ed76
manage_files_pattern(ipsec_t, ipsec_var_run_t, ipsec_var_run_t)
Chris PeBenito e0ed76
manage_sock_files_pattern(ipsec_t, ipsec_var_run_t, ipsec_var_run_t)
Dan Walsh 3eaa99
files_pid_filetrans(ipsec_t, ipsec_var_run_t, { dir file sock_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
can_exec(ipsec_t, ipsec_mgmt_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 26410d
# pluto runs an updown script (by calling popen()!) as this is by default
Chris PeBenito 17de1b
# a shell script, we need to find a way to make things work without
Chris PeBenito 17de1b
# letting all sorts of stuff possibly be run...
Chris PeBenito 17de1b
# so try flipping back into the ipsec_mgmt_t domain
Chris PeBenito 3f67f7
corecmd_shell_domtrans(ipsec_t, ipsec_mgmt_t)
Chris PeBenito 17de1b
allow ipsec_mgmt_t ipsec_t:fd use;
Chris PeBenito 832c1b
allow ipsec_mgmt_t ipsec_t:fifo_file rw_fifo_file_perms;
Dan Walsh 3eaa99
allow ipsec_mgmt_t ipsec_t:unix_stream_socket { read write };
Chris PeBenito 17de1b
allow ipsec_mgmt_t ipsec_t:process sigchld;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(ipsec_t)
Chris PeBenito 17de1b
kernel_list_proc(ipsec_t)
Chris PeBenito 17de1b
kernel_read_proc_symlinks(ipsec_t)
Chris PeBenito 17de1b
# allow pluto to access /proc/net/ipsec_eroute;
Chris PeBenito 17de1b
kernel_read_system_state(ipsec_t)
Chris PeBenito 17de1b
kernel_read_network_state(ipsec_t)
Chris PeBenito 17de1b
kernel_read_software_raid_state(ipsec_t)
Chris PeBenito 832c1b
kernel_request_load_module(ipsec_t)
Chris PeBenito 17de1b
kernel_getattr_core_if(ipsec_t)
Chris PeBenito 17de1b
kernel_getattr_message_if(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito e6985f
corecmd_exec_shell(ipsec_t)
Chris PeBenito e6985f
corecmd_exec_bin(ipsec_t)
Chris PeBenito e6985f
Chris PeBenito 17de1b
# Pluto needs network access
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(ipsec_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(ipsec_t)
Chris PeBenito 17de1b
corenet_raw_sendrecv_all_if(ipsec_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_nodes(ipsec_t)
Chris PeBenito 17de1b
corenet_raw_sendrecv_all_nodes(ipsec_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(ipsec_t)
Chris PeBenito 17de1b
corenet_tcp_bind_all_nodes(ipsec_t)
Chris PeBenito d6605b
corenet_udp_bind_all_nodes(ipsec_t)
Chris PeBenito 17de1b
corenet_tcp_bind_reserved_port(ipsec_t)
Chris PeBenito 17de1b
corenet_tcp_bind_isakmp_port(ipsec_t)
Chris PeBenito d6605b
corenet_udp_bind_isakmp_port(ipsec_t)
Chris PeBenito d6605b
corenet_udp_bind_ipsecnat_port(ipsec_t)
Chris PeBenito 17de1b
corenet_sendrecv_generic_server_packets(ipsec_t)
Chris PeBenito 17de1b
corenet_sendrecv_isakmp_server_packets(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(ipsec_t)
Chris PeBenito 17de1b
dev_read_rand(ipsec_t)
Chris PeBenito 17de1b
dev_read_urand(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito e6985f
domain_use_interactive_fds(ipsec_t)
Chris PeBenito e6985f
Chris PeBenito 832c1b
files_list_tmp(ipsec_t)
Chris PeBenito e6985f
files_read_etc_files(ipsec_t)
Chris PeBenito 832c1b
files_read_usr_files(ipsec_t)
Dan Walsh 3eaa99
files_dontaudit_search_home(ipsec_t)
Chris PeBenito e6985f
Chris PeBenito 17de1b
fs_getattr_all_fs(ipsec_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_console(ipsec_t)
Chris PeBenito c3c753
term_dontaudit_use_all_ttys(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito e6985f
auth_use_nsswitch(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(ipsec_t)
Chris PeBenito 17de1b
init_use_script_ptys(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 90e65f
sysnet_domtrans_ifconfig(ipsec_t)
Dan Walsh 3eaa99
sysnet_manage_config(ipsec_t)
Dan Walsh 3eaa99
sysnet_etc_filetrans_config(ipsec_t)
Chris PeBenito 90e65f
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(ipsec_t)
Chris PeBenito 296273
userdom_dontaudit_search_user_home_dirs(ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(ipsec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(ipsec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# ipsec_mgmt Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 90e65f
allow ipsec_mgmt_t self:capability { dac_override dac_read_search net_admin setpcap sys_nice };
Dan Walsh 3eaa99
dontaudit ipsec_mgmt_t self:capability { sys_ptrace sys_tty_config };
Dan Walsh 3eaa99
allow ipsec_mgmt_t self:process { getsched ptrace setrlimit setsched signal };
Chris PeBenito 17de1b
allow ipsec_mgmt_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito d6605b
allow ipsec_mgmt_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow ipsec_mgmt_t self:udp_socket create_socket_perms;
Chris PeBenito d6605b
allow ipsec_mgmt_t self:key_socket create_socket_perms;
Chris PeBenito 832c1b
allow ipsec_mgmt_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow ipsec_mgmt_t ipsec_mgmt_lock_t:file manage_file_perms;
Chris PeBenito 3f67f7
files_lock_filetrans(ipsec_mgmt_t, ipsec_mgmt_lock_t, file)
Chris PeBenito 17de1b
Chris PeBenito 90e65f
manage_dirs_pattern(ipsec_mgmt_t, ipsec_tmp_t, ipsec_tmp_t)
Chris PeBenito 90e65f
manage_files_pattern(ipsec_mgmt_t, ipsec_tmp_t, ipsec_tmp_t)
Chris PeBenito 90e65f
files_tmp_filetrans(ipsec_mgmt_t, ipsec_tmp_t, { dir file }) 
Chris PeBenito 90e65f
Chris PeBenito 90e65f
manage_files_pattern(ipsec_mgmt_t, ipsec_log_t, ipsec_log_t)
Chris PeBenito 90e65f
logging_log_filetrans(ipsec_mgmt_t, ipsec_log_t, file)
Chris PeBenito 90e65f
Chris PeBenito c0868a
allow ipsec_mgmt_t ipsec_mgmt_var_run_t:file manage_file_perms;
Chris PeBenito 3f67f7
files_pid_filetrans(ipsec_mgmt_t, ipsec_mgmt_var_run_t, file)
Chris PeBenito 17de1b
Chris PeBenito 3f67f7
manage_files_pattern(ipsec_mgmt_t, ipsec_var_run_t, ipsec_var_run_t)
Chris PeBenito 3f67f7
manage_lnk_files_pattern(ipsec_mgmt_t, ipsec_var_run_t, ipsec_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow ipsec_mgmt_t ipsec_var_run_t:sock_file manage_sock_file_perms;
Chris PeBenito 3f67f7
files_pid_filetrans(ipsec_mgmt_t, ipsec_var_run_t, sock_file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# _realsetup needs to be able to cat /var/run/pluto.pid,
Chris PeBenito 17de1b
# run ps on that pid, and delete the file
Chris PeBenito 3f67f7
read_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t)
Chris PeBenito 3f67f7
read_lnk_files_pattern(ipsec_mgmt_t, ipsec_t, ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# logger, running in ipsec_mgmt_t needs to use sockets
Chris PeBenito 17de1b
allow ipsec_mgmt_t self:unix_dgram_socket { create connect write };
Chris PeBenito 17de1b
allow ipsec_mgmt_t ipsec_t:unix_dgram_socket { create connect write };
Chris PeBenito 17de1b
Chris PeBenito 0b36a2
allow ipsec_mgmt_t ipsec_conf_file_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 3f67f7
manage_files_pattern(ipsec_mgmt_t, ipsec_key_file_t, ipsec_key_file_t)
Chris PeBenito 3f67f7
manage_lnk_files_pattern(ipsec_mgmt_t, ipsec_key_file_t, ipsec_key_file_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# whack needs to connect to pluto
Chris PeBenito 3f67f7
stream_connect_pattern(ipsec_mgmt_t, ipsec_var_run_t, ipsec_var_run_t, ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
can_exec(ipsec_mgmt_t, ipsec_mgmt_exec_t)
Chris PeBenito 17de1b
allow ipsec_mgmt_t ipsec_mgmt_exec_t:lnk_file read;
Chris PeBenito 17de1b
Chris PeBenito 3f67f7
domtrans_pattern(ipsec_mgmt_t, ipsec_exec_t, ipsec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_rw_net_sysctls(ipsec_mgmt_t)
Chris PeBenito 17de1b
# allow pluto to access /proc/net/ipsec_eroute;
Chris PeBenito 17de1b
kernel_read_system_state(ipsec_mgmt_t)
Chris PeBenito 17de1b
kernel_read_network_state(ipsec_mgmt_t)
Chris PeBenito 17de1b
kernel_read_software_raid_state(ipsec_mgmt_t)
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(ipsec_mgmt_t)
Chris PeBenito 17de1b
kernel_getattr_core_if(ipsec_mgmt_t)
Chris PeBenito 17de1b
kernel_getattr_message_if(ipsec_mgmt_t)
Chris PeBenito 17de1b
Dan Walsh 3eaa99
# don't audit using of lsof
Dan Walsh 3eaa99
dontaudit ipsec_mgmt_t self:capability sys_ptrace;
Dan Walsh 3eaa99
Dan Walsh 3eaa99
domain_dontaudit_getattr_all_sockets(ipsec_mgmt_t)
Dan Walsh 3eaa99
domain_dontaudit_getattr_all_pipes(ipsec_mgmt_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
dev_dontaudit_getattr_all_blk_files(ipsec_mgmt_t)
Dan Walsh 3eaa99
dev_dontaudit_getattr_all_chr_files(ipsec_mgmt_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
files_dontaudit_getattr_all_files(ipsec_mgmt_t)
Dan Walsh 3eaa99
files_dontaudit_getattr_all_sockets(ipsec_mgmt_t)
Chris PeBenito 17de1b
files_read_kernel_symbol_table(ipsec_mgmt_t)
Chris PeBenito 17de1b
files_getattr_kernel_modules(ipsec_mgmt_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# the default updown script wants to run route
Chris PeBenito 17de1b
# the ipsec wrapper wants to run /usr/bin/logger (should we put
Chris PeBenito 17de1b
# it in its own domain?)
Chris PeBenito 17de1b
corecmd_exec_bin(ipsec_mgmt_t)
Chris PeBenito d6605b
corecmd_exec_shell(ipsec_mgmt_t)
Chris PeBenito 17de1b
Chris PeBenito e6985f
dev_read_rand(ipsec_mgmt_t)
Chris PeBenito e6985f
dev_read_urand(ipsec_mgmt_t)
Chris PeBenito e6985f
Chris PeBenito 17de1b
domain_use_interactive_fds(ipsec_mgmt_t)
Chris PeBenito 17de1b
# denials when ps tries to search /proc. Do not audit these denials.
Dan Walsh 3eaa99
domain_dontaudit_read_all_domains_state(ipsec_mgmt_t)
Chris PeBenito 17de1b
# suppress audit messages about unnecessary socket access
Chris PeBenito 17de1b
# cjp: this seems excessive
Chris PeBenito 17de1b
domain_dontaudit_rw_all_udp_sockets(ipsec_mgmt_t)
Chris PeBenito 17de1b
domain_dontaudit_rw_all_key_sockets(ipsec_mgmt_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(ipsec_mgmt_t)
Chris PeBenito 17de1b
files_exec_etc_files(ipsec_mgmt_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(ipsec_mgmt_t)
Chris PeBenito 90e65f
files_read_usr_files(ipsec_mgmt_t)
Chris PeBenito 17de1b
files_dontaudit_getattr_default_dirs(ipsec_mgmt_t)
Chris PeBenito 17de1b
files_dontaudit_getattr_default_files(ipsec_mgmt_t)
Chris PeBenito 90e65f
files_list_tmp(ipsec_mgmt_t)
Chris PeBenito 17de1b
Chris PeBenito e6985f
fs_getattr_xattr_fs(ipsec_mgmt_t)
Chris PeBenito e6985f
fs_list_tmpfs(ipsec_mgmt_t)
Chris PeBenito e6985f
Chris PeBenito e6985f
term_use_console(ipsec_mgmt_t)
Dan Walsh 3eaa99
term_use_all_terms(ipsec_mgmt_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
auth_dontaudit_read_login_records(ipsec_mgmt_t)
Chris PeBenito e6985f
Dan Walsh 3eaa99
init_read_utmp(ipsec_mgmt_t)
Chris PeBenito 17de1b
init_use_script_ptys(ipsec_mgmt_t)
Chris PeBenito 17de1b
init_exec_script_files(ipsec_mgmt_t)
Chris PeBenito 17de1b
init_use_fds(ipsec_mgmt_t)
Chris PeBenito 90e65f
init_labeled_script_domtrans(ipsec_mgmt_t, ipsec_initrc_exec_t)
Chris PeBenito 17de1b
Chris PeBenito d6605b
logging_send_syslog_msg(ipsec_mgmt_t)
Chris PeBenito d6605b
Chris PeBenito 17de1b
miscfiles_read_localization(ipsec_mgmt_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
modutils_domtrans_insmod(ipsec_mgmt_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
seutil_dontaudit_search_config(ipsec_mgmt_t)
Chris PeBenito 17de1b
Dan Walsh 3eaa99
sysnet_manage_config(ipsec_mgmt_t)
Chris PeBenito 17de1b
sysnet_domtrans_ifconfig(ipsec_mgmt_t)
Dan Walsh 3eaa99
sysnet_etc_filetrans_config(ipsec_mgmt_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
userdom_use_user_terminals(ipsec_mgmt_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	consoletype_exec(ipsec_mgmt_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Dan Walsh 3eaa99
        hostname_exec(ipsec_mgmt_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
        dbus_system_bus_client(ipsec_mgmt_t)
Dan Walsh 3eaa99
        dbus_connect_system_bus(ipsec_mgmt_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
	optional_policy(`
Dan Walsh 3eaa99
	        networkmanager_dbus_chat(ipsec_mgmt_t)
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
        iptables_domtrans(ipsec_mgmt_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(ipsec_mgmt_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`TODO',`
Chris PeBenito 17de1b
# ideally it would not need this.  It wants to write to /root/.rnd
Chris PeBenito 17de1b
file_type_auto_trans(ipsec_mgmt_t, sysadm_home_dir_t, sysadm_home_t, file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow ipsec_mgmt_t dev_fs:file_class_set getattr;
Chris PeBenito 17de1b
') dnl end TODO
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
# Racoon local policy
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
Chris PeBenito 6b19be
allow racoon_t self:capability { net_admin net_bind_service };
Chris PeBenito 6b19be
allow racoon_t self:netlink_route_socket create_netlink_socket_perms;
Chris PeBenito 6b19be
allow racoon_t self:unix_dgram_socket { connect create ioctl write };
Chris PeBenito 6b19be
allow racoon_t self:netlink_selinux_socket { bind create read };
Chris PeBenito 6b19be
allow racoon_t self:udp_socket create_socket_perms;
Chris PeBenito d6605b
allow racoon_t self:key_socket create_socket_perms;
Chris PeBenito 832c1b
allow racoon_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 832c1b
Chris PeBenito 832c1b
manage_dirs_pattern(racoon_t, racoon_tmp_t, racoon_tmp_t)
Chris PeBenito 832c1b
manage_files_pattern(racoon_t, racoon_tmp_t, racoon_tmp_t)
Chris PeBenito 832c1b
files_tmp_filetrans(racoon_t, racoon_tmp_t, { dir file })
Chris PeBenito 832c1b
Chris PeBenito 832c1b
can_exec(racoon_t, racoon_exec_t)
Chris PeBenito 832c1b
Chris PeBenito 832c1b
can_exec(racoon_t, setkey_exec_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
# manage pid file
Chris PeBenito 3f67f7
manage_files_pattern(racoon_t, ipsec_var_run_t, ipsec_var_run_t)
Chris PeBenito 3f67f7
manage_sock_files_pattern(racoon_t, ipsec_var_run_t, ipsec_var_run_t)
Chris PeBenito 3f67f7
files_pid_filetrans(racoon_t, ipsec_var_run_t, file)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
allow racoon_t ipsec_conf_file_t:dir list_dir_perms;
Chris PeBenito 3f67f7
read_files_pattern(racoon_t, ipsec_conf_file_t, ipsec_conf_file_t)
Chris PeBenito 3f67f7
read_lnk_files_pattern(racoon_t, ipsec_conf_file_t, ipsec_conf_file_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
allow racoon_t ipsec_key_file_t:dir list_dir_perms;
Chris PeBenito 3f67f7
read_files_pattern(racoon_t, ipsec_key_file_t, ipsec_key_file_t)
Chris PeBenito 3f67f7
read_lnk_files_pattern(racoon_t, ipsec_key_file_t, ipsec_key_file_t)
Chris PeBenito 6b19be
Chris PeBenito ee6608
kernel_read_system_state(racoon_t)
Chris PeBenito 6b19be
kernel_read_network_state(racoon_t)
Chris PeBenito 90e65f
kernel_request_load_module(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito 832c1b
corecmd_exec_shell(racoon_t)
Chris PeBenito 832c1b
corecmd_exec_bin(racoon_t)
Chris PeBenito 832c1b
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(racoon_t)
Chris PeBenito d6605b
corenet_tcp_sendrecv_all_if(racoon_t)
Chris PeBenito d6605b
corenet_udp_sendrecv_all_if(racoon_t)
Chris PeBenito d6605b
corenet_tcp_sendrecv_all_nodes(racoon_t)
Chris PeBenito d6605b
corenet_udp_sendrecv_all_nodes(racoon_t)
Chris PeBenito 6b19be
corenet_tcp_bind_all_nodes(racoon_t)
Chris PeBenito ee6608
corenet_udp_bind_all_nodes(racoon_t)
Chris PeBenito 6b19be
corenet_udp_bind_isakmp_port(racoon_t)
Chris PeBenito ee6608
corenet_udp_bind_ipsecnat_port(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
dev_read_urand(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
# allow racoon to set contexts on ipsec policy and SAs
Chris PeBenito 6b19be
domain_ipsec_setcontext_all_domains(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
files_read_etc_files(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito 832c1b
fs_dontaudit_getattr_xattr_fs(racoon_t)
Chris PeBenito 832c1b
Chris PeBenito 6b19be
# allow racoon to use avc_has_perm to check context on proposed SA
Chris PeBenito 6b19be
selinux_compute_access_vector(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito d6605b
auth_use_nsswitch(racoon_t)
Chris PeBenito d6605b
Chris PeBenito e6985f
ipsec_setcontext_default_spd(racoon_t)
Chris PeBenito e6985f
Chris PeBenito 6b19be
locallogin_use_fds(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
logging_send_syslog_msg(racoon_t)
Chris PeBenito cdf98f
logging_send_audit_msgs(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
miscfiles_read_localization(racoon_t)
Chris PeBenito 6b19be
Chris PeBenito 832c1b
sysnet_exec_ifconfig(racoon_t)
Chris PeBenito 832c1b
Dan Walsh 3eaa99
auth_use_pam(racoon_t)
Dan Walsh 3eaa99
Chris PeBenito 832c1b
auth_can_read_shadow_passwords(racoon_t)
Chris PeBenito 832c1b
tunable_policy(`racoon_read_shadow',`
Chris PeBenito 832c1b
	auth_tunable_read_shadow(racoon_t)
Chris PeBenito 832c1b
')
Chris PeBenito 832c1b
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
# Setkey local policy
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
Chris PeBenito 6b19be
allow setkey_t self:capability net_admin;
Chris PeBenito d6605b
allow setkey_t self:key_socket create_socket_perms;
Chris PeBenito 6b19be
allow setkey_t self:netlink_route_socket create_netlink_socket_perms;
Chris PeBenito 6b19be
Chris PeBenito a26923
allow setkey_t ipsec_conf_file_t:dir list_dir_perms;
Chris PeBenito 3f67f7
read_files_pattern(setkey_t, ipsec_conf_file_t, ipsec_conf_file_t)
Chris PeBenito 3f67f7
read_lnk_files_pattern(setkey_t, ipsec_conf_file_t, ipsec_conf_file_t)
Chris PeBenito a26923
Chris PeBenito 90e65f
kernel_request_load_module(setkey_t)
Chris PeBenito 90e65f
Chris PeBenito 6b19be
# allow setkey utility to set contexts on SA's and policy
Chris PeBenito 6b19be
domain_ipsec_setcontext_all_domains(setkey_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
files_read_etc_files(setkey_t)
Chris PeBenito 6b19be
Chris PeBenito a26923
init_dontaudit_use_fds(setkey_t)
Dan Walsh 3eaa99
init_read_script_tmp_files(setkey_t)
Chris PeBenito a26923
Chris PeBenito bdccba
# allow setkey to set the context for ipsec SAs and policy.
Chris PeBenito bdccba
ipsec_setcontext_default_spd(setkey_t)
Chris PeBenito bdccba
Chris PeBenito 6b19be
locallogin_use_fds(setkey_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
miscfiles_read_localization(setkey_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
seutil_read_config(setkey_t)
Chris PeBenito 296273
Chris PeBenito 296273
userdom_use_user_terminals(setkey_t)
Dan Walsh 3eaa99
userdom_read_user_tmp_files(setkey_t)