2005-05-05 17:44:36 +00:00
|
|
|
|
|
|
|
policy_module(devices,1.0)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
|
|
|
type netutils_t;
|
|
|
|
type netutils_exec_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
init_system_domain(netutils_t,netutils_exec_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
role system_r types netutils_t;
|
|
|
|
|
|
|
|
type netutils_tmp_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_tmp_file(netutils_tmp_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
|
|
|
type ping_t; #, nscd_client_domain;
|
|
|
|
type ping_exec_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
init_system_domain(ping_t,ping_exec_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
role system_r types ping_t;
|
|
|
|
|
|
|
|
type traceroute_t; #, nscd_client_domain;
|
|
|
|
type traceroute_exec_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
init_system_domain(traceroute_t,traceroute_exec_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
role system_r types traceroute_t;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Control users use of ping and traceroute
|
|
|
|
#
|
|
|
|
bool user_ping false;
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# 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 };
|
2005-06-09 17:21:52 +00:00
|
|
|
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;
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-09 17:21:52 +00:00
|
|
|
allow netutils_t netutils_tmp_t:dir create_dir_perms;
|
|
|
|
allow netutils_t netutils_tmp_t:file create_file_perms;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_create_tmp_files(netutils_t, netutils_tmp_t, { file dir })
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
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)
|
|
|
|
|
|
|
|
fs_getattr_xattr_fs(netutils_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
init_use_fd(netutils_t)
|
|
|
|
init_use_script_pty(netutils_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_use_wide_inherit_fd(netutils_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_generic_etc_files(netutils_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
# for nscd
|
2005-06-13 17:35:46 +00:00
|
|
|
files_dontaudit_search_var(netutils_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
libs_use_ld_so(netutils_t)
|
|
|
|
libs_use_shared_libs(netutils_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_send_syslog_msg(netutils_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
|
|
|
miscfiles_read_localization(netutils_t)
|
|
|
|
|
|
|
|
ifdef(`TODO',`
|
|
|
|
role sysadm_r types netutils_t;
|
|
|
|
|
|
|
|
can_ypbind(netutils_t)
|
|
|
|
|
|
|
|
domain_auto_trans(sysadm_t, netutils_exec_t, netutils_t)
|
|
|
|
|
|
|
|
# Inherit and use descriptors from init.
|
|
|
|
allow netutils_t userdomain:fd use;
|
|
|
|
|
|
|
|
# Access terminals.
|
|
|
|
allow netutils_t admin_tty_type:chr_file rw_file_perms;
|
|
|
|
ifdef(`gnome-pty-helper.te', `allow netutils_t sysadm_gph_t:fd use;')
|
|
|
|
allow netutils_t proc_t:dir search;
|
|
|
|
|
|
|
|
') dnl end TODO
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Ping local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow ping_t self:capability setuid;
|
|
|
|
dontaudit ping_t self:capability sys_tty_config;
|
|
|
|
|
2005-06-09 17:21:52 +00:00
|
|
|
allow ping_t self:tcp_socket create_socket_perms;
|
|
|
|
allow ping_t self:udp_socket create_socket_perms;
|
2005-05-05 17:44:36 +00:00
|
|
|
allow ping_t self:rawip_socket { create ioctl read write bind getopt setopt };
|
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
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)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_dontaudit_getattr_xattr_fs(ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_use_wide_inherit_fd(ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_generic_etc_files(ping_t)
|
|
|
|
files_dontaudit_search_var(ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
libs_use_ld_so(ping_t)
|
|
|
|
libs_use_shared_libs(ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
sysnet_read_config(ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_send_syslog_msg(ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
|
|
|
if (user_ping) {
|
2005-06-10 01:01:13 +00:00
|
|
|
term_use_all_user_ttys(ping_t)
|
|
|
|
term_use_all_user_ptys(ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ifdef(`TODO',`
|
2005-05-12 20:49:39 +00:00
|
|
|
can_ypbind(ping_t)
|
|
|
|
|
|
|
|
domain_auto_trans(sysadm_t, ping_exec_t, ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
role sysadm_r types ping_t;
|
2005-05-12 20:49:39 +00:00
|
|
|
allow ping_t admin_tty_type:chr_file rw_file_perms;
|
|
|
|
ifdef(`gnome-pty-helper.te', `allow ping_t sysadm_gph_t:fd use;')
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-05-12 20:49:39 +00:00
|
|
|
in_user_role(ping_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
if (user_ping) {
|
|
|
|
domain_auto_trans(unpriv_userdomain, ping_exec_t, ping_t)
|
|
|
|
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 };
|
2005-06-09 17:21:52 +00:00
|
|
|
allow traceroute_t self:rawip_socket create_socket_perms;
|
|
|
|
allow traceroute_t self:packet_socket create_socket_perms;
|
2005-05-05 17:44:36 +00:00
|
|
|
allow traceroute_t self:netlink_route_socket { bind create getattr nlmsg_read read write };
|
|
|
|
|
|
|
|
kernel_read_system_state(traceroute_t)
|
|
|
|
kernel_read_network_state(traceroute_t)
|
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
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)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_dontaudit_getattr_xattr_fs(traceroute_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_use_wide_inherit_fd(traceroute_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_generic_etc_files(traceroute_t)
|
|
|
|
files_dontaudit_search_var(traceroute_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
libs_use_ld_so(traceroute_t)
|
|
|
|
libs_use_shared_libs(traceroute_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_send_syslog_msg(traceroute_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
|
|
|
miscfiles_read_localization(traceroute_t)
|
|
|
|
|
|
|
|
#rules needed for nmap
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_read_rand(traceroute_t)
|
|
|
|
dev_read_urand(traceroute_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_usr_files(traceroute_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
|
|
|
|
if (user_ping) {
|
2005-06-10 01:01:13 +00:00
|
|
|
term_use_all_user_ttys(traceroute_t)
|
|
|
|
term_use_all_user_ptys(traceroute_t)
|
2005-05-05 17:44:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ifdef(`TODO',`
|
|
|
|
role sysadm_r types traceroute_t;
|
|
|
|
|
|
|
|
can_ypbind(traceroute_t)
|
|
|
|
|
|
|
|
# Transition into this domain when you run this program.
|
|
|
|
domain_auto_trans(sysadm_t, traceroute_exec_t, traceroute_t)
|
|
|
|
|
|
|
|
# Access the terminal.
|
|
|
|
allow traceroute_t admin_tty_type:chr_file rw_file_perms;
|
|
|
|
ifdef(`gnome-pty-helper.te', `allow traceroute_t sysadm_gph_t:fd use;')
|
|
|
|
|
|
|
|
in_user_role(traceroute_t)
|
|
|
|
if (user_ping) {
|
|
|
|
domain_auto_trans(unpriv_userdomain, traceroute_exec_t, traceroute_t)
|
|
|
|
}
|
|
|
|
|
|
|
|
#rules needed for nmap
|
|
|
|
dontaudit traceroute_t userdomain:dir search;
|
|
|
|
') dnl end TODO
|