selinux-policy/refpolicy/policy/modules/admin/netutils.te

241 lines
6.0 KiB
Plaintext

policy_module(netutils,1.0)
########################################
#
# Declarations
#
type netutils_t;
type netutils_exec_t;
init_system_domain(netutils_t,netutils_exec_t)
role system_r types netutils_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)
role system_r types ping_t;
type traceroute_t;
type traceroute_exec_t;
init_system_domain(traceroute_t,traceroute_exec_t)
role system_r types traceroute_t;
########################################
#
# Netutils local policy
#
# Perform network administration operations and have raw access to the network.
allow netutils_t self:capability { net_admin net_raw setuid setgid };
allow netutils_t self:process { sigkill sigstop signull signal };
allow netutils_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write };
allow netutils_t self:packet_socket create_socket_perms;
allow netutils_t self:udp_socket create_socket_perms;
allow netutils_t self:tcp_socket create_socket_perms;
allow netutils_t netutils_tmp_t:dir create_dir_perms;
allow netutils_t netutils_tmp_t:file create_file_perms;
files_create_tmp_files(netutils_t, netutils_tmp_t, { file dir })
kernel_search_proc(netutils_t)
corenet_tcp_sendrecv_all_if(netutils_t)
corenet_raw_sendrecv_all_if(netutils_t)
corenet_udp_sendrecv_all_if(netutils_t)
corenet_tcp_sendrecv_all_nodes(netutils_t)
corenet_raw_sendrecv_all_nodes(netutils_t)
corenet_udp_sendrecv_all_nodes(netutils_t)
corenet_tcp_sendrecv_all_ports(netutils_t)
corenet_udp_sendrecv_all_ports(netutils_t)
corenet_tcp_bind_all_nodes(netutils_t)
corenet_udp_bind_all_nodes(netutils_t)
corenet_tcp_connect_all_ports(netutils_t)
fs_getattr_xattr_fs(netutils_t)
domain_use_wide_inherit_fd(netutils_t)
files_read_etc_files(netutils_t)
# for nscd
files_dontaudit_search_var(netutils_t)
init_use_fd(netutils_t)
init_use_script_pty(netutils_t)
libs_use_ld_so(netutils_t)
libs_use_shared_libs(netutils_t)
logging_send_syslog_msg(netutils_t)
miscfiles_read_localization(netutils_t)
sysnet_read_config(netutils_t)
userdom_use_all_user_fd(netutils_t)
ifdef(`targeted_policy',`
term_use_generic_pty(netutils_t)
term_use_unallocated_tty(netutils_t)
')
optional_policy(`nis.te',`
nis_use_ypbind(netutils_t)
')
ifdef(`TODO',`
ifdef(`gnome-pty-helper.te', `allow netutils_t sysadm_gph_t:fd use;')
') dnl end TODO
########################################
#
# Ping local policy
#
allow ping_t self:capability { setuid net_raw };
dontaudit ping_t self:capability sys_tty_config;
allow ping_t self:tcp_socket create_socket_perms;
allow ping_t self:udp_socket create_socket_perms;
allow ping_t self:rawip_socket { create ioctl read write bind getopt setopt };
corenet_tcp_sendrecv_all_if(ping_t)
corenet_udp_sendrecv_all_if(ping_t)
corenet_raw_sendrecv_all_if(ping_t)
corenet_raw_sendrecv_all_nodes(ping_t)
corenet_tcp_sendrecv_all_nodes(ping_t)
corenet_udp_sendrecv_all_nodes(ping_t)
corenet_tcp_sendrecv_all_ports(ping_t)
corenet_udp_sendrecv_all_ports(ping_t)
corenet_udp_bind_all_nodes(ping_t)
corenet_tcp_bind_all_nodes(ping_t)
fs_dontaudit_getattr_xattr_fs(ping_t)
domain_use_wide_inherit_fd(ping_t)
files_read_etc_files(ping_t)
files_dontaudit_search_var(ping_t)
libs_use_ld_so(ping_t)
libs_use_shared_libs(ping_t)
sysnet_read_config(ping_t)
sysnet_dns_name_resolve(ping_t)
logging_send_syslog_msg(ping_t)
ifdef(`hide_broken_symptoms',`
init_dontaudit_use_fd(ping_t)
')
ifdef(`targeted_policy',`
term_use_unallocated_tty(ping_t)
term_use_generic_pty(ping_t)
term_use_all_user_ttys(ping_t)
term_use_all_user_ptys(ping_t)
',`
tunable_policy(`user_ping',`
term_use_all_user_ttys(ping_t)
term_use_all_user_ptys(ping_t)
')
')
optional_policy(`nis.te',`
nis_use_ypbind(ping_t)
')
optional_policy(`nscd.te',`
nscd_use_socket(ping_t)
')
optional_policy(`pcmcia.te',`
pcmcia_use_cardmgr_fd(ping_t)
')
optional_policy(`hotplug.te',`
hotplug_use_fd(ping_t)
')
ifdef(`TODO',`
if(user_ping) {
ifdef(`gnome-pty-helper.te', `allow ping_t gphdomain:fd use;')
}
') dnl end TODO
########################################
#
# Traceroute local policy
#
allow traceroute_t self:capability { net_admin net_raw setuid setgid };
allow traceroute_t self:rawip_socket create_socket_perms;
allow traceroute_t self:packet_socket create_socket_perms;
allow traceroute_t self:netlink_route_socket { bind create getattr nlmsg_read read write };
allow traceroute_t self:udp_socket create_socket_perms;
kernel_read_system_state(traceroute_t)
kernel_read_network_state(traceroute_t)
corenet_tcp_sendrecv_all_if(traceroute_t)
corenet_udp_sendrecv_all_if(traceroute_t)
corenet_raw_sendrecv_all_if(traceroute_t)
corenet_raw_sendrecv_all_nodes(traceroute_t)
corenet_tcp_sendrecv_all_nodes(traceroute_t)
corenet_udp_sendrecv_all_nodes(traceroute_t)
corenet_tcp_sendrecv_all_ports(traceroute_t)
corenet_udp_sendrecv_all_ports(traceroute_t)
corenet_udp_bind_all_nodes(traceroute_t)
corenet_tcp_bind_all_nodes(traceroute_t)
# traceroute needs this but not tracepath
corenet_raw_bind_all_nodes(traceroute_t)
corenet_tcp_connect_all_ports(traceroute_t)
fs_dontaudit_getattr_xattr_fs(traceroute_t)
domain_use_wide_inherit_fd(traceroute_t)
files_read_etc_files(traceroute_t)
files_dontaudit_search_var(traceroute_t)
libs_use_ld_so(traceroute_t)
libs_use_shared_libs(traceroute_t)
logging_send_syslog_msg(traceroute_t)
miscfiles_read_localization(traceroute_t)
#rules needed for nmap
dev_read_rand(traceroute_t)
dev_read_urand(traceroute_t)
files_read_usr_files(traceroute_t)
sysnet_read_config(traceroute_t)
ifdef(`targeted_policy',`
term_use_unallocated_tty(traceroute_t)
term_use_generic_pty(traceroute_t)
')
tunable_policy(`user_ping',`
term_use_all_user_ttys(traceroute_t)
term_use_all_user_ptys(traceroute_t)
')
optional_policy(`nis.te',`
nis_use_ypbind(traceroute_t)
')
optional_policy(`nscd.te',`
nscd_use_socket(traceroute_t)
')
ifdef(`TODO',`
ifdef(`gnome-pty-helper.te', `allow traceroute_t sysadm_gph_t:fd use;')
#rules needed for nmap
dontaudit traceroute_t userdomain:dir search;
') dnl end TODO