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

311 lines
8.7 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:
type dhcp_etc_t; #, usercanread;
typealias dhcp_etc_t alias { etc_dhcp_t etc_dhcpc_t etc_dhcpd_t };
files_make_file(dhcp_etc_t)
# this is shared between dhcpc and dhcpd:
type dhcp_state_t;
files_make_file(dhcp_state_t)
2005-05-04 13:14:48 +00:00
type dhcpc_t;
type dhcpc_exec_t;
init_make_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_make_file(dhcpc_state_t)
type dhcpc_tmp_t;
files_make_temporary_file(dhcpc_tmp_t)
2005-05-04 13:14:48 +00:00
type dhcpc_var_run_t;
files_make_daemon_runtime_file(dhcpc_var_run_t)
2005-05-04 13:14:48 +00:00
type ifconfig_t;
type ifconfig_exec_t;
init_make_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_make_file(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-06-08 21:07:03 +00:00
allow dhcpc_t self:tcp_socket create_socket_perms;
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 };
allow dhcpc_t self:fifo_file rw_file_perms;
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 dhcpc_state_t:dir rw_dir_perms;
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-05-04 13:14:48 +00:00
files_create_daemon_runtime_data(dhcpc_t,dhcpc_var_run_t)
# 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-05-04 13:14:48 +00:00
files_create_private_config(dhcpc_t,net_conf_t,file)
# 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-05-04 13:14:48 +00:00
files_create_private_tmp_data(dhcpc_t, dhcpc_tmp_t, { file dir })
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-08 21:07:03 +00:00
domain_auto_trans(dhcp_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)
kernel_read_hardware_state(dhcpc_t)
kernel_use_file_descriptors(dhcpc_t)
corenetwork_sendrecv_tcp_on_all_interfaces(dhcpc_t)
corenetwork_sendrecv_raw_on_all_interfaces(dhcpc_t)
corenetwork_sendrecv_udp_on_all_interfaces(dhcpc_t)
corenetwork_sendrecv_tcp_on_all_nodes(dhcpc_t)
corenetwork_sendrecv_raw_on_all_nodes(dhcpc_t)
corenetwork_sendrecv_udp_on_all_nodes(dhcpc_t)
corenetwork_sendrecv_tcp_on_all_ports(dhcpc_t)
corenetwork_sendrecv_udp_on_all_ports(dhcpc_t)
2005-05-04 13:14:48 +00:00
corenetwork_bind_tcp_on_all_nodes(dhcpc_t)
corenetwork_bind_udp_on_all_nodes(dhcpc_t)
corenetwork_bind_udp_on_dhcpc_port(dhcpc_t)
# for SSP
devices_get_pseudorandom_data(dhcpc_t)
2005-06-08 13:12:00 +00:00
fs_get_all_fs_attributes(dhcpc_t)
2005-05-04 13:14:48 +00:00
terminal_ignore_use_console(dhcpc_t)
terminal_ignore_use_all_private_physical_terminals(dhcpc_t)
terminal_ignore_use_all_private_pseudoterminals(dhcpc_t)
2005-05-04 13:14:48 +00:00
terminal_ignore_use_general_physical_terminal(dhcpc_t)
corecommands_execute_general_programs(dhcpc_t)
corecommands_execute_system_programs(dhcpc_t)
corecommands_execute_shell(dhcpc_t)
2005-05-04 13:14:48 +00:00
domain_use_widely_inheritable_file_descriptors(dhcpc_t)
files_read_general_system_config(dhcpc_t)
files_read_runtime_system_config(dhcpc_t)
init_use_file_descriptors(dhcpc_t)
init_script_use_pseudoterminal(dhcpc_t)
init_script_modify_runtime_data(dhcpc_t)
2005-05-04 13:14:48 +00:00
logging_send_system_log_message(dhcpc_t)
libraries_use_dynamic_loader(dhcpc_t)
libraries_use_shared_libraries(dhcpc_t)
2005-05-04 13:14:48 +00:00
miscfiles_read_localization(dhcpc_t)
modutils_insmod_transition(dhcpc_t)
2005-05-31 23:02:11 +00:00
ifdef(`distro_redhat', `
files_execute_system_config_script(dhcpc_t)
')
ifdef(`targeted_policy', `
2005-05-31 23:02:11 +00:00
terminal_ignore_use_general_physical_terminal(dhcpc_t)
terminal_ignore_use_general_pseudoterminal(dhcpc_t)
files_ignore_read_rootfs_file(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`consoletype.te',`
2005-05-31 23:02:11 +00:00
consoletype_transition(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`hostname.te',`
2005-05-31 23:02:11 +00:00
hostname_transition(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
2005-05-04 17:01:46 +00:00
optional_policy(`nscd.te',`
2005-05-31 23:02:11 +00:00
nscd_transition(dhcpc_t)
2005-05-04 17:01:46 +00:00
')
2005-05-04 13:14:48 +00:00
optional_policy(`selinux.te',`
2005-05-31 23:02:11 +00:00
selinux_newrole_sigchld(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`udev.te',`
2005-05-31 23:02:11 +00:00
udev_read_database(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`userdomain.te',`
2005-05-31 23:02:11 +00:00
userdomain_use_all_users_file_descriptors(dhcpc_t)
')
2005-05-04 13:14:48 +00:00
#
2005-05-04 17:01:46 +00:00
# dhclient sometimes starts ypbind and ntpd
2005-05-04 13:14:48 +00:00
#
init_script_execute(dhcpc_t)
optional_policy(`ypbind.te',`
2005-05-31 23:02:11 +00:00
ypbind_transition(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
optional_policy(`ntpd.te',`
2005-05-31 23:02:11 +00:00
ntpd_transition(dhcpc_t)
2005-05-04 13:14:48 +00:00
')
ifdef(`TODO',`
allow dhcpc_t autofs_t:dir { search getattr };
dontaudit dhcpc_t sysadm_home_dir_t:dir search;
2005-05-04 17:01:46 +00:00
2005-05-04 13:14:48 +00:00
optional_policy(`rhgb.te', `
allow dhcpc_t rhgb_t:process sigchld;
allow dhcpc_t rhgb_t:fd use;
allow dhcpc_t rhgb_t:fifo_file { read write };
')
can_ypbind(dhcpc_t)
ifdef(`cardmgr.te', `
domain_auto_trans(cardmgr_t, dhcpc_exec_t, dhcpc_t)
allow cardmgr_t dhcpc_var_run_t:file { getattr read };
allow cardmgr_t dhcpc_t:process signal_perms;
')
ifdef(`hotplug.te', `
domain_auto_trans(hotplug_t, dhcpc_exec_t, dhcpc_t)
allow hotplug_t dhcpc_t:process signal_perms;
allow hotplug_t dhcpc_var_run_t:file { getattr read };
allow hotplug_t dhcp_etc_t:file rw_file_perms;
allow dhcpc_t hotplug_etc_t:dir { getattr search };
ifdef(`distro_redhat', `
2005-05-04 13:14:48 +00:00
logging_syslogd_transition(dhcpc_t)
')
')dnl end hotplug.te
# for the dhcp client to run ping to check IP addresses
ifdef(`ping.te', `
domain_auto_trans(dhcpc_t, ping_exec_t, ping_t)
ifdef(`hotplug.te',`
allow ping_t hotplug_t:fd use;
') dnl end if hotplug
ifdef(`cardmgr.te', `
allow ping_t cardmgr_t:fd use;
') dnl end if cardmgr
') dnl end if ping
ifdef(`distro_redhat', `
allow initrc_t dhcp_etc_t:file rw_file_perms;
')
allow dhcpc_t var_lib_t:dir search;
allow dhcpc_t home_root_t:dir search;
allow initrc_t dhcpc_state_t:file { getattr read };
dontaudit dhcpc_t var_lock_t:dir search;
dontaudit dhcpc_t selinux_config_t:dir search;
dontaudit dhcpc_t domain:dir getattr;
') dnl endif TODO
########################################
#
# Ifconfig local policy
#
allow ifconfig_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
allow ifconfig_t self:capability net_admin;
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
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_general_system_config(ifconfig_t);
kernel_use_file_descriptors(ifconfig_t)
kernel_read_system_state(ifconfig_t)
kernel_read_network_state(ifconfig_t)
kernel_ignore_search_sysctl_dir(ifconfig_t)
kernel_ignore_search_network_sysctl_dir(ifconfig_t)
2005-05-04 13:14:48 +00:00
2005-06-08 13:12:00 +00:00
fs_get_persistent_fs_attributes(ifconfig_t)
2005-05-04 13:14:48 +00:00
terminal_ignore_use_all_private_physical_terminals(ifconfig_t)
terminal_ignore_use_all_private_pseudoterminals(ifconfig_t)
2005-05-04 17:01:46 +00:00
2005-05-04 13:14:48 +00:00
domain_use_widely_inheritable_file_descriptors(ifconfig_t)
files_ignore_read_rootfs_file(ifconfig_t)
init_use_file_descriptors(ifconfig_t)
init_script_use_pseudoterminal(ifconfig_t)
2005-05-04 13:14:48 +00:00
libraries_use_dynamic_loader(ifconfig_t)
libraries_use_shared_libraries(ifconfig_t)
2005-05-30 21:17:20 +00:00
libraries_read_library_resources(ifconfig_t)
2005-05-04 13:14:48 +00:00
logging_send_system_log_message(ifconfig_t)
miscfiles_read_localization(ifconfig_t)
selinux_run_init_use_file_descriptors(ifconfig_t)
userdomain_use_all_users_file_descriptors(ifconfig_t)
2005-05-04 13:14:48 +00:00
ifdef(`TODO',`
can_ypbind(ifconfig_t)
ifdef(`automount.te', `
allow ifconfig_t autofs_t:dir { search getattr };
')
# Access terminals.
ifdef(`gnome-pty-helper.te', `allow ifconfig_t sysadm_gph_t:fd use;')
allow ifconfig_t tun_tap_device_t:chr_file { read write };
optional_policy(`rhgb.te', `
allow ifconfig_t rhgb_t:process sigchld;
allow ifconfig_t rhgb_t:fd use;
allow ifconfig_t rhgb_t:fifo_file { read write };
')
') dnl endif TODO