Chris PeBenito 17de1b
Chris PeBenito f6a590
policy_module(ppp,1.4.1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## Allow pppd to load kernel modules for certain modems
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 56e1b3
gen_tunable(pppd_can_insmod,false)
Chris PeBenito 56e1b3
Chris PeBenito 56e1b3
ifdef(`strict_policy',`
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## Allow pppd to be run for a regular user
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 56e1b3
gen_tunable(pppd_for_user,false)
Chris PeBenito 56e1b3
')
Chris PeBenito 56e1b3
Chris PeBenito 17de1b
# pppd_t is the domain for the pppd program.
Chris PeBenito 17de1b
# pppd_exec_t is the type of the pppd executable.
Chris PeBenito 17de1b
type pppd_t;
Chris PeBenito 17de1b
type pppd_exec_t;
Chris PeBenito 17de1b
init_daemon_domain(pppd_t,pppd_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pppd_devpts_t;
Chris PeBenito 17de1b
term_pty(pppd_devpts_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Define a separate type for /etc/ppp
Chris PeBenito 17de1b
type pppd_etc_t;
Chris PeBenito 17de1b
files_config_file(pppd_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Define a separate type for writable files under /etc/ppp
Chris PeBenito 17de1b
type pppd_etc_rw_t;
Chris PeBenito 17de1b
files_type(pppd_etc_rw_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pppd_script_exec_t;
Chris PeBenito 17de1b
files_type(pppd_script_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pppd_secret_t is the type of the pap and chap password files
Chris PeBenito 17de1b
type pppd_secret_t;
Chris PeBenito 17de1b
files_type(pppd_secret_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pppd_log_t;
Chris PeBenito 17de1b
logging_log_file(pppd_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pppd_lock_t;
Chris PeBenito 17de1b
files_lock_file(pppd_lock_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pppd_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(pppd_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pppd_var_run_t;
Chris PeBenito 17de1b
files_pid_file(pppd_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pptp_t;
Chris PeBenito 17de1b
type pptp_exec_t;
Chris PeBenito 17de1b
init_daemon_domain(pptp_t,pptp_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pptp_log_t;
Chris PeBenito 17de1b
logging_log_file(pptp_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type pptp_var_run_t;
Chris PeBenito 17de1b
files_pid_file(pptp_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# PPPD Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow pppd_t self:capability { net_admin setuid setgid fsetid fowner net_raw dac_override };
Chris PeBenito 17de1b
dontaudit pppd_t self:capability sys_tty_config;
Chris PeBenito 17de1b
allow pppd_t self:process signal;
Chris PeBenito c0868a
allow pppd_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow pppd_t self:socket create_socket_perms;
Chris PeBenito 17de1b
allow pppd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow pppd_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 8708d9
allow pppd_t self:netlink_route_socket rw_netlink_socket_perms;
Chris PeBenito 17de1b
allow pppd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow pppd_t self:udp_socket { connect connected_socket_perms };
Chris PeBenito 17de1b
allow pppd_t self:packet_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
domtrans_pattern(pppd_t, pptp_exec_t, pptp_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow pppd_t pppd_devpts_t:chr_file { rw_chr_file_perms setattr };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow pppd_t pppd_etc_t:dir rw_dir_perms;
Chris PeBenito c0868a
allow pppd_t pppd_etc_t:file read_file_perms;
Chris PeBenito 17de1b
allow pppd_t pppd_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(pppd_t,pppd_etc_rw_t,pppd_etc_rw_t)
Chris PeBenito 8708d9
# Automatically label newly created files under /etc/ppp with this type
Chris PeBenito c0868a
filetrans_pattern(pppd_t,pppd_etc_t,pppd_etc_rw_t,file)
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow pppd_t pppd_lock_t:file manage_file_perms;
Chris PeBenito 17de1b
files_lock_filetrans(pppd_t,pppd_lock_t,file)
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow pppd_t pppd_log_t:file manage_file_perms;
Chris PeBenito 17de1b
logging_log_filetrans(pppd_t,pppd_log_t,file)
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_dirs_pattern(pppd_t,pppd_tmp_t,pppd_tmp_t)
Chris PeBenito c0868a
manage_files_pattern(pppd_t,pppd_tmp_t,pppd_tmp_t)
Chris PeBenito 17de1b
files_tmp_filetrans(pppd_t, pppd_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(pppd_t,pppd_var_run_t,pppd_var_run_t)
Chris PeBenito 17de1b
files_pid_filetrans(pppd_t,pppd_var_run_t,file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow pppd_t pptp_t:process signal;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# for SSP
Chris PeBenito 17de1b
# Access secret files
Chris PeBenito c0868a
allow pppd_t pppd_secret_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(pppd_t)
Chris PeBenito 17de1b
kernel_read_system_state(pppd_t)
Chris PeBenito 17de1b
kernel_read_net_sysctls(pppd_t)
Chris PeBenito 17de1b
kernel_read_network_state(pppd_t)
Chris PeBenito 17de1b
kernel_load_module(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_urand(pppd_t)
Chris PeBenito 17de1b
dev_search_sysfs(pppd_t)
Chris PeBenito 17de1b
dev_read_sysfs(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corenet_non_ipsec_sendrecv(pppd_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(pppd_t)
Chris PeBenito 17de1b
corenet_raw_sendrecv_all_if(pppd_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_if(pppd_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_nodes(pppd_t)
Chris PeBenito 17de1b
corenet_raw_sendrecv_all_nodes(pppd_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_nodes(pppd_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(pppd_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(pppd_t)
Chris PeBenito 17de1b
# Access /dev/ppp.
Chris PeBenito 17de1b
corenet_rw_ppp_dev(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(pppd_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_unallocated_ttys(pppd_t)
Chris PeBenito 17de1b
term_setattr_unallocated_ttys(pppd_t)
Chris PeBenito 17de1b
term_ioctl_generic_ptys(pppd_t)
Chris PeBenito 17de1b
# for pppoe
Chris PeBenito 17de1b
term_create_pty(pppd_t,pppd_devpts_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# allow running ip-up and ip-down scripts and running chat.
Chris PeBenito 17de1b
corecmd_exec_bin(pppd_t)
Chris PeBenito 17de1b
corecmd_exec_shell(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_exec_etc_files(pppd_t)
Chris PeBenito 8708d9
files_manage_etc_runtime_files(pppd_t)
Chris PeBenito 8708d9
files_dontaudit_write_etc_files(pppd_t)
Chris PeBenito 8708d9
Chris PeBenito 17de1b
# for scripts
Chris PeBenito 17de1b
files_read_etc_files(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_read_utmp(pppd_t)
Chris PeBenito 17de1b
init_dontaudit_write_utmp(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(pppd_t)
Chris PeBenito 17de1b
libs_use_shared_libs(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_exec_ifconfig(pppd_t)
Chris PeBenito 17de1b
sysnet_manage_config(pppd_t)
Chris PeBenito f6a590
sysnet_etc_filetrans_config(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(pppd_t)
Chris PeBenito 17de1b
userdom_dontaudit_search_sysadm_home_dirs(pppd_t)
Chris PeBenito 17de1b
# for ~/.ppprc - if it actually exists then you need some policy to read it
Chris PeBenito 17de1b
#allow pppd_t { sysadm_home_dir_t home_root_t user_home_dir_type }:dir search;
Chris PeBenito 17de1b
userdom_search_sysadm_home_dirs(pppd_t)
Chris PeBenito 17de1b
userdom_search_unpriv_users_home_dirs(pppd_t)
Chris PeBenito 17de1b
Chris PeBenito 8708d9
ppp_exec(pppd_t)
Chris PeBenito 8708d9
Chris PeBenito 17de1b
ifdef(`targeted_policy', `
Chris PeBenito 17de1b
	term_dontaudit_use_unallocated_ttys(pppd_t)
Chris PeBenito 17de1b
	term_dontaudit_use_generic_ptys(pppd_t)
Chris PeBenito 17de1b
	files_dontaudit_read_root_files(pppd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	ddclient_domtrans(pppd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	tunable_policy(`pppd_can_insmod && ! secure_mode_insmod',`
Chris PeBenito 17de1b
		modutils_domtrans_insmod_uncond(pppd_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	mta_send_mail(pppd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nis_use_ypbind(pppd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(pppd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 56e1b3
	postfix_domtrans_master(pppd_t)
Chris PeBenito 56e1b3
')
Chris PeBenito 56e1b3
Chris PeBenito 56e1b3
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(pppd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(pppd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# PPTP Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dontaudit pptp_t self:capability sys_tty_config;
Chris PeBenito 17de1b
allow pptp_t self:capability net_raw;
Chris PeBenito 17de1b
allow pptp_t self:fifo_file { read write };
Chris PeBenito 17de1b
allow pptp_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow pptp_t self:unix_stream_socket { connectto create_stream_socket_perms };
Chris PeBenito 17de1b
allow pptp_t self:rawip_socket create_socket_perms;
Chris PeBenito 17de1b
allow pptp_t self:tcp_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow pptp_t pppd_etc_t:dir { getattr read search };
Chris PeBenito 17de1b
allow pptp_t pppd_etc_t:file { read getattr };
Chris PeBenito 17de1b
allow pptp_t pppd_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow pptp_t pppd_etc_rw_t:dir { getattr read search };
Chris PeBenito 17de1b
allow pptp_t pppd_etc_rw_t:file { read getattr };
Chris PeBenito 17de1b
allow pptp_t pppd_etc_rw_t:lnk_file { getattr read };
Chris PeBenito 17de1b
can_exec(pptp_t, pppd_etc_rw_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Allow pptp to append to pppd log files
Chris PeBenito 17de1b
allow pptp_t pppd_log_t:file append;
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow pptp_t pptp_log_t:file manage_file_perms;
Chris PeBenito 17de1b
logging_log_filetrans(pptp_t,pptp_log_t,file)
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(pptp_t,pptp_var_run_t,pptp_var_run_t)
Chris PeBenito c0868a
manage_sock_files_pattern(pptp_t,pptp_var_run_t,pptp_var_run_t)
Chris PeBenito 17de1b
files_pid_filetrans(pptp_t,pptp_var_run_t,file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_list_proc(pptp_t)
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(pptp_t)
Chris PeBenito 17de1b
kernel_read_proc_symlinks(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corenet_non_ipsec_sendrecv(pptp_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(pptp_t)
Chris PeBenito 17de1b
corenet_raw_sendrecv_all_if(pptp_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_nodes(pptp_t)
Chris PeBenito 17de1b
corenet_raw_sendrecv_all_nodes(pptp_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(pptp_t)
Chris PeBenito 17de1b
corenet_tcp_bind_all_nodes(pptp_t)
Chris PeBenito 17de1b
corenet_tcp_connect_generic_port(pptp_t)
Chris PeBenito 17de1b
corenet_tcp_connect_all_reserved_ports(pptp_t)
Chris PeBenito 17de1b
corenet_sendrecv_generic_client_packets(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(pptp_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_ioctl_generic_ptys(pptp_t)
Chris PeBenito 17de1b
term_search_ptys(pptp_t)
Chris PeBenito 17de1b
term_use_ptmx(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(pptp_t)
Chris PeBenito 17de1b
libs_use_shared_libs(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_read_config(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(pptp_t)
Chris PeBenito 17de1b
userdom_dontaudit_search_sysadm_home_dirs(pptp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
        term_dontaudit_use_unallocated_ttys(pptp_t)
Chris PeBenito 17de1b
        term_dontaudit_use_generic_ptys(pptp_t)
Chris PeBenito 17de1b
        files_dontaudit_read_root_files(pptp_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 8708d9
	consoletype_exec(pppd_t)
Chris PeBenito 8708d9
')
Chris PeBenito 8708d9
Chris PeBenito 8708d9
optional_policy(`
Chris PeBenito 17de1b
	hostname_exec(pptp_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(pptp_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
        seutil_sigchld_newrole(pptp_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
        udev_read_db(pptp_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	postfix_read_config(pppd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# FIXME:
Chris PeBenito c0868a
domtrans_pattern(pppd_t, pppd_script_exec_t, initrc_t)