policy_module(sysnetwork,1.4.1) ######################################## # # Declarations # # this is shared between dhcpc and dhcpd: type dhcp_etc_t; typealias dhcp_etc_t alias { etc_dhcp_t etc_dhcpc_t etc_dhcpd_t }; files_config_file(dhcp_etc_t) # this is shared between dhcpc and dhcpd: type dhcp_state_t; files_type(dhcp_state_t) type dhcpc_t; type dhcpc_exec_t; init_daemon_domain(dhcpc_t,dhcpc_exec_t) role system_r types dhcpc_t; type dhcpc_state_t; files_type(dhcpc_state_t) type dhcpc_tmp_t; files_tmp_file(dhcpc_tmp_t) type dhcpc_var_run_t; files_pid_file(dhcpc_var_run_t) type ifconfig_t; type ifconfig_exec_t; init_system_domain(ifconfig_t, ifconfig_exec_t) role system_r types ifconfig_t; type net_conf_t alias resolv_conf_t; files_type(net_conf_t) ######################################## # # 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 }; 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; 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 dhcp_etc_t:dir list_dir_perms; read_lnk_files_pattern(dhcpc_t,dhcp_etc_t,dhcp_etc_t) exec_files_pattern(dhcpc_t,dhcp_etc_t,dhcp_etc_t) allow dhcpc_t dhcp_state_t:file { getattr read }; manage_files_pattern(dhcpc_t,dhcpc_state_t,dhcpc_state_t) filetrans_pattern(dhcpc_t,dhcp_state_t,dhcpc_state_t,file) # create pid file manage_files_pattern(dhcpc_t,dhcpc_var_run_t,dhcpc_var_run_t) files_pid_filetrans(dhcpc_t,dhcpc_var_run_t,file) # 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. allow dhcpc_t net_conf_t:file manage_file_perms; files_etc_filetrans(dhcpc_t,net_conf_t,file) # create temp files manage_dirs_pattern(dhcpc_t,dhcpc_tmp_t,dhcpc_tmp_t) manage_files_pattern(dhcpc_t,dhcpc_tmp_t,dhcpc_tmp_t) files_tmp_filetrans(dhcpc_t, dhcpc_tmp_t, { file dir }) can_exec(dhcpc_t, dhcpc_exec_t) # transition to ifconfig domtrans_pattern(dhcpc_t, ifconfig_exec_t, ifconfig_t) kernel_read_system_state(dhcpc_t) kernel_read_network_state(dhcpc_t) kernel_read_kernel_sysctls(dhcpc_t) kernel_use_fds(dhcpc_t) corenet_all_recvfrom_unlabeled(dhcpc_t) corenet_all_recvfrom_netlabel(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) corenet_sendrecv_dhcpd_client_packets(dhcpc_t) corenet_sendrecv_dhcpc_server_packets(dhcpc_t) dev_read_sysfs(dhcpc_t) # for SSP: dev_read_urand(dhcpc_t) fs_getattr_all_fs(dhcpc_t) fs_search_auto_mountpoints(dhcpc_t) term_dontaudit_use_all_user_ttys(dhcpc_t) term_dontaudit_use_all_user_ptys(dhcpc_t) term_dontaudit_use_unallocated_ttys(dhcpc_t) term_dontaudit_use_generic_ptys(dhcpc_t) corecmd_exec_bin(dhcpc_t) corecmd_exec_shell(dhcpc_t) domain_use_interactive_fds(dhcpc_t) domain_dontaudit_list_all_domains_state(dhcpc_t) files_read_etc_files(dhcpc_t) files_read_etc_runtime_files(dhcpc_t) files_search_home(dhcpc_t) files_search_var_lib(dhcpc_t) files_dontaudit_search_locks(dhcpc_t) init_rw_utmp(dhcpc_t) logging_send_syslog_msg(dhcpc_t) libs_use_ld_so(dhcpc_t) libs_use_shared_libs(dhcpc_t) miscfiles_read_localization(dhcpc_t) modutils_domtrans_insmod(dhcpc_t) userdom_dontaudit_search_staff_home_dirs(dhcpc_t) ifdef(`distro_redhat', ` files_exec_etc_files(dhcpc_t) ') optional_policy(` consoletype_domtrans(dhcpc_t) ') optional_policy(` gen_require(` class dbus send_msg; ') allow dhcpc_t self:dbus send_msg; init_dbus_chat_script(dhcpc_t) dbus_system_bus_client_template(dhcpc,dhcpc_t) dbus_connect_system_bus(dhcpc_t) dbus_send_system_bus(dhcpc_t) optional_policy(` networkmanager_dbus_chat(dhcpc_t) ') ') optional_policy(` hostname_domtrans(dhcpc_t) ') optional_policy(` hotplug_getattr_config_dirs(dhcpc_t) hotplug_search_config(dhcpc_t) ifdef(`distro_redhat',` logging_domtrans_syslog(dhcpc_t) ') ') # for the dhcp client to run ping to check IP addresses optional_policy(` netutils_domtrans_ping(dhcpc_t) netutils_domtrans(dhcpc_t) ',` allow dhcpc_t self:capability setuid; allow dhcpc_t self:rawip_socket create_socket_perms; ') optional_policy(` nis_use_ypbind(dhcpc_t) nis_signal_ypbind(dhcpc_t) nis_read_ypbind_pid(dhcpc_t) nis_delete_ypbind_pid(dhcpc_t) # dhclient sometimes starts ypbind init_exec_script_files(dhcpc_t) nis_domtrans_ypbind(dhcpc_t) ') optional_policy(` nscd_domtrans(dhcpc_t) nscd_read_pid(dhcpc_t) ') optional_policy(` # dhclient sometimes starts ntpd init_exec_script_files(dhcpc_t) ntp_domtrans(dhcpc_t) ') optional_policy(` pcmcia_stub(dhcpc_t) dev_rw_cardmgr(dhcpc_t) ') optional_policy(` seutil_sigchld_newrole(dhcpc_t) seutil_dontaudit_search_config(dhcpc_t) ') optional_policy(` udev_read_db(dhcpc_t) ') optional_policy(` userdom_use_all_users_fds(dhcpc_t) ') optional_policy(` kernel_read_xen_state(dhcpc_t) kernel_write_xen_state(dhcpc_t) xen_append_log(dhcpc_t) xen_dontaudit_rw_unix_stream_sockets(dhcpc_t) ') ######################################## # # Ifconfig local policy # allow ifconfig_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execheap execstack }; allow ifconfig_t self:capability { net_raw net_admin sys_tty_config }; dontaudit ifconfig_t self:capability sys_module; allow ifconfig_t self:fd use; allow ifconfig_t self:fifo_file rw_fifo_file_perms; allow ifconfig_t self:sock_file read_sock_file_perms; allow ifconfig_t self:socket create_socket_perms; allow ifconfig_t self:unix_dgram_socket create_socket_perms; allow ifconfig_t self:unix_stream_socket create_stream_socket_perms; allow ifconfig_t self:unix_dgram_socket sendto; allow ifconfig_t self:unix_stream_socket connectto; allow ifconfig_t self:shm create_shm_perms; allow ifconfig_t self:sem create_sem_perms; allow ifconfig_t self:msgq create_msgq_perms; allow ifconfig_t self:msg { send receive }; # Create UDP sockets, necessary when called from dhcpc allow ifconfig_t self:udp_socket create_socket_perms; # for /sbin/ip allow ifconfig_t self:packet_socket create_socket_perms; allow ifconfig_t self:netlink_route_socket create_netlink_socket_perms; allow ifconfig_t self:netlink_xfrm_socket { create_netlink_socket_perms nlmsg_read }; allow ifconfig_t self:tcp_socket { create ioctl }; files_read_etc_files(ifconfig_t); kernel_use_fds(ifconfig_t) kernel_read_system_state(ifconfig_t) kernel_read_network_state(ifconfig_t) kernel_search_network_sysctl(ifconfig_t) kernel_rw_net_sysctls(ifconfig_t) corenet_rw_tun_tap_dev(ifconfig_t) dev_read_sysfs(ifconfig_t) # for IPSEC setup: dev_read_urand(ifconfig_t) fs_getattr_xattr_fs(ifconfig_t) fs_search_auto_mountpoints(ifconfig_t) term_dontaudit_use_all_user_ttys(ifconfig_t) term_dontaudit_use_all_user_ptys(ifconfig_t) domain_use_interactive_fds(ifconfig_t) files_dontaudit_read_root_files(ifconfig_t) init_use_fds(ifconfig_t) init_use_script_ptys(ifconfig_t) libs_use_ld_so(ifconfig_t) libs_use_shared_libs(ifconfig_t) libs_read_lib_files(ifconfig_t) logging_send_syslog_msg(ifconfig_t) miscfiles_read_localization(ifconfig_t) modutils_domtrans_insmod(ifconfig_t) seutil_use_runinit_fds(ifconfig_t) userdom_use_all_users_fds(ifconfig_t) ifdef(`hide_broken_symptoms',` optional_policy(` dev_dontaudit_rw_cardmgr(ifconfig_t) ') optional_policy(` udev_dontaudit_rw_dgram_sockets(ifconfig_t) ') ') optional_policy(` netutils_domtrans(dhcpc_t) ') optional_policy(` nis_use_ypbind(ifconfig_t) ') optional_policy(` ppp_use_fds(ifconfig_t) ') optional_policy(` kernel_read_xen_state(ifconfig_t) kernel_write_xen_state(ifconfig_t) xen_append_log(ifconfig_t) xen_dontaudit_rw_unix_stream_sockets(ifconfig_t) ')