|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
policy_module(ipsec,1.0)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
########################################
|
|
Chris PeBenito |
11633b |
#
|
|
Chris PeBenito |
11633b |
# Declarations
|
|
Chris PeBenito |
11633b |
#
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
type ipsec_t;
|
|
Chris PeBenito |
11633b |
type ipsec_exec_t;
|
|
Chris PeBenito |
11633b |
init_daemon_domain(ipsec_t,ipsec_exec_t)
|
|
Chris PeBenito |
11633b |
role system_r types ipsec_t;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
# type for ipsec configuration file(s) - not for keys
|
|
Chris PeBenito |
11633b |
type ipsec_conf_file_t;
|
|
Chris PeBenito |
3fd833 |
files_type(ipsec_conf_file_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
# type for file(s) containing ipsec keys - RSA or preshared
|
|
Chris PeBenito |
11633b |
type ipsec_key_file_t;
|
|
Chris PeBenito |
3fd833 |
files_type(ipsec_key_file_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
# type for runtime files, including pluto.ctl
|
|
Chris PeBenito |
11633b |
type ipsec_var_run_t;
|
|
Chris PeBenito |
11633b |
files_pid_file(ipsec_var_run_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
3fd833 |
type ipsec_mgmt_t;
|
|
Chris PeBenito |
11633b |
type ipsec_mgmt_exec_t;
|
|
Chris PeBenito |
11633b |
init_system_domain(ipsec_mgmt_t,ipsec_mgmt_exec_t)
|
|
Chris PeBenito |
11633b |
role system_r types ipsec_mgmt_t;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
type ipsec_mgmt_var_run_t;
|
|
Chris PeBenito |
11633b |
files_pid_file(ipsec_mgmt_var_run_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
########################################
|
|
Chris PeBenito |
11633b |
#
|
|
Chris PeBenito |
11633b |
# ipsec Local policy
|
|
Chris PeBenito |
11633b |
#
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_t self:capability { net_admin dac_override dac_read_search };
|
|
Chris PeBenito |
11633b |
dontaudit ipsec_t self:capability sys_tty_config;
|
|
Chris PeBenito |
11633b |
allow ipsec_t self:process signal;
|
|
Chris PeBenito |
3fd833 |
allow ipsec_t self:tcp_socket create_stream_socket_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_t self:key_socket { create write read setopt };
|
|
Chris PeBenito |
11633b |
allow ipsec_t self:fifo_file { read getattr };
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_conf_file_t:dir r_dir_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_conf_file_t:file r_file_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_conf_file_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_key_file_t:dir r_dir_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_key_file_t:file r_file_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_key_file_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_var_run_t:file create_file_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_var_run_t:sock_file create_file_perms;
|
|
Chris PeBenito |
11633b |
files_create_pid(ipsec_t,ipsec_var_run_t,{ file sock_file })
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
can_exec(ipsec_t, ipsec_mgmt_exec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
# pluto runs an updown script (by calling popen()!); as this is by default
|
|
Chris PeBenito |
11633b |
# a shell script, we need to find a way to make things work without
|
|
Chris PeBenito |
11633b |
# letting all sorts of stuff possibly be run...
|
|
Chris PeBenito |
11633b |
# so try flipping back into the ipsec_mgmt_t domain
|
|
Chris PeBenito |
11633b |
corecmd_shell_domtrans(ipsec_t,ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_mgmt_t:fd use;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_t:fd use;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_t:process sigchld;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
kernel_read_kernel_sysctl(ipsec_t)
|
|
Chris PeBenito |
11633b |
kernel_list_proc(ipsec_t)
|
|
Chris PeBenito |
11633b |
kernel_read_proc_symlinks(ipsec_t)
|
|
Chris PeBenito |
11633b |
# allow pluto to access /proc/net/ipsec_eroute;
|
|
Chris PeBenito |
11633b |
kernel_read_system_state(ipsec_t)
|
|
Chris PeBenito |
11633b |
kernel_read_network_state(ipsec_t)
|
|
Chris PeBenito |
11633b |
kernel_read_software_raid_state(ipsec_t)
|
|
Chris PeBenito |
11633b |
kernel_getattr_core(ipsec_t)
|
|
Chris PeBenito |
11633b |
kernel_getattr_message_if(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
3fd833 |
# Pluto needs network access
|
|
Chris PeBenito |
3fd833 |
corenet_tcp_sendrecv_all_if(ipsec_t)
|
|
Chris PeBenito |
3fd833 |
corenet_raw_sendrecv_all_if(ipsec_t)
|
|
Chris PeBenito |
3fd833 |
corenet_tcp_sendrecv_all_nodes(ipsec_t)
|
|
Chris PeBenito |
3fd833 |
corenet_raw_sendrecv_all_nodes(ipsec_t)
|
|
Chris PeBenito |
3fd833 |
corenet_tcp_sendrecv_all_ports(ipsec_t)
|
|
Chris PeBenito |
3fd833 |
corenet_tcp_bind_all_nodes(ipsec_t)
|
|
Chris PeBenito |
11633b |
corenet_udp_bind_reserved_port(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
dev_read_sysfs(ipsec_t)
|
|
Chris PeBenito |
11633b |
dev_read_rand(ipsec_t)
|
|
Chris PeBenito |
11633b |
dev_read_urand(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
fs_getattr_all_fs(ipsec_t)
|
|
Chris PeBenito |
11633b |
fs_search_auto_mountpoints(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
term_use_console(ipsec_t)
|
|
Chris PeBenito |
3fd833 |
term_dontaudit_use_all_user_ttys(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
corecmd_exec_shell(ipsec_t)
|
|
Chris PeBenito |
11633b |
corecmd_exec_bin(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
domain_use_wide_inherit_fd(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
files_read_etc_files(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
init_use_fd(ipsec_t)
|
|
Chris PeBenito |
11633b |
init_use_script_pty(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
libs_use_ld_so(ipsec_t)
|
|
Chris PeBenito |
11633b |
libs_use_shared_libs(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
logging_send_syslog_msg(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
miscfiles_read_localization(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
3fd833 |
sysnet_read_config(ipsec_t)
|
|
Chris PeBenito |
3fd833 |
|
|
Chris PeBenito |
11633b |
userdom_dontaudit_use_unpriv_user_fd(ipsec_t)
|
|
Chris PeBenito |
11633b |
userdom_dontaudit_search_sysadm_home_dir(ipsec_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
ifdef(`targeted_policy', `
|
|
Chris PeBenito |
11633b |
term_dontaudit_use_unallocated_tty(ipsec_t)
|
|
Chris PeBenito |
11633b |
term_dontaudit_use_generic_pty(ipsec_t)
|
|
Chris PeBenito |
11633b |
files_dontaudit_read_root_file(ipsec_t)
|
|
Chris PeBenito |
11633b |
')
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
11633b |
nis_use_ypbind(ipsec_t)
|
|
Chris PeBenito |
11633b |
')
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
optional_policy(`rhgb.te',`
|
|
Chris PeBenito |
11633b |
rhgb_domain(ipsec_t)
|
|
Chris PeBenito |
11633b |
')
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
optional_policy(`selinuxutils.te',`
|
|
Chris PeBenito |
11633b |
seutil_sigchld_newrole(ipsec_t)
|
|
Chris PeBenito |
11633b |
')
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
optional_policy(`udev.te', `
|
|
Chris PeBenito |
11633b |
udev_read_db(ipsec_t)
|
|
Chris PeBenito |
11633b |
')
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
########################################
|
|
Chris PeBenito |
11633b |
#
|
|
Chris PeBenito |
11633b |
# ipsec_mgmt Local policy
|
|
Chris PeBenito |
11633b |
#
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t self:capability { net_admin sys_tty_config dac_override dac_read_search };
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t self:process { signal setrlimit };
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t self:tcp_socket create_socket_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t self:udp_socket create_socket_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t self:key_socket { create setopt };
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_mgmt_var_run_t:file create_file_perms;
|
|
Chris PeBenito |
11633b |
files_create_pid(ipsec_mgmt_t,ipsec_mgmt_var_run_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_var_run_t:dir rw_dir_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_var_run_t:file create_file_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_var_run_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_var_run_t:sock_file create_file_perms;
|
|
Chris PeBenito |
11633b |
files_create_pid(ipsec_mgmt_t,ipsec_var_run_t,sock_file)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
# _realsetup needs to be able to cat /var/run/pluto.pid,
|
|
Chris PeBenito |
11633b |
# run ps on that pid, and delete the file
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_t:{ file lnk_file } r_file_perms;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
# logger, running in ipsec_mgmt_t needs to use sockets
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t self:unix_dgram_socket { create connect write };
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_t:unix_dgram_socket { create connect write };
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_conf_file_t:file { getattr read ioctl };
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_key_file_t:dir rw_dir_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_key_file_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
11633b |
# cjp: combo of file_type_auto_trans and rw_dir_create_file
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_key_file_t:file create_file_perms;
|
|
Chris PeBenito |
11633b |
files_create_etc_config(ipsec_mgmt_t,ipsec_key_file_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
# whack needs to connect to pluto
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_var_run_t:sock_file { read write };
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_t:unix_stream_socket { connectto read write };
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
can_exec(ipsec_mgmt_t, ipsec_exec_t)
|
|
Chris PeBenito |
11633b |
can_exec(ipsec_mgmt_t, ipsec_mgmt_exec_t)
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_mgmt_exec_t:lnk_file read;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
domain_auto_trans(ipsec_mgmt_t,ipsec_exec_t,ipsec_t)
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t ipsec_t:fd use;
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_mgmt_t:fd use;
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_mgmt_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
11633b |
allow ipsec_t ipsec_mgmt_t:process sigchld;
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
kernel_rw_net_sysctl(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
# allow pluto to access /proc/net/ipsec_eroute;
|
|
Chris PeBenito |
11633b |
kernel_read_system_state(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
kernel_read_network_state(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
kernel_read_software_raid_state(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
kernel_read_kernel_sysctl(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
kernel_getattr_core(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
kernel_getattr_message_if(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
bootloader_read_kernel_symbol_table(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
bootloader_getattr_kernel_modules(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
dev_read_rand(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
dev_read_urand(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
fs_getattr_xattr_fs(ipsec_mgmt_t)
|
|
Chris PeBenito |
a5f339 |
fs_list_tmpfs(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
term_use_console(ipsec_mgmt_t)
|
|
Chris PeBenito |
a5f339 |
term_dontaudit_getattr_unallocated_ttys(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
# the default updown script wants to run route
|
|
Chris PeBenito |
11633b |
corecmd_exec_sbin(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
# the ipsec wrapper wants to run /usr/bin/logger (should we put
|
|
Chris PeBenito |
11633b |
# it in its own domain?)
|
|
Chris PeBenito |
11633b |
corecmd_exec_bin(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
domain_use_wide_inherit_fd(ipsec_mgmt_t)
|
|
Chris PeBenito |
a5f339 |
# denials when ps tries to search /proc. Do not audit these denials.
|
|
Chris PeBenito |
a5f339 |
domain_dontaudit_list_all_domains_proc(ipsec_mgmt_t)
|
|
Chris PeBenito |
a5f339 |
# suppress audit messages about unnecessary socket access
|
|
Chris PeBenito |
a5f339 |
# cjp: this seems excessive
|
|
Chris PeBenito |
a5f339 |
domain_dontaudit_rw_all_udp_sockets(ipsec_mgmt_t)
|
|
Chris PeBenito |
a5f339 |
domain_dontaudit_rw_all_key_sockets(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
files_read_etc_files(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
files_exec_etc_files(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
files_read_etc_runtime_files(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
files_dontaudit_getattr_default_dir(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
files_dontaudit_getattr_default_files(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
# Allow scripts to use /var/locl/subsys/ipsec
|
|
Chris PeBenito |
11633b |
# cjp: need a lock type
|
|
Chris PeBenito |
11633b |
files_manage_generic_locks(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
init_use_script_pty(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
init_exec_script(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
init_use_fd(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
libs_use_ld_so(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
libs_use_shared_libs(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
miscfiles_read_localization(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
3fd833 |
modutils_domtrans_insmod(ipsec_mgmt_t)
|
|
Chris PeBenito |
3fd833 |
|
|
Chris PeBenito |
11633b |
seutil_dontaudit_search_config(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
sysnet_domtrans_ifconfig(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
userdom_use_sysadm_terms(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
optional_policy(`consoletype.te',`
|
|
Chris PeBenito |
11633b |
consoletype_exec(ipsec_mgmt_t)
|
|
Chris PeBenito |
11633b |
')
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
a5f339 |
optional_policy(`nscd.te',`
|
|
Chris PeBenito |
a5f339 |
nscd_use_socket(ipsec_mgmt_t)
|
|
Chris PeBenito |
a5f339 |
')
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
a5f339 |
ifdef(`TODO',`
|
|
Chris PeBenito |
11633b |
# ideally it would not need this. It wants to write to /root/.rnd
|
|
Chris PeBenito |
11633b |
file_type_auto_trans(ipsec_mgmt_t, sysadm_home_dir_t, sysadm_home_t, file)
|
|
Chris PeBenito |
11633b |
|
|
Chris PeBenito |
11633b |
allow ipsec_mgmt_t dev_fs:file_class_set getattr;
|
|
Chris PeBenito |
11633b |
') dnl end TODO
|