518 lines
13 KiB
Text
518 lines
13 KiB
Text
policy_module(sysnetwork, 1.15.4)
|
|
|
|
########################################
|
|
#
|
|
# Declarations
|
|
#
|
|
|
|
## <desc>
|
|
## <p>
|
|
## Allow dhcpc client applications to execute iptables commands
|
|
## </p>
|
|
## </desc>
|
|
gen_tunable(dhcpc_exec_iptables, false)
|
|
|
|
attribute_role dhcpc_roles;
|
|
roleattribute system_r dhcpc_roles;
|
|
|
|
# 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)
|
|
|
|
type dhcpc_helper_exec_t;
|
|
init_script_file(dhcpc_helper_exec_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 ifconfig_var_run_t;
|
|
files_pid_file(ifconfig_var_run_t)
|
|
files_mountpoint(ifconfig_var_run_t)
|
|
|
|
type net_conf_t alias resolv_conf_t;
|
|
files_config_file(net_conf_t)
|
|
|
|
ifdef(`distro_debian',`
|
|
init_daemon_run_dir(net_conf_t, "network")
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# DHCP client local policy
|
|
#
|
|
allow dhcpc_t self:capability { dac_read_search fsetid net_admin net_raw net_bind_service setgid setpcap setuid sys_chroot sys_nice sys_resource sys_tty_config };
|
|
dontaudit dhcpc_t self:capability sys_admin;
|
|
# for access("/etc/bashrc", X_OK) on Red Hat
|
|
dontaudit dhcpc_t self:capability { dac_read_search sys_module };
|
|
allow dhcpc_t self:process { getsched setsched getcap setcap setfscreate setrlimit signal_perms };
|
|
allow dhcpc_t self:cap_userns { net_bind_service };
|
|
|
|
allow dhcpc_t self:fifo_file rw_fifo_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:rawip_socket create_socket_perms;
|
|
allow dhcpc_t self:netlink_generic_socket create_socket_perms;
|
|
allow dhcpc_t self:netlink_route_socket { create_socket_perms nlmsg_read nlmsg_write };
|
|
allow dhcpc_t self:netlink_kobject_uevent_socket create_socket_perms;
|
|
allow dhcpc_t self:unix_dgram_socket sendto;
|
|
|
|
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 read_file_perms;
|
|
allow dhcpc_t dhcp_state_t:file relabel_file_perms;
|
|
|
|
manage_files_pattern(dhcpc_t, dhcpc_state_t, dhcpc_state_t)
|
|
filetrans_pattern(dhcpc_t, dhcp_state_t, dhcpc_state_t, file)
|
|
allow dhcpc_t dhcpc_state_t:file { map relabel_file_perms };
|
|
|
|
# create pid file
|
|
manage_files_pattern(dhcpc_t, dhcpc_var_run_t, dhcpc_var_run_t)
|
|
manage_sock_files_pattern(dhcpc_t, dhcpc_var_run_t, dhcpc_var_run_t)
|
|
create_dirs_pattern(dhcpc_t, dhcpc_var_run_t, dhcpc_var_run_t)
|
|
files_pid_filetrans(dhcpc_t, dhcpc_var_run_t, { file dir sock_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;
|
|
allow dhcpc_t net_conf_t:file relabel_file_perms;
|
|
sysnet_manage_config(dhcpc_t)
|
|
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)
|
|
|
|
kernel_read_system_state(dhcpc_t)
|
|
kernel_read_network_state(dhcpc_t)
|
|
kernel_search_network_sysctl(dhcpc_t)
|
|
kernel_read_kernel_sysctls(dhcpc_t)
|
|
kernel_request_load_module(dhcpc_t)
|
|
kernel_use_fds(dhcpc_t)
|
|
kernel_rw_net_sysctls(dhcpc_t)
|
|
|
|
corecmd_exec_bin(dhcpc_t)
|
|
corecmd_exec_shell(dhcpc_t)
|
|
|
|
corenet_all_recvfrom_netlabel(dhcpc_t)
|
|
corenet_tcp_sendrecv_generic_if(dhcpc_t)
|
|
corenet_raw_sendrecv_generic_if(dhcpc_t)
|
|
corenet_udp_sendrecv_generic_if(dhcpc_t)
|
|
corenet_tcp_sendrecv_generic_node(dhcpc_t)
|
|
corenet_raw_sendrecv_generic_node(dhcpc_t)
|
|
corenet_udp_sendrecv_generic_node(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_tcp_bind_dhcpc_port(dhcpc_t)
|
|
corenet_udp_bind_dhcpc_port(dhcpc_t)
|
|
corenet_udp_bind_all_unreserved_ports(dhcpc_t)
|
|
corenet_tcp_connect_all_ports(dhcpc_t)
|
|
corenet_sendrecv_dhcpd_client_packets(dhcpc_t)
|
|
corenet_sendrecv_dhcpc_server_packets(dhcpc_t)
|
|
corenet_sendrecv_all_server_packets(dhcpc_t)
|
|
corenet_dontaudit_udp_bind_all_reserved_ports(dhcpc_t)
|
|
|
|
dev_read_sysfs(dhcpc_t)
|
|
# for SSP:
|
|
dev_read_urand(dhcpc_t)
|
|
dev_read_rand(dhcpc_t)
|
|
|
|
|
|
domain_obj_id_change_exemption(dhcpc_t)
|
|
domain_use_interactive_fds(dhcpc_t)
|
|
domain_dontaudit_read_all_domains_state(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)
|
|
files_getattr_generic_locks(dhcpc_t)
|
|
files_rw_inherited_tmp_file(dhcpc_t)
|
|
files_dontaudit_rw_inherited_locks(dhcpc_t)
|
|
|
|
fs_getattr_all_fs(dhcpc_t)
|
|
fs_getattr_nsfs_files(dhcpc_t)
|
|
fs_search_auto_mountpoints(dhcpc_t)
|
|
|
|
term_dontaudit_use_all_ttys(dhcpc_t)
|
|
term_dontaudit_use_all_ptys(dhcpc_t)
|
|
term_dontaudit_use_unallocated_ttys(dhcpc_t)
|
|
term_dontaudit_use_generic_ptys(dhcpc_t)
|
|
|
|
auth_use_nsswitch(dhcpc_t)
|
|
|
|
init_rw_utmp(dhcpc_t)
|
|
init_stream_connect(dhcpc_t)
|
|
init_stream_send(dhcpc_t)
|
|
|
|
libs_exec_ldconfig(dhcpc_t)
|
|
|
|
logging_send_syslog_msg(dhcpc_t)
|
|
|
|
miscfiles_read_generic_certs(dhcpc_t)
|
|
|
|
modutils_run_kmod(dhcpc_t, dhcpc_roles)
|
|
|
|
sysnet_run_ifconfig(dhcpc_t, dhcpc_roles)
|
|
|
|
userdom_stream_connect(dhcpc_t)
|
|
userdom_use_user_terminals(dhcpc_t)
|
|
userdom_dontaudit_search_user_home_dirs(dhcpc_t)
|
|
|
|
ifdef(`distro_redhat', `
|
|
files_exec_etc_files(dhcpc_t)
|
|
')
|
|
|
|
ifdef(`distro_ubuntu',`
|
|
optional_policy(`
|
|
unconfined_domain(dhcpc_t)
|
|
')
|
|
')
|
|
|
|
optional_policy(`
|
|
chronyd_initrc_domtrans(dhcpc_t)
|
|
chronyd_systemctl(dhcpc_t)
|
|
chronyd_domtrans(dhcpc_t)
|
|
chronyd_domtrans_chronyc(dhcpc_t)
|
|
chronyd_manage_pid_files(dhcpc_t)
|
|
chronyd_pid_filetrans(dhcpc_t)
|
|
chronyd_read_keys(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
cloudform_init_domtrans(dhcpc_t)
|
|
cloudform_read_lib_files(dhcpc_t)
|
|
cloudform_read_lib_lnk_files(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
devicekit_dontaudit_rw_log(dhcpc_t)
|
|
devicekit_dontaudit_read_pid_files(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
dbus_system_domain(dhcpc_t, dhcpc_exec_t)
|
|
|
|
init_dbus_chat_script(dhcpc_t)
|
|
|
|
optional_policy(`
|
|
networkmanager_dbus_chat(dhcpc_t)
|
|
')
|
|
')
|
|
|
|
optional_policy(`
|
|
hostname_run(dhcpc_t, dhcpc_roles)
|
|
')
|
|
|
|
# for the dhcp client to run ping to check IP addresses
|
|
optional_policy(`
|
|
netutils_run_ping(dhcpc_t, dhcpc_roles)
|
|
netutils_run(dhcpc_t, dhcpc_roles)
|
|
')
|
|
|
|
optional_policy(`
|
|
networkmanager_domtrans(dhcpc_t)
|
|
networkmanager_manage_pid_files(dhcpc_t)
|
|
networkmanager_manage_lib(dhcpc_t)
|
|
networkmanager_stream_connect(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
nis_initrc_domtrans_ypbind(dhcpc_t)
|
|
nis_read_ypbind_pid(dhcpc_t)
|
|
nis_systemctl_ypbind(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
nscd_initrc_domtrans(dhcpc_t)
|
|
nscd_systemctl(dhcpc_t)
|
|
nscd_domtrans(dhcpc_t)
|
|
nscd_read_pid(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
ntp_initrc_domtrans(dhcpc_t)
|
|
ntp_systemctl(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
pcmcia_stub(dhcpc_t)
|
|
dev_rw_cardmgr(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
seutil_sigchld_newrole(dhcpc_t)
|
|
seutil_domtrans_setfiles(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
systemd_dbus_chat_hostnamed(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
systemd_passwd_agent_domtrans(dhcpc_t)
|
|
systemd_signal_passwd_agent(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
udev_read_db(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
userdom_use_all_users_fds(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
virt_manage_pid_files(dhcpc_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
vmware_append_log(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:capability { net_raw net_admin sys_admin sys_tty_config };
|
|
allow ifconfig_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execheap execstack };
|
|
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;
|
|
allow ifconfig_t self:appletalk_socket create_socket_perms;
|
|
# for /sbin/ip
|
|
allow ifconfig_t self:packet_socket create_socket_perms;
|
|
allow ifconfig_t self:netlink_socket create_socket_perms;
|
|
allow ifconfig_t self:netlink_generic_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:tun_socket { relabelfrom relabelto create_socket_perms };
|
|
|
|
allow ifconfig_t self:tcp_socket { create ioctl };
|
|
|
|
can_exec(ifconfig_t, ifconfig_exec_t)
|
|
|
|
manage_files_pattern(ifconfig_t, ifconfig_var_run_t, ifconfig_var_run_t)
|
|
manage_lnk_files_pattern(ifconfig_t, ifconfig_var_run_t, ifconfig_var_run_t)
|
|
create_dirs_pattern(ifconfig_t, ifconfig_var_run_t, ifconfig_var_run_t)
|
|
files_pid_filetrans(ifconfig_t, ifconfig_var_run_t, { file dir })
|
|
allow ifconfig_t ifconfig_var_run_t:file mounton;
|
|
allow ifconfig_t ifconfig_var_run_t:dir mounton;
|
|
|
|
kernel_use_fds(ifconfig_t)
|
|
kernel_read_system_state(ifconfig_t)
|
|
kernel_read_network_state(ifconfig_t)
|
|
kernel_request_load_module(ifconfig_t)
|
|
kernel_search_network_sysctl(ifconfig_t)
|
|
kernel_rw_net_sysctls(ifconfig_t)
|
|
kernel_unmount_proc(ifconfig_t)
|
|
|
|
corenet_rw_tun_tap_dev(ifconfig_t)
|
|
|
|
corecmd_exec_bin(ifconfig_t)
|
|
corecmd_exec_shell(ifconfig_t)
|
|
|
|
dev_read_sysfs(ifconfig_t)
|
|
# for IPSEC setup:
|
|
dev_read_urand(ifconfig_t)
|
|
dev_read_rand(ifconfig_t)
|
|
# needed by tuned
|
|
dev_rw_netcontrol(ifconfig_t)
|
|
dev_mounton_sysfs(ifconfig_t)
|
|
dev_mount_sysfs_fs(ifconfig_t)
|
|
dev_unmount_sysfs_fs(ifconfig_t)
|
|
|
|
domain_use_interactive_fds(ifconfig_t)
|
|
domain_read_all_domains_state(ifconfig_t)
|
|
|
|
read_files_pattern(ifconfig_t, dhcpc_state_t, dhcpc_state_t)
|
|
|
|
files_dontaudit_rw_inherited_pipes(ifconfig_t)
|
|
files_dontaudit_rw_inherited_locks(ifconfig_t)
|
|
files_dontaudit_read_root_files(ifconfig_t)
|
|
files_rw_inherited_tmp_file(ifconfig_t)
|
|
files_dontaudit_rw_var_files(ifconfig_t)
|
|
|
|
files_mounton_rootfs(ifconfig_t)
|
|
|
|
files_read_etc_files(ifconfig_t)
|
|
files_read_etc_runtime_files(ifconfig_t)
|
|
files_read_usr_files(ifconfig_t)
|
|
|
|
fs_getattr_xattr_fs(ifconfig_t)
|
|
fs_unmount_xattr_fs(ifconfig_t)
|
|
fs_search_auto_mountpoints(ifconfig_t)
|
|
fs_read_nsfs_files(ifconfig_t)
|
|
fs_mount_nsfs(ifconfig_t)
|
|
fs_unmount_nsfs(ifconfig_t)
|
|
|
|
selinux_dontaudit_getattr_fs(ifconfig_t)
|
|
|
|
term_dontaudit_use_console(ifconfig_t)
|
|
term_dontaudit_use_all_ttys(ifconfig_t)
|
|
term_dontaudit_use_all_ptys(ifconfig_t)
|
|
term_dontaudit_use_ptmx(ifconfig_t)
|
|
term_dontaudit_use_generic_ptys(ifconfig_t)
|
|
|
|
auth_use_nsswitch(ifconfig_t)
|
|
|
|
init_use_fds(ifconfig_t)
|
|
init_use_script_ptys(ifconfig_t)
|
|
init_rw_inherited_script_tmp_files(ifconfig_t)
|
|
|
|
libs_read_lib_files(ifconfig_t)
|
|
|
|
logging_send_syslog_msg(ifconfig_t)
|
|
|
|
seutil_use_runinit_fds(ifconfig_t)
|
|
|
|
sysnet_dns_name_resolve(ifconfig_t)
|
|
sysnet_dontaudit_rw_dhcpc_udp_sockets(ifconfig_t)
|
|
sysnet_filetrans_named_content_ifconfig(ifconfig_t)
|
|
|
|
userdom_use_inherited_user_terminals(ifconfig_t)
|
|
userdom_use_all_users_fds(ifconfig_t)
|
|
|
|
optional_policy(`
|
|
hostname_exec(ifconfig_t)
|
|
')
|
|
|
|
ifdef(`distro_ubuntu',`
|
|
optional_policy(`
|
|
unconfined_domain(ifconfig_t)
|
|
')
|
|
')
|
|
|
|
optional_policy(`
|
|
brctl_domtrans(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
cfengine_dontaudit_write_log(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
ctdbd_read_lib_files(ifconfig_t)
|
|
')
|
|
|
|
ifdef(`hide_broken_symptoms',`
|
|
# caused by some bogus kernel code
|
|
dontaudit ifconfig_t self:capability sys_module;
|
|
|
|
optional_policy(`
|
|
dev_dontaudit_rw_cardmgr(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
udev_dontaudit_rw_dgram_sockets(ifconfig_t)
|
|
')
|
|
')
|
|
|
|
optional_policy(`
|
|
dnsmasq_domtrans(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
devicekit_dontaudit_read_pid_files(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
ipsec_write_pid(ifconfig_t)
|
|
ipsec_setcontext_default_spd(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
kdump_dontaudit_read_config(ifconfig_t)
|
|
kdump_rw_inherited_kdumpctl_tmp_pipes(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
libs_exec_ldconfig(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
modutils_domtrans_kmod(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
mysql_dontaudit_rw_db(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
ppp_use_fds(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
unconfined_dontaudit_rw_pipes(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
vmware_manage_log(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)
|
|
')
|
|
|
|
optional_policy(`
|
|
iptables_domtrans(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
tlp_manage_pid_files(ifconfig_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
tunable_policy(`dhcpc_exec_iptables',`
|
|
iptables_domtrans(dhcpc_t)
|
|
')
|
|
')
|