Chris PeBenito 960373
Chris PeBenito a3cf80
policy_module(sysnetwork,1.1.1)
Chris PeBenito 960373
Chris PeBenito 0d7ad3
########################################
Chris PeBenito 0d7ad3
#
Chris PeBenito 0d7ad3
# Declarations
Chris PeBenito 0d7ad3
#
Chris PeBenito 0d7ad3
Chris PeBenito d115b2
# this is shared between dhcpc and dhcpd:
Chris PeBenito 9bbc75
type dhcp_etc_t;
Chris PeBenito d115b2
typealias dhcp_etc_t alias { etc_dhcp_t etc_dhcpc_t etc_dhcpd_t };
Chris PeBenito 9bbc75
files_config_file(dhcp_etc_t)
Chris PeBenito d115b2
Chris PeBenito d115b2
# this is shared between dhcpc and dhcpd:
Chris PeBenito d115b2
type dhcp_state_t;
Chris PeBenito 8fd367
files_type(dhcp_state_t)
Chris PeBenito d115b2
Chris PeBenito 0d7ad3
type dhcpc_t;
Chris PeBenito 0d7ad3
type dhcpc_exec_t;
Chris PeBenito c9428d
init_daemon_domain(dhcpc_t,dhcpc_exec_t)
Chris PeBenito bbd6a6
role system_r types dhcpc_t;
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
type dhcpc_state_t;
Chris PeBenito 8fd367
files_type(dhcpc_state_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
type dhcpc_tmp_t;
Chris PeBenito c9428d
files_tmp_file(dhcpc_tmp_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
type dhcpc_var_run_t;
Chris PeBenito c9428d
files_pid_file(dhcpc_var_run_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
type ifconfig_t;
Chris PeBenito 0d7ad3
type ifconfig_exec_t;
Chris PeBenito c9428d
init_system_domain(ifconfig_t, ifconfig_exec_t)
Chris PeBenito bbd6a6
role system_r types ifconfig_t;
Chris PeBenito 0d7ad3
Chris PeBenito 549180
type net_conf_t alias resolv_conf_t;
Chris PeBenito 8fd367
files_type(net_conf_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
########################################
Chris PeBenito 0d7ad3
#
Chris PeBenito 0d7ad3
# DHCP client local policy
Chris PeBenito 0d7ad3
#
Chris PeBenito 0d7ad3
allow dhcpc_t self:capability { dac_override fsetid net_admin net_raw net_bind_service sys_resource sys_tty_config };
Chris PeBenito 0d7ad3
dontaudit dhcpc_t self:capability sys_tty_config;
Chris PeBenito 0d7ad3
# for access("/etc/bashrc", X_OK) on Red Hat
Chris PeBenito 0d7ad3
dontaudit dhcpc_t self:capability { dac_read_search sys_module };
Chris PeBenito 681c9a
allow dhcpc_t self:process signal_perms;
Chris PeBenito 681c9a
allow dhcpc_t self:fifo_file rw_file_perms;
Chris PeBenito 681c9a
allow dhcpc_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 7edd02
allow dhcpc_t self:udp_socket create_socket_perms;
Chris PeBenito 7edd02
allow dhcpc_t self:packet_socket create_socket_perms;
Chris PeBenito 7edd02
allow dhcpc_t self:netlink_route_socket { create_socket_perms nlmsg_read };
Chris PeBenito d115b2
Chris PeBenito d115b2
allow dhcpc_t dhcp_etc_t:dir r_dir_perms;
Chris PeBenito d115b2
allow dhcpc_t dhcp_etc_t:lnk_file r_file_perms;
Chris PeBenito d115b2
allow dhcpc_t dhcp_etc_t:file { r_file_perms execute execute_no_trans };
Chris PeBenito d115b2
Chris PeBenito 689f6d
allow dhcpc_t dhcp_state_t:dir rw_dir_perms;
Chris PeBenito 77f6e2
allow dhcpc_t dhcp_state_t:file { getattr read };
Chris PeBenito af2345
allow dhcpc_t dhcpc_state_t:dir rw_dir_perms;
Chris PeBenito d115b2
allow dhcpc_t dhcpc_state_t:file create_file_perms;
Chris PeBenito d115b2
type_transition dhcpc_t dhcp_state_t:file dhcpc_state_t;
Chris PeBenito d115b2
Chris PeBenito 0d7ad3
# create pid file
Chris PeBenito 7edd02
allow dhcpc_t dhcpc_var_run_t:file create_file_perms;
Chris PeBenito 33acca
allow dhcpc_t dhcpc_var_run_t:dir rw_dir_perms;
Chris PeBenito 1c1ac6
files_pid_filetrans(dhcpc_t,dhcpc_var_run_t,file)
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
# Allow read/write to /etc/resolv.conf and /etc/ntp.conf. Note that any files
Chris PeBenito 0d7ad3
# in /etc created by dhcpcd will be labelled net_conf_t.
Chris PeBenito 7edd02
allow dhcpc_t net_conf_t:file create_file_perms;
Chris PeBenito 103fe2
files_etc_filetrans(dhcpc_t,net_conf_t,file)
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
# create temp files
Chris PeBenito 7edd02
allow dhcpc_t dhcpc_tmp_t:dir create_dir_perms;
Chris PeBenito 7edd02
allow dhcpc_t dhcpc_tmp_t:file create_file_perms;
Chris PeBenito 103fe2
files_tmp_filetrans(dhcpc_t, dhcpc_tmp_t, { file dir })
Chris PeBenito 0d7ad3
Chris PeBenito 7edd02
can_exec(dhcpc_t, dhcpc_exec_t)
Chris PeBenito 0d7ad3
Chris PeBenito d115b2
# transition to ifconfig
Chris PeBenito 0fd9dc
domain_auto_trans(dhcpc_t, ifconfig_exec_t, ifconfig_t)
Chris PeBenito d115b2
allow dhcpc_t ifconfig_t:fd use;
Chris PeBenito d115b2
allow ifconfig_t dhcpc_t:fd use;
Chris PeBenito d115b2
allow ifconfig_t dhcpc_t:fifo_file rw_file_perms;
Chris PeBenito d115b2
allow ifconfig_t dhcpc_t:process sigchld;
Chris PeBenito d115b2
Chris PeBenito 0d7ad3
kernel_read_system_state(dhcpc_t)
Chris PeBenito 0d7ad3
kernel_read_network_state(dhcpc_t)
Chris PeBenito 445522
kernel_read_kernel_sysctls(dhcpc_t)
Chris PeBenito 1c1ac6
kernel_use_fds(dhcpc_t)
Chris PeBenito 0fd9dc
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_if(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_raw_sendrecv_all_if(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_udp_sendrecv_all_if(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_nodes(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_raw_sendrecv_all_nodes(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_udp_sendrecv_all_nodes(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_tcp_sendrecv_all_ports(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_udp_sendrecv_all_ports(dhcpc_t)
Chris PeBenito bd7037
corenet_non_ipsec_sendrecv(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_tcp_bind_all_nodes(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_udp_bind_all_nodes(dhcpc_t)
Chris PeBenito 0fd9dc
corenet_udp_bind_dhcpc_port(dhcpc_t)
Chris PeBenito 2705f9
corenet_tcp_connect_all_ports(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito d35c62
dev_read_sysfs(dhcpc_t)
Chris PeBenito d35c62
# for SSP:
Karl MacMillan f0c985
dev_read_urand(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0fd9dc
fs_getattr_all_fs(dhcpc_t)
Chris PeBenito ab940a
fs_search_auto_mountpoints(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0fd9dc
term_dontaudit_use_console(dhcpc_t)
Chris PeBenito 0fd9dc
term_dontaudit_use_all_user_ttys(dhcpc_t)
Chris PeBenito 0fd9dc
term_dontaudit_use_all_user_ptys(dhcpc_t)
Chris PeBenito 1815ba
term_dontaudit_use_unallocated_ttys(dhcpc_t)
Chris PeBenito 1815ba
term_dontaudit_use_generic_ptys(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito c9428d
corecmd_exec_bin(dhcpc_t)
Chris PeBenito c9428d
corecmd_exec_sbin(dhcpc_t)
Chris PeBenito c9428d
corecmd_exec_shell(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito 15722e
domain_use_interactive_fds(dhcpc_t)
Chris PeBenito 1815ba
domain_dontaudit_list_all_domains_state(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito 8fd367
files_read_etc_files(dhcpc_t)
Chris PeBenito c9428d
files_read_etc_runtime_files(dhcpc_t)
Chris PeBenito fd89e1
files_search_home(dhcpc_t)
Chris PeBenito ae9e27
files_search_var_lib(dhcpc_t)
Chris PeBenito ae9e27
files_dontaudit_search_locks(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito 1c1ac6
init_use_fds(dhcpc_t)
Chris PeBenito 1815ba
init_use_script_ptys(dhcpc_t)
Chris PeBenito 68228b
init_rw_utmp(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito c9428d
logging_send_syslog_msg(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito c9428d
libs_use_ld_so(dhcpc_t)
Chris PeBenito c9428d
libs_use_shared_libs(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
miscfiles_read_localization(dhcpc_t)
Chris PeBenito 0d7ad3
Chris PeBenito c9428d
modutils_domtrans_insmod(dhcpc_t)
Chris PeBenito daa0e0
Chris PeBenito 103fe2
userdom_dontaudit_search_staff_home_dirs(dhcpc_t)
Chris PeBenito ae9e27
Chris PeBenito d115b2
ifdef(`distro_redhat', `
Chris PeBenito 8fd367
	files_exec_etc_files(dhcpc_t)
Chris PeBenito d115b2
')
Chris PeBenito d115b2
Chris PeBenito 254bbc
ifdef(`targeted_policy', `
Chris PeBenito 1815ba
	term_dontaudit_use_unallocated_ttys(dhcpc_t)
Chris PeBenito 1815ba
	term_dontaudit_use_generic_ptys(dhcpc_t)
Chris PeBenito d115b2
Chris PeBenito 9e04f5
	files_dontaudit_read_root_files(dhcpc_t)
Chris PeBenito 0d7ad3
')
Chris PeBenito 0d7ad3
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito c9428d
	consoletype_domtrans(dhcpc_t)
Chris PeBenito 0d7ad3
')
Chris PeBenito 0d7ad3
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito f525b4
	gen_require(`
Chris PeBenito f525b4
		class dbus send_msg;
Chris PeBenito f525b4
	')
Chris PeBenito f525b4
Chris PeBenito f525b4
	allow dhcpc_t self:dbus send_msg;
Chris PeBenito f525b4
Chris PeBenito 6f81e1
	init_dbus_chat_script(dhcpc_t)
Chris PeBenito 1dd86c
Chris PeBenito 1dd86c
	dbus_system_bus_client_template(dhcpc,dhcpc_t)
Chris PeBenito 1dd86c
	dbus_connect_system_bus(dhcpc_t)
Chris PeBenito 1815ba
	dbus_send_system_bus(dhcpc_t)
Chris PeBenito 1dd86c
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 9fd4b8
		networkmanager_dbus_chat(dhcpc_t)
Chris PeBenito 9fd4b8
	')
Chris PeBenito 1dd86c
Chris PeBenito 1dd86c
	ifdef(`unconfined.te', `
Chris PeBenito 1dd86c
		allow unconfined_t dhcpc_t:dbus send_msg;
Chris PeBenito 1dd86c
		allow dhcpc_t unconfined_t:dbus send_msg;
Chris PeBenito 1dd86c
	')
Chris PeBenito 1dd86c
')
Chris PeBenito 1dd86c
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito c9428d
	hostname_domtrans(dhcpc_t)
Chris PeBenito 0d7ad3
')
Chris PeBenito 0d7ad3
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 1815ba
	hotplug_getattr_config_dirs(dhcpc_t)
Chris PeBenito ae9e27
	hotplug_search_config(dhcpc_t)
Chris PeBenito ae9e27
Chris PeBenito ae9e27
	ifdef(`distro_redhat',`
Chris PeBenito df00b2
		logging_domtrans_syslog(dhcpc_t)
Chris PeBenito ae9e27
	')
Chris PeBenito ae9e27
')
Chris PeBenito ae9e27
Chris PeBenito fd89e1
# for the dhcp client to run ping to check IP addresses
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito fd89e1
	netutils_domtrans_ping(dhcpc_t)
Chris PeBenito 33acca
	netutils_domtrans(dhcpc_t)
Chris PeBenito 98a8ea
',`
Chris PeBenito 98a8ea
	allow dhcpc_t self:capability setuid;
Chris PeBenito 98a8ea
	allow dhcpc_t self:rawip_socket create_socket_perms;
Chris PeBenito fd89e1
')
Chris PeBenito fd89e1
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito ab940a
	nis_use_ypbind(dhcpc_t)
Chris PeBenito d8636f
	nis_signal_ypbind(dhcpc_t)
Chris PeBenito 725926
	nis_read_ypbind_pid(dhcpc_t)
Chris PeBenito 725926
	nis_delete_ypbind_pid(dhcpc_t)
Chris PeBenito 725926
Chris PeBenito ab940a
	# dhclient sometimes starts ypbind
Chris PeBenito f75479
	init_exec_script_files(dhcpc_t)
Chris PeBenito 9bbc75
	nis_domtrans_ypbind(dhcpc_t)
Chris PeBenito ab940a
')
Chris PeBenito ab940a
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 31908b
	nscd_domtrans(dhcpc_t)
Chris PeBenito 689f6d
	nscd_read_pid(dhcpc_t)
Chris PeBenito 1e5c2a
')
Chris PeBenito 1e5c2a
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito ab940a
	# dhclient sometimes starts ntpd
Chris PeBenito f75479
	init_exec_script_files(dhcpc_t)
Chris PeBenito b11a75
	ntp_domtrans(dhcpc_t)
Chris PeBenito ab940a
')
Chris PeBenito ab940a
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 725926
	pcmcia_stub(dhcpc_t)
Chris PeBenito 725926
	dev_rw_cardmgr(dhcpc_t)
Chris PeBenito 725926
')
Chris PeBenito 725926
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 8fd367
	seutil_sigchld_newrole(dhcpc_t)
Chris PeBenito ae9e27
	seutil_dontaudit_search_config(dhcpc_t)
Chris PeBenito 0d7ad3
')
Chris PeBenito 0d7ad3
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito c9428d
	udev_read_db(dhcpc_t)
Chris PeBenito 0d7ad3
')
Chris PeBenito 0d7ad3
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 15722e
	userdom_use_all_users_fds(dhcpc_t)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a3cf80
	xen_append_log(dhcpc_t)
Chris PeBenito a3cf80
')
Chris PeBenito a3cf80
Chris PeBenito 0d7ad3
########################################
Chris PeBenito 0d7ad3
#
Chris PeBenito 0d7ad3
# Ifconfig local policy
Chris PeBenito 0d7ad3
#
Chris PeBenito 0d7ad3
Chris PeBenito 9d3bdc
allow ifconfig_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execheap execstack };
Chris PeBenito e6a2ea
allow ifconfig_t self:capability { net_raw net_admin sys_tty_config };
Chris PeBenito 0d7ad3
dontaudit ifconfig_t self:capability sys_module;
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
allow ifconfig_t self:fd use;
Chris PeBenito 7edd02
allow ifconfig_t self:fifo_file rw_file_perms;
Chris PeBenito 4614e8
allow ifconfig_t self:sock_file r_file_perms;
Chris PeBenito 4614e8
allow ifconfig_t self:socket create_socket_perms;
Chris PeBenito 7edd02
allow ifconfig_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 7edd02
allow ifconfig_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 0d7ad3
allow ifconfig_t self:unix_dgram_socket sendto;
Chris PeBenito 0d7ad3
allow ifconfig_t self:unix_stream_socket connectto;
Chris PeBenito 7edd02
allow ifconfig_t self:shm create_shm_perms;
Chris PeBenito 7edd02
allow ifconfig_t self:sem create_sem_perms;
Chris PeBenito 7edd02
allow ifconfig_t self:msgq create_msgq_perms;
Chris PeBenito 0d7ad3
allow ifconfig_t self:msg { send receive };
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
# Create UDP sockets, necessary when called from dhcpc
Chris PeBenito 7edd02
allow ifconfig_t self:udp_socket create_socket_perms;
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
# for /sbin/ip
Chris PeBenito 2705f9
allow ifconfig_t self:packet_socket create_socket_perms;
Chris PeBenito 7edd02
allow ifconfig_t self:netlink_route_socket create_netlink_socket_perms;
Chris PeBenito 0d7ad3
allow ifconfig_t self:tcp_socket { create ioctl };
Chris PeBenito 8fd367
files_read_etc_files(ifconfig_t);
Chris PeBenito 0d7ad3
Chris PeBenito 1c1ac6
kernel_use_fds(ifconfig_t)
Chris PeBenito 0d7ad3
kernel_read_system_state(ifconfig_t)
Chris PeBenito 0d7ad3
kernel_read_network_state(ifconfig_t)
Chris PeBenito 77f6e2
kernel_search_network_sysctl(ifconfig_t)
Chris PeBenito 0d7ad3
Chris PeBenito 5b6ddb
corenet_rw_tun_tap_dev(ifconfig_t)
Chris PeBenito ebdc3b
Chris PeBenito 2705f9
dev_read_sysfs(ifconfig_t)
Chris PeBenito 2705f9
Chris PeBenito 0fd9dc
fs_getattr_xattr_fs(ifconfig_t)
Chris PeBenito ab940a
fs_search_auto_mountpoints(ifconfig_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0fd9dc
term_dontaudit_use_all_user_ttys(ifconfig_t)
Chris PeBenito 0fd9dc
term_dontaudit_use_all_user_ptys(ifconfig_t)
Chris PeBenito 1e5c2a
Chris PeBenito 15722e
domain_use_interactive_fds(ifconfig_t)
Chris PeBenito 0d7ad3
Chris PeBenito 9e04f5
files_dontaudit_read_root_files(ifconfig_t)
Chris PeBenito 0d7ad3
Chris PeBenito 1c1ac6
init_use_fds(ifconfig_t)
Chris PeBenito 1815ba
init_use_script_ptys(ifconfig_t)
Chris PeBenito 8623d5
Chris PeBenito c9428d
libs_use_ld_so(ifconfig_t)
Chris PeBenito c9428d
libs_use_shared_libs(ifconfig_t)
Chris PeBenito 1815ba
libs_read_lib_files(ifconfig_t)
Chris PeBenito 0d7ad3
Chris PeBenito c9428d
logging_send_syslog_msg(ifconfig_t)
Chris PeBenito 0d7ad3
Chris PeBenito 0d7ad3
miscfiles_read_localization(ifconfig_t)
Chris PeBenito 0d7ad3
Chris PeBenito 33acca
modutils_domtrans_insmod(ifconfig_t)
Chris PeBenito 33acca
Chris PeBenito 15722e
seutil_use_runinit_fds(ifconfig_t)
Chris PeBenito 8623d5
Chris PeBenito 15722e
userdom_use_all_users_fds(ifconfig_t)
Chris PeBenito daa0e0
Chris PeBenito ae9e27
ifdef(`hide_broken_symptoms',`
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 50f650
		dev_dontaudit_rw_cardmgr(ifconfig_t)
Chris PeBenito 50f650
	')
Chris PeBenito 50f650
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 1815ba
		udev_dontaudit_rw_dgram_sockets(ifconfig_t)
Chris PeBenito 50f650
	')
Chris PeBenito ae9e27
')
Chris PeBenito ae9e27
Chris PeBenito 33acca
ifdef(`targeted_policy',`
Chris PeBenito 1815ba
	term_use_generic_ptys(ifconfig_t)
Chris PeBenito 1815ba
	term_use_unallocated_ttys(ifconfig_t)
Chris PeBenito 33acca
')
Chris PeBenito 33acca
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 8967bf
	netutils_domtrans(dhcpc_t)
Chris PeBenito e08118
')
Chris PeBenito e08118
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito ab940a
	nis_use_ypbind(ifconfig_t)
Chris PeBenito 0d7ad3
')
Chris PeBenito 0d7ad3
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 1c1ac6
	ppp_use_fds(ifconfig_t)
Chris PeBenito 8967bf
')
Chris PeBenito a3cf80
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito a3cf80
	xen_append_log(ifconfig_t)
Chris PeBenito a3cf80
')