286 lines
8 KiB
Text
286 lines
8 KiB
Text
policy_module(netutils, 1.12.1)
|
|
|
|
########################################
|
|
#
|
|
# Declarations
|
|
#
|
|
|
|
## <desc>
|
|
## <p>
|
|
## Allow confined users the ability to execute the ping and traceroute commands.
|
|
## </p>
|
|
## </desc>
|
|
gen_tunable(selinuxuser_ping, false)
|
|
|
|
type netutils_t;
|
|
type netutils_exec_t;
|
|
init_system_domain(netutils_t, netutils_exec_t)
|
|
|
|
type netutils_tmp_t;
|
|
files_tmp_file(netutils_tmp_t)
|
|
|
|
type ping_t;
|
|
type ping_exec_t;
|
|
init_system_domain(ping_t, ping_exec_t)
|
|
|
|
type traceroute_t;
|
|
type traceroute_exec_t;
|
|
init_system_domain(traceroute_t, traceroute_exec_t)
|
|
|
|
########################################
|
|
#
|
|
# Netutils local policy
|
|
#
|
|
|
|
# Perform network administration operations and have raw access to the network.
|
|
allow netutils_t self:capability { chown dac_read_search net_admin net_raw setuid setgid sys_chroot setpcap };
|
|
dontaudit netutils_t self:capability { sys_admin sys_tty_config };
|
|
allow netutils_t self:capability2 bpf;
|
|
allow netutils_t self:process { setcap signal_perms };
|
|
allow netutils_t self:netlink_generic_socket create_socket_perms;
|
|
allow netutils_t self:netlink_rdma_socket create_socket_perms;
|
|
allow netutils_t self:netlink_route_socket create_netlink_socket_perms;
|
|
allow netutils_t self:netlink_socket create_socket_perms;
|
|
# For tcpdump.
|
|
allow netutils_t self:netlink_netfilter_socket create_socket_perms;
|
|
allow netutils_t self:packet_socket { create_socket_perms map };
|
|
allow netutils_t self:udp_socket create_socket_perms;
|
|
allow netutils_t self:tcp_socket create_stream_socket_perms;
|
|
allow netutils_t self:socket create_socket_perms;
|
|
allow netutils_t self:netlink_socket create_socket_perms;
|
|
|
|
tunable_policy(`deny_bluetooth',`',`
|
|
allow netutils_t self:bluetooth_socket create_stream_socket_perms;
|
|
')
|
|
|
|
manage_dirs_pattern(netutils_t, netutils_tmp_t, netutils_tmp_t)
|
|
manage_files_pattern(netutils_t, netutils_tmp_t, netutils_tmp_t)
|
|
files_tmp_filetrans(netutils_t, netutils_tmp_t, { file dir })
|
|
|
|
kernel_search_proc(netutils_t)
|
|
kernel_read_all_sysctls(netutils_t)
|
|
kernel_read_system_state(netutils_t)
|
|
kernel_read_network_state(netutils_t)
|
|
kernel_request_load_module(netutils_t)
|
|
kernel_search_network_sysctl(traceroute_t)
|
|
|
|
corenet_all_recvfrom_netlabel(netutils_t)
|
|
corenet_tcp_sendrecv_generic_if(netutils_t)
|
|
corenet_raw_sendrecv_generic_if(netutils_t)
|
|
corenet_udp_sendrecv_generic_if(netutils_t)
|
|
corenet_tcp_sendrecv_generic_node(netutils_t)
|
|
corenet_raw_sendrecv_generic_node(netutils_t)
|
|
corenet_udp_sendrecv_generic_node(netutils_t)
|
|
corenet_tcp_sendrecv_all_ports(netutils_t)
|
|
corenet_udp_sendrecv_all_ports(netutils_t)
|
|
corenet_tcp_connect_all_ports(netutils_t)
|
|
corenet_sendrecv_all_client_packets(netutils_t)
|
|
corenet_udp_bind_generic_node(netutils_t)
|
|
|
|
dev_read_sysfs(netutils_t)
|
|
dev_getattr_infiniband_dev(netutils_t)
|
|
dev_read_usbmon_dev(netutils_t)
|
|
dev_write_usbmon_dev(netutils_t)
|
|
dev_map_usbmon_dev(netutils_t)
|
|
dev_rw_generic_usb_dev(netutils_t)
|
|
|
|
domain_use_interactive_fds(netutils_t)
|
|
|
|
files_read_etc_files(netutils_t)
|
|
# for nscd
|
|
files_dontaudit_search_var(netutils_t)
|
|
|
|
fs_getattr_cgroup(netutils_t)
|
|
fs_getattr_xattr_fs(netutils_t)
|
|
|
|
init_use_fds(netutils_t)
|
|
init_use_script_ptys(netutils_t)
|
|
init_write_initrc_tmp_pipes(netutils_t)
|
|
init_dontaudit_read_state(netutils_t)
|
|
|
|
auth_use_nsswitch(netutils_t)
|
|
|
|
libs_use_ld_so(netutils_t)
|
|
|
|
logging_send_syslog_msg(netutils_t)
|
|
|
|
term_dontaudit_use_console(netutils_t)
|
|
userdom_use_inherited_user_terminals(netutils_t)
|
|
userdom_use_all_users_fds(netutils_t)
|
|
|
|
optional_policy(`
|
|
kdump_dontaudit_inherited_kdumpctl_tmp_pipes(netutils_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
nis_use_ypbind(netutils_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
vmware_append_log(netutils_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
xen_append_log(netutils_t)
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# Ping local policy
|
|
#
|
|
|
|
allow ping_t self:capability { setuid net_raw };
|
|
# When ping is installed with capabilities instead of setuid
|
|
allow ping_t self:process { getcap setcap };
|
|
dontaudit ping_t self:capability sys_tty_config;
|
|
allow ping_t self:tcp_socket create_socket_perms;
|
|
allow ping_t self:rawip_socket create_socket_perms;
|
|
allow ping_t self:packet_socket create_socket_perms;
|
|
allow ping_t self:netlink_route_socket create_netlink_socket_perms;
|
|
allow ping_t self:icmp_socket create_socket_perms;
|
|
|
|
corenet_all_recvfrom_netlabel(ping_t)
|
|
corenet_tcp_sendrecv_generic_if(ping_t)
|
|
corenet_raw_sendrecv_generic_if(ping_t)
|
|
corenet_raw_sendrecv_generic_node(ping_t)
|
|
corenet_tcp_sendrecv_generic_node(ping_t)
|
|
corenet_raw_bind_generic_node(ping_t)
|
|
corenet_tcp_sendrecv_all_ports(ping_t)
|
|
corenet_icmp_bind_generic_node(ping_t)
|
|
|
|
fs_dontaudit_getattr_xattr_fs(ping_t)
|
|
|
|
dev_read_urand(ping_t)
|
|
|
|
domain_use_interactive_fds(ping_t)
|
|
|
|
files_read_etc_files(ping_t)
|
|
files_dontaudit_search_var(ping_t)
|
|
|
|
kernel_read_system_state(ping_t)
|
|
kernel_read_network_state(ping_t)
|
|
kernel_request_load_module(ping_t)
|
|
|
|
auth_use_nsswitch(ping_t)
|
|
|
|
init_rw_inherited_script_tmp_files(ping_t)
|
|
|
|
logging_send_syslog_msg(ping_t)
|
|
|
|
ifdef(`hide_broken_symptoms',`
|
|
init_dontaudit_use_fds(ping_t)
|
|
|
|
optional_policy(`
|
|
nagios_dontaudit_rw_log(ping_t)
|
|
nagios_dontaudit_rw_pipes(ping_t)
|
|
nagios_dontaudit_write_pipes_nrpe(ping_t)
|
|
')
|
|
')
|
|
|
|
term_use_all_inherited_terms(ping_t)
|
|
|
|
tunable_policy(`selinuxuser_ping',`
|
|
term_use_all_ttys(ping_t)
|
|
term_use_all_ptys(ping_t)
|
|
',`
|
|
term_dontaudit_use_all_ttys(ping_t)
|
|
term_dontaudit_use_all_ptys(ping_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
munin_append_log(ping_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
nagios_rw_inerited_tmp_files(ping_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
pcmcia_use_cardmgr_fds(ping_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
openshift_rw_inherited_content(ping_t)
|
|
openshift_dontaudit_rw_inherited_fifo_files(ping_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
zabbix_read_tmp(ping_t)
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# Traceroute local policy
|
|
#
|
|
|
|
allow traceroute_t self:capability { net_admin net_raw setuid setgid };
|
|
dontaudit traceroute_t self:capability { sys_admin };
|
|
allow traceroute_t self:capability2 bpf;
|
|
allow traceroute_t self:netlink_generic_socket create_socket_perms;
|
|
allow traceroute_t self:netlink_rdma_socket create_socket_perms;
|
|
allow traceroute_t self:rawip_socket create_socket_perms;
|
|
allow traceroute_t self:packet_socket { create_socket_perms map };
|
|
allow traceroute_t self:udp_socket create_socket_perms;
|
|
allow traceroute_t self:sctp_socket create_socket_perms;
|
|
allow traceroute_t self:dccp_socket create_socket_perms;
|
|
allow traceroute_t self:icmp_socket create_socket_perms;
|
|
allow traceroute_t self:dccp_socket create_socket_perms;
|
|
|
|
kernel_read_system_state(traceroute_t)
|
|
kernel_read_network_state(traceroute_t)
|
|
kernel_read_net_sysctls(traceroute_t)
|
|
kernel_request_load_module(traceroute_t)
|
|
kernel_search_network_sysctl(traceroute_t)
|
|
|
|
corenet_all_recvfrom_netlabel(traceroute_t)
|
|
corenet_tcp_sendrecv_generic_if(traceroute_t)
|
|
corenet_udp_sendrecv_generic_if(traceroute_t)
|
|
corenet_raw_sendrecv_generic_if(traceroute_t)
|
|
corenet_tcp_sendrecv_generic_node(traceroute_t)
|
|
corenet_udp_sendrecv_generic_node(traceroute_t)
|
|
corenet_raw_sendrecv_generic_node(traceroute_t)
|
|
corenet_tcp_sendrecv_all_ports(traceroute_t)
|
|
corenet_udp_sendrecv_all_ports(traceroute_t)
|
|
corenet_udp_bind_generic_node(traceroute_t)
|
|
corenet_tcp_bind_generic_node(traceroute_t)
|
|
# traceroute needs this but not tracepath
|
|
corenet_raw_bind_generic_node(traceroute_t)
|
|
corenet_udp_bind_traceroute_port(traceroute_t)
|
|
corenet_tcp_connect_all_ports(traceroute_t)
|
|
corenet_sendrecv_all_client_packets(traceroute_t)
|
|
corenet_sendrecv_traceroute_server_packets(traceroute_t)
|
|
corenet_sctp_bind_generic_node(traceroute_t)
|
|
corenet_icmp_bind_generic_node(traceroute_t)
|
|
|
|
corecmd_exec_bin(traceroute_t)
|
|
|
|
dev_getattr_infiniband_dev(traceroute_t)
|
|
|
|
fs_dontaudit_getattr_xattr_fs(traceroute_t)
|
|
|
|
domain_use_interactive_fds(traceroute_t)
|
|
|
|
files_read_etc_files(traceroute_t)
|
|
files_read_usr_files(traceroute_t)
|
|
files_dontaudit_search_var(traceroute_t)
|
|
|
|
init_use_fds(traceroute_t)
|
|
|
|
auth_use_nsswitch(traceroute_t)
|
|
|
|
logging_send_syslog_msg(traceroute_t)
|
|
|
|
|
|
#rules needed for nmap
|
|
dev_read_rand(traceroute_t)
|
|
dev_read_urand(traceroute_t)
|
|
|
|
term_use_all_inherited_terms(traceroute_t)
|
|
|
|
tunable_policy(`selinuxuser_ping',`
|
|
term_use_all_ttys(traceroute_t)
|
|
term_use_all_ptys(traceroute_t)
|
|
',`
|
|
term_dontaudit_use_all_ttys(traceroute_t)
|
|
term_dontaudit_use_all_ptys(traceroute_t)
|
|
')
|