selinux-policy/refpolicy/policy/modules/system/sysnetwork.te

350 lines
8.9 KiB
Plaintext
Raw Normal View History

policy_module(sysnetwork,1.0)
2005-05-04 13:14:48 +00:00
########################################
#
# Declarations
#
2005-05-31 23:02:11 +00:00
# this is shared between dhcpc and dhcpd:
2005-10-24 18:40:24 +00:00
type dhcp_etc_t;
2005-05-31 23:02:11 +00:00
typealias dhcp_etc_t alias { etc_dhcp_t etc_dhcpc_t etc_dhcpd_t };
2005-10-24 18:40:24 +00:00
files_config_file(dhcp_etc_t)
2005-05-31 23:02:11 +00:00
# this is shared between dhcpc and dhcpd:
type dhcp_state_t;
files_type(dhcp_state_t)
2005-05-31 23:02:11 +00:00
2005-05-04 13:14:48 +00:00
type dhcpc_t;
type dhcpc_exec_t;
2005-06-13 17:35:46 +00:00
init_daemon_domain(dhcpc_t,dhcpc_exec_t)
role system_r types dhcpc_t;
2005-05-04 13:14:48 +00:00
type dhcpc_state_t;
files_type(dhcpc_state_t)
2005-05-04 13:14:48 +00:00
type dhcpc_tmp_t;
2005-06-13 17:35:46 +00:00
files_tmp_file(dhcpc_tmp_t)
2005-05-04 13:14:48 +00:00
type dhcpc_var_run_t;
2005-06-13 17:35:46 +00:00
files_pid_file(dhcpc_var_run_t)
2005-05-04 13:14:48 +00:00
type ifconfig_t;
type ifconfig_exec_t;
2005-06-13 17:35:46 +00:00
init_system_domain(ifconfig_t, ifconfig_exec_t)
role system_r types ifconfig_t;
2005-05-04 13:14:48 +00:00
2005-04-25 20:13:45 +00:00
type net_conf_t alias resolv_conf_t;
files_type(net_conf_t)
2005-05-04 13:14:48 +00:00
########################################
#
# DHCP client local policy
#
allow dhcpc_t self:capability { dac_override fsetid net_admin net_raw net_bind_service sys_resource sys_tty_config };
dontaudit dhcpc_t self:capability sys_tty_config;
# for access("/etc/bashrc", X_OK) on Red Hat
dontaudit dhcpc_t self:capability { dac_read_search sys_module };
2005-09-22 21:59:50 +00:00
allow dhcpc_t self:process signal_perms;
allow dhcpc_t self:fifo_file rw_file_perms;
allow dhcpc_t self:tcp_socket create_stream_socket_perms;
2005-06-08 21:07:03 +00:00
allow dhcpc_t self:udp_socket create_socket_perms;
allow dhcpc_t self:packet_socket create_socket_perms;
allow dhcpc_t self:netlink_route_socket { create_socket_perms nlmsg_read };
2005-05-31 23:02:11 +00:00
allow dhcpc_t dhcp_etc_t:dir r_dir_perms;
allow dhcpc_t dhcp_etc_t:lnk_file r_file_perms;
allow dhcpc_t dhcp_etc_t:file { r_file_perms execute execute_no_trans };
allow dhcpc_t dhcp_state_t:dir rw_dir_perms;
allow dhcpc_t dhcp_state_t:file { getattr read };
2005-05-31 23:02:11 +00:00
allow dhcpc_t dhcpc_state_t:file create_file_perms;
type_transition dhcpc_t dhcp_state_t:file dhcpc_state_t;
2005-05-04 13:14:48 +00:00
# create pid file
2005-06-08 21:07:03 +00:00
allow dhcpc_t dhcpc_var_run_t:file create_file_perms;
2005-06-13 17:35:46 +00:00
files_create_pid(dhcpc_t,dhcpc_var_run_t)
2005-05-04 13:14:48 +00:00
# Allow read/write to /etc/resolv.conf and /etc/ntp.conf. Note that any files
# in /etc created by dhcpcd will be labelled net_conf_t.
2005-06-08 21:07:03 +00:00
allow dhcpc_t net_conf_t:file create_file_perms;
2005-06-13 17:35:46 +00:00
files_create_etc_config(dhcpc_t,net_conf_t,file)
2005-05-04 13:14:48 +00:00
# create temp files
2005-06-08 21:07:03 +00:00
allow dhcpc_t dhcpc_tmp_t:dir create_dir_perms;
allow dhcpc_t dhcpc_tmp_t:file create_file_perms;
2005-06-13 17:35:46 +00:00
files_create_tmp_files(dhcpc_t, dhcpc_tmp_t, { file dir })
2005-05-04 13:14:48 +00:00
2005-06-08 21:07:03 +00:00
can_exec(dhcpc_t, dhcpc_exec_t)
2005-05-04 13:14:48 +00:00
2005-05-31 23:02:11 +00:00
# transition to ifconfig
2005-06-10 01:01:13 +00:00
domain_auto_trans(dhcpc_t, ifconfig_exec_t, ifconfig_t)
2005-05-31 23:02:11 +00:00
allow dhcpc_t ifconfig_t:fd use;
allow ifconfig_t dhcpc_t:fd use;
allow ifconfig_t dhcpc_t:fifo_file rw_file_perms;
allow ifconfig_t dhcpc_t:process sigchld;
2005-05-04 13:14:48 +00:00
kernel_read_system_state(dhcpc_t)
kernel_read_network_state(dhcpc_t)
kernel_read_kernel_sysctl(dhcpc_t)
2005-06-10 01:01:13 +00:00
kernel_use_fd(dhcpc_t)
corenet_tcp_sendrecv_all_if(dhcpc_t)
corenet_raw_sendrecv_all_if(dhcpc_t)
corenet_udp_sendrecv_all_if(dhcpc_t)
corenet_tcp_sendrecv_all_nodes(dhcpc_t)
corenet_raw_sendrecv_all_nodes(dhcpc_t)
corenet_udp_sendrecv_all_nodes(dhcpc_t)
corenet_tcp_sendrecv_all_ports(dhcpc_t)
corenet_udp_sendrecv_all_ports(dhcpc_t)
corenet_tcp_bind_all_nodes(dhcpc_t)
corenet_udp_bind_all_nodes(dhcpc_t)
corenet_udp_bind_dhcpc_port(dhcpc_t)
corenet_tcp_connect_all_ports(dhcpc_t)
2005-05-04 13:14:48 +00:00
dev_read_sysfs(dhcpc_t)
# for SSP:
2005-06-13 16:22:32 +00:00
dev_read_urand(dhcpc_t)
2005-05-04 13:14:48 +00:00
2005-06-10 01:01:13 +00:00
fs_getattr_all_fs(dhcpc_t)
2005-06-27 16:30:55 +00:00
fs_search_auto_mountpoints(dhcpc_t)
2005-05-04 13:14:48 +00:00
2005-06-10 01:01:13 +00:00
term_dontaudit_use_console(dhcpc_t)
term_dontaudit_use_all_user_ttys(dhcpc_t)
term_dontaudit_use_all_user_ptys(dhcpc_t)
term_dontaudit_use_unallocated_tty(dhcpc_t)
2005-09-19 21:17:45 +00:00
term_dontaudit_use_generic_pty(dhcpc_t)
2005-05-04 13:14:48 +00:00
2005-06-13 17:35:46 +00:00
corecmd_exec_bin(dhcpc_t)
corecmd_exec_sbin(dhcpc_t)
corecmd_exec_shell(dhcpc_t)
2005-05-04 13:14:48 +00:00
2005-06-13 17:35:46 +00:00
domain_use_wide_inherit_fd(dhcpc_t)
2005-09-05 16:47:19 +00:00
domain_dontaudit_list_all_domains_proc(dhcpc_t)
2005-05-04 13:14:48 +00:00
files_read_etc_files(dhcpc_t)
2005-06-13 17:35:46 +00:00
files_read_etc_runtime_files(dhcpc_t)
2005-06-30 18:54:08 +00:00
files_search_home(dhcpc_t)
files_search_var_lib(dhcpc_t)
files_dontaudit_search_locks(dhcpc_t)
2005-05-04 13:14:48 +00:00
2005-06-13 17:35:46 +00:00
init_use_fd(dhcpc_t)
init_use_script_pty(dhcpc_t)
init_rw_script_pid(dhcpc_t)
2005-05-04 13:14:48 +00:00
2005-06-13 17:35:46 +00:00
logging_send_syslog_msg(dhcpc_t)
2005-05-04 13:14:48 +00:00
2005-06-13 17:35:46 +00:00
libs_use_ld_so(dhcpc_t)
libs_use_shared_libs(dhcpc_t)
2005-05-04 13:14:48 +00:00
miscfiles_read_localization(dhcpc_t)
2005-06-13 17:35:46 +00:00
modutils_domtrans_insmod(dhcpc_t)
2005-09-21 20:01:40 +00:00
userdom_dontaudit_search_staff_home_dir(dhcpc_t)
2005-05-31 23:02:11 +00:00
ifdef(`distro_redhat', `
files_exec_etc_files(dhcpc_t)
2005-05-31 23:02:11 +00:00
')
ifdef(`targeted_policy', `
2005-06-10 01:01:13 +00:00
term_dontaudit_use_unallocated_tty(dhcpc_t)
term_dontaudit_use_generic_pty(dhcpc_t)
2005-05-31 23:02:11 +00:00
2005-06-13 17:35:46 +00:00
files_dontaudit_read_root_file(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`consoletype.te',`
2005-06-13 17:35:46 +00:00
consoletype_domtrans(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
2005-10-24 12:38:45 +00:00
optional_policy(`dbus.te',`
gen_require(`
class dbus send_msg;
')
allow dhcpc_t self:dbus send_msg;
dbus_system_bus_client_template(dhcpc,dhcpc_t)
dbus_connect_system_bus(dhcpc_t)
dbus_send_system_bus_msg(dhcpc_t)
domain_auto_trans(system_dbusd_t, dhcpc_exec_t, dhcpc_t)
allow { NetworkManager_t initrc_t } dhcpc_t:dbus send_msg;
allow dhcpc_t { NetworkManager_t initrc_t }:dbus send_msg;
ifdef(`unconfined.te', `
allow unconfined_t dhcpc_t:dbus send_msg;
allow dhcpc_t unconfined_t:dbus send_msg;
')
')
2005-05-04 13:14:48 +00:00
optional_policy(`hostname.te',`
2005-06-13 17:35:46 +00:00
hostname_domtrans(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`hotplug.te',`
hotplug_getattr_config_dir(dhcpc_t)
hotplug_search_config(dhcpc_t)
ifdef(`distro_redhat',`
logging_domtrans_syslog(dhcpc_t)
')
')
2005-06-30 18:54:08 +00:00
# for the dhcp client to run ping to check IP addresses
optional_policy(`netutils.te',`
netutils_domtrans_ping(dhcpc_t)
2005-09-15 21:03:29 +00:00
',`
allow dhcpc_t self:capability setuid;
allow dhcpc_t self:rawip_socket create_socket_perms;
2005-06-30 18:54:08 +00:00
')
2005-06-27 16:30:55 +00:00
optional_policy(`nis.te',`
nis_use_ypbind(dhcpc_t)
2005-10-14 17:55:40 +00:00
nis_signal_ypbind(dhcpc_t)
2005-06-27 16:30:55 +00:00
# dhclient sometimes starts ypbind
init_exec_script(dhcpc_t)
2005-10-24 18:40:24 +00:00
nis_domtrans_ypbind(dhcpc_t)
2005-06-27 16:30:55 +00:00
')
2005-05-04 17:01:46 +00:00
optional_policy(`nscd.te',`
nscd_domtrans(dhcpc_t)
nscd_read_pid(dhcpc_t)
2005-05-04 17:01:46 +00:00
')
2005-06-27 16:30:55 +00:00
optional_policy(`ntpd.te',`
# dhclient sometimes starts ntpd
init_exec_script(dhcpc_t)
2005-09-05 16:47:19 +00:00
ntp_domtrans(dhcpc_t)
2005-06-27 16:30:55 +00:00
')
optional_policy(`selinuxutil.te',`
seutil_sigchld_newrole(dhcpc_t)
seutil_dontaudit_search_config(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`udev.te',`
2005-06-13 17:35:46 +00:00
udev_read_db(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`userdomain.te',`
2005-06-13 17:35:46 +00:00
userdom_use_all_user_fd(dhcpc_t)
')
2005-05-04 13:14:48 +00:00
ifdef(`TODO',`
2005-09-19 21:17:45 +00:00
ifdef(`cardmgr.te',`
allow dhcpc_t cardmgr_dev_t:chr_file { read write };
')
ifdef(`ypbind.te',`
allow dhcpc_t ypbind_var_run_t:file { r_file_perms unlink };
')
ifdef(`dbusd.te', `
dbusd_client(system, dhcpc)
domain_auto_trans(system_dbusd_t, dhcpc_exec_t, dhcpc_t)
allow dhcpc_t system_dbusd_t:dbus { acquire_svc send_msg };
allow dhcpc_t self:dbus send_msg;
allow { NetworkManager_t initrc_t } dhcpc_t:dbus send_msg;
allow dhcpc_t { NetworkManager_t initrc_t }:dbus send_msg;
ifdef(`unconfined.te', `
allow unconfined_t dhcpc_t:dbus send_msg;
allow dhcpc_t unconfined_t:dbus send_msg;
')dnl end ifdef unconfined.te
')
2005-06-27 16:30:55 +00:00
optional_policy(`rhgb.te',`
rhgb_domain(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
') dnl endif TODO
########################################
#
# Ifconfig local policy
#
2005-09-01 20:13:42 +00:00
allow ifconfig_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execheap execstack };
2005-10-21 21:35:25 +00:00
allow ifconfig_t self:capability { net_raw net_admin sys_tty_config };
2005-05-04 13:14:48 +00:00
dontaudit ifconfig_t self:capability sys_module;
allow ifconfig_t self:fd use;
2005-06-08 21:07:03 +00:00
allow ifconfig_t self:fifo_file rw_file_perms;
allow ifconfig_t self:unix_dgram_socket create_socket_perms;
allow ifconfig_t self:unix_stream_socket create_stream_socket_perms;
2005-05-04 13:14:48 +00:00
allow ifconfig_t self:unix_dgram_socket sendto;
allow ifconfig_t self:unix_stream_socket connectto;
2005-06-08 21:07:03 +00:00
allow ifconfig_t self:shm create_shm_perms;
allow ifconfig_t self:sem create_sem_perms;
allow ifconfig_t self:msgq create_msgq_perms;
2005-05-04 13:14:48 +00:00
allow ifconfig_t self:msg { send receive };
# Create UDP sockets, necessary when called from dhcpc
2005-06-08 21:07:03 +00:00
allow ifconfig_t self:udp_socket create_socket_perms;
2005-05-04 13:14:48 +00:00
# for /sbin/ip
allow ifconfig_t self:packet_socket create_socket_perms;
2005-06-08 21:07:03 +00:00
allow ifconfig_t self:netlink_route_socket create_netlink_socket_perms;
2005-05-04 13:14:48 +00:00
allow ifconfig_t self:tcp_socket { create ioctl };
files_read_etc_files(ifconfig_t);
2005-05-04 13:14:48 +00:00
2005-06-10 01:01:13 +00:00
kernel_use_fd(ifconfig_t)
2005-05-04 13:14:48 +00:00
kernel_read_system_state(ifconfig_t)
kernel_read_network_state(ifconfig_t)
kernel_search_network_sysctl(ifconfig_t)
2005-05-04 13:14:48 +00:00
2005-06-29 20:53:53 +00:00
corenet_use_tun_tap_device(ifconfig_t)
dev_read_sysfs(ifconfig_t)
2005-06-10 01:01:13 +00:00
fs_getattr_xattr_fs(ifconfig_t)
2005-06-27 16:30:55 +00:00
fs_search_auto_mountpoints(ifconfig_t)
2005-05-04 13:14:48 +00:00
2005-06-10 01:01:13 +00:00
term_dontaudit_use_all_user_ttys(ifconfig_t)
term_dontaudit_use_all_user_ptys(ifconfig_t)
2005-05-04 17:01:46 +00:00
2005-06-13 17:35:46 +00:00
domain_use_wide_inherit_fd(ifconfig_t)
2005-05-04 13:14:48 +00:00
2005-06-13 17:35:46 +00:00
files_dontaudit_read_root_file(ifconfig_t)
2005-05-04 13:14:48 +00:00
2005-06-13 17:35:46 +00:00
init_use_fd(ifconfig_t)
init_use_script_pty(ifconfig_t)
2005-06-13 17:35:46 +00:00
libs_use_ld_so(ifconfig_t)
libs_use_shared_libs(ifconfig_t)
libs_read_lib(ifconfig_t)
2005-05-04 13:14:48 +00:00
2005-06-13 17:35:46 +00:00
logging_send_syslog_msg(ifconfig_t)
2005-05-04 13:14:48 +00:00
miscfiles_read_localization(ifconfig_t)
seutil_use_runinit_fd(ifconfig_t)
2005-06-13 17:35:46 +00:00
userdom_use_all_user_fd(ifconfig_t)
ifdef(`hide_broken_symptoms',`
optional_policy(`pcmcia.te',`
dev_dontaudit_rw_cardmgr(ifconfig_t)
')
optional_policy(`udev.te',`
2005-10-24 22:55:28 +00:00
udev_dontaudit_rw_unix_dgram_socket(ifconfig_t)
')
')
2005-10-14 20:00:07 +00:00
optional_policy(`ppp.te',`
ppp_use_fd(ifconfig_t)
')
2005-06-27 16:30:55 +00:00
optional_policy(`nis.te',`
nis_use_ypbind(ifconfig_t)
2005-05-04 13:14:48 +00:00
')
2005-06-27 16:30:55 +00:00
ifdef(`TODO',`
2005-05-04 13:14:48 +00:00
ifdef(`gnome-pty-helper.te', `allow ifconfig_t sysadm_gph_t:fd use;')
optional_policy(`rhgb.te', `
2005-06-27 16:30:55 +00:00
rhgb_domain(ifconfig_t)
2005-05-04 13:14:48 +00:00
')
') dnl endif TODO