Chris PeBenito 31b7c0
#DESC Portmap - Maintain RPC program number map
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Authors:  Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser  
Chris PeBenito 31b7c0
#           Russell Coker <russell@coker.com.au>
Chris PeBenito 31b7c0
# X-Debian-Packages: portmap
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#################################
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Rules for the portmap_t domain.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
daemon_domain(portmap, `, nscd_client_domain')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
can_network(portmap_t)
Chris PeBenito 31b7c0
allow portmap_t port_type:tcp_socket name_connect;
Chris PeBenito 31b7c0
can_ypbind(portmap_t)
Chris PeBenito 31b7c0
allow portmap_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 31b7c0
allow portmap_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
tmp_domain(portmap)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow portmap_t portmap_port_t:{ udp_socket tcp_socket } name_bind;
Chris PeBenito 31b7c0
dontaudit portmap_t reserved_port_type:{ udp_socket tcp_socket } name_bind;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# portmap binds to arbitary ports
Chris PeBenito 31b7c0
allow portmap_t port_t:{ udp_socket tcp_socket } name_bind;
Chris PeBenito 31b7c0
allow portmap_t reserved_port_t:{ udp_socket tcp_socket } name_bind;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow portmap_t etc_t:file { getattr read };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Send to ypbind, initrc, rpc.statd, xinetd.
Chris PeBenito 31b7c0
ifdef(`ypbind.te',
Chris PeBenito 31b7c0
`can_udp_send(portmap_t, ypbind_t)')
Chris PeBenito 31b7c0
can_udp_send(portmap_t, { initrc_t init_t })
Chris PeBenito 31b7c0
can_udp_send(init_t, portmap_t)
Chris PeBenito 31b7c0
ifdef(`rpcd.te',
Chris PeBenito 31b7c0
`can_udp_send(portmap_t, rpcd_t)')
Chris PeBenito 31b7c0
ifdef(`inetd.te',
Chris PeBenito 31b7c0
`can_udp_send(portmap_t, inetd_t)')
Chris PeBenito 31b7c0
ifdef(`lpd.te',
Chris PeBenito 31b7c0
`can_udp_send(portmap_t, lpd_t)')
Chris PeBenito 31b7c0
ifdef(`tcpd.te', `
Chris PeBenito 31b7c0
can_udp_send(tcpd_t, portmap_t)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
can_udp_send(portmap_t, kernel_t)
Chris PeBenito 31b7c0
can_udp_send(kernel_t, portmap_t)
Chris PeBenito 31b7c0
can_udp_send(sysadm_t, portmap_t)
Chris PeBenito 31b7c0
can_udp_send(portmap_t, sysadm_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Use capabilities
Chris PeBenito 31b7c0
allow portmap_t self:capability { net_bind_service setuid setgid };
Chris PeBenito 31b7c0
allow portmap_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
application_domain(portmap_helper)
Chris PeBenito 31b7c0
role system_r types portmap_helper_t;
Chris PeBenito 31b7c0
domain_auto_trans(initrc_t, portmap_helper_exec_t, portmap_helper_t)
Chris PeBenito 31b7c0
dontaudit portmap_helper_t self:capability { net_admin };
Chris PeBenito 31b7c0
allow portmap_helper_t self:capability { net_bind_service };
Chris PeBenito 31b7c0
allow portmap_helper_t initrc_var_run_t:file rw_file_perms;
Chris PeBenito 31b7c0
file_type_auto_trans(portmap_helper_t, var_run_t, portmap_var_run_t, file)
Chris PeBenito 31b7c0
allow portmap_helper_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 31b7c0
can_network(portmap_helper_t)
Chris PeBenito 31b7c0
allow portmap_helper_t port_type:tcp_socket name_connect;
Chris PeBenito 31b7c0
can_ypbind(portmap_helper_t)
Chris PeBenito 31b7c0
dontaudit portmap_helper_t admin_tty_type:chr_file rw_file_perms;
Chris PeBenito 31b7c0
allow portmap_helper_t etc_t:file { getattr read };
Chris PeBenito 31b7c0
dontaudit portmap_helper_t { userdomain privfd }:fd use;
Chris PeBenito 31b7c0
allow portmap_helper_t reserved_port_t:{ tcp_socket udp_socket } name_bind;
Chris PeBenito 31b7c0
dontaudit portmap_helper_t reserved_port_type:{ tcp_socket udp_socket } name_bind;