Chris PeBenito ab58ad
#DESC Ping - Send ICMP messages to network hosts
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author:  David A. Wheeler <dwheeler@ida.org>
Chris PeBenito ab58ad
# X-Debian-Packages: iputils-ping netkit-ping iputils-arping arping hping2
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Rules for the ping_t domain.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# ping_t is the domain for the ping program.
Chris PeBenito ab58ad
# ping_exec_t is the type of the corresponding program.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
type ping_t, domain, privlog, nscd_client_domain;
Chris PeBenito ab58ad
role sysadm_r types ping_t;
Chris PeBenito ab58ad
role system_r types ping_t;
Chris PeBenito ab58ad
in_user_role(ping_t)
Chris PeBenito ab58ad
type ping_exec_t, file_type, sysadmfile, exec_type;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
ifdef(`targeted_policy', `
Chris PeBenito ab58ad
	allow ping_t { devpts_t ttyfile ptyfile }:chr_file rw_file_perms;
Chris PeBenito ab58ad
', `
Chris PeBenito ab58ad
bool user_ping false;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
if (user_ping) {
Chris PeBenito ab58ad
	domain_auto_trans(unpriv_userdomain, ping_exec_t, ping_t)
Chris PeBenito ab58ad
	# allow access to the terminal
Chris PeBenito ab58ad
	allow ping_t { ttyfile ptyfile }:chr_file rw_file_perms;
Chris PeBenito ab58ad
	ifdef(`gnome-pty-helper.te', `allow ping_t gphdomain:fd use;')
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Transition into this domain when you run this program.
Chris PeBenito ab58ad
domain_auto_trans(sysadm_t, ping_exec_t, ping_t)
Chris PeBenito ab58ad
domain_auto_trans(initrc_t, ping_exec_t, ping_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
uses_shlib(ping_t)
Chris PeBenito ab58ad
can_network_client(ping_t)
Chris PeBenito ab58ad
can_resolve(ping_t)
Chris PeBenito ab58ad
can_ypbind(ping_t)
Chris PeBenito ab58ad
allow ping_t etc_t:file { getattr read };
Chris PeBenito ab58ad
allow ping_t self:unix_stream_socket create_socket_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Let ping create raw ICMP packets.
Chris PeBenito ab58ad
allow ping_t self:rawip_socket { create ioctl read write bind getopt setopt };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Use capabilities.
Chris PeBenito ab58ad
allow ping_t self:capability { net_raw setuid };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Access the terminal.
Chris PeBenito ab58ad
allow ping_t admin_tty_type:chr_file rw_file_perms;
Chris PeBenito ab58ad
ifdef(`gnome-pty-helper.te', `allow ping_t sysadm_gph_t:fd use;')
Chris PeBenito ab58ad
allow ping_t privfd:fd use;
Chris PeBenito ab58ad
dontaudit ping_t fs_t:filesystem getattr;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# it tries to access /var/run
Chris PeBenito ab58ad
dontaudit ping_t var_t:dir search;
Chris PeBenito ab58ad
dontaudit ping_t devtty_t:chr_file { read write };
Chris PeBenito ab58ad
dontaudit ping_t self:capability sys_tty_config;
Chris PeBenito ab58ad
ifdef(`hide_broken_symptoms', `
Chris PeBenito ab58ad
dontaudit ping_t init_t:fd use;
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad