Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# can_network(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for accessing the network.
Chris PeBenito ab58ad
# See types/network.te for the network types.
Chris PeBenito ab58ad
# See net_contexts for security contexts for network entities.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`base_can_network',`
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allow the domain to create and use $2 sockets.
Chris PeBenito ab58ad
# Other kinds of sockets must be separately authorized for use.
Chris PeBenito ab58ad
allow $1 self:$2_socket connected_socket_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allow the domain to send or receive using any network interface.
Chris PeBenito ab58ad
# netif_type is a type attribute for all network interface types.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
allow $1 netif_t:netif { $2_recv $2_send rawip_send rawip_recv };
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allow the domain to send to or receive from any node.
Chris PeBenito ab58ad
# node_type is a type attribute for all node types.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
allow $1 node_type:node { $2_send rawip_send };
Chris PeBenito ab58ad
allow $1 node_type:node { $2_recv rawip_recv };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allow the domain to send to or receive from any port.
Chris PeBenito ab58ad
# port_type is a type attribute for all port types.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
ifelse($3, `', `
Chris PeBenito ab58ad
allow $1 port_type:$2_socket { send_msg recv_msg };
Chris PeBenito ab58ad
', `
Chris PeBenito ab58ad
allow $1 $3:$2_socket { send_msg recv_msg };
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# XXX Allow binding to any node type.  Remove once
Chris PeBenito ab58ad
# individual rules have been added to all domains that 
Chris PeBenito ab58ad
# bind sockets. 
Chris PeBenito ab58ad
allow $1 node_type:$2_socket node_bind;
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allow access to network files including /etc/resolv.conf
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
allow $1 net_conf_t:file r_file_perms;
Chris PeBenito ab58ad
')dnl end can_network definition
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# can_network_server_tcp(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for accessing a tcp network.
Chris PeBenito ab58ad
# See types/network.te for the network types.
Chris PeBenito ab58ad
# See net_contexts for security contexts for network entities.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`can_network_server_tcp',`
Chris PeBenito ab58ad
base_can_network($1, tcp, `$2')
Chris PeBenito ab58ad
allow $1 self:tcp_socket { listen accept };
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# can_network_client_tcp(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for accessing a tcp network.
Chris PeBenito ab58ad
# See types/network.te for the network types.
Chris PeBenito ab58ad
# See net_contexts for security contexts for network entities.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`can_network_client_tcp',`
Chris PeBenito ab58ad
base_can_network($1, tcp, `$2')
Chris PeBenito ab58ad
allow $1 self:tcp_socket { connect };
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# can_network_tcp(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for accessing the network.
Chris PeBenito ab58ad
# See types/network.te for the network types.
Chris PeBenito ab58ad
# See net_contexts for security contexts for network entities.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`can_network_tcp',`
Chris PeBenito ab58ad
Chris PeBenito ab58ad
can_network_server_tcp($1, `$2')
Chris PeBenito ab58ad
can_network_client_tcp($1, `$2')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# can_network_udp(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for accessing the network.
Chris PeBenito ab58ad
# See types/network.te for the network types.
Chris PeBenito ab58ad
# See net_contexts for security contexts for network entities.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`can_network_udp',`
Chris PeBenito ab58ad
base_can_network($1, udp, `$2')
Chris PeBenito ab58ad
allow $1 self:udp_socket { connect };
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# can_network_server(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for accessing the network.
Chris PeBenito ab58ad
# See types/network.te for the network types.
Chris PeBenito ab58ad
# See net_contexts for security contexts for network entities.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`can_network_server',`
Chris PeBenito ab58ad
Chris PeBenito ab58ad
can_network_server_tcp($1, `$2')
Chris PeBenito ab58ad
can_network_udp($1, `$2')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
')dnl end can_network_server definition
Chris PeBenito ab58ad
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# can_network_client(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for accessing the network.
Chris PeBenito ab58ad
# See types/network.te for the network types.
Chris PeBenito ab58ad
# See net_contexts for security contexts for network entities.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`can_network_client',`
Chris PeBenito ab58ad
Chris PeBenito ab58ad
can_network_client_tcp($1, `$2')
Chris PeBenito ab58ad
can_network_udp($1, `$2')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
')dnl end can_network_client definition
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# can_network(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for accessing the network.
Chris PeBenito ab58ad
# See types/network.te for the network types.
Chris PeBenito ab58ad
# See net_contexts for security contexts for network entities.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`can_network',`
Chris PeBenito ab58ad
Chris PeBenito ab58ad
can_network_tcp($1, `$2')
Chris PeBenito ab58ad
can_network_udp($1, `$2')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
ifdef(`mount.te', `
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allow the domain to send NFS client requests via the socket
Chris PeBenito ab58ad
# created by mount.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
allow $1 mount_t:udp_socket rw_socket_perms;
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
')dnl end can_network definition
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`can_resolve',`
Chris PeBenito ab58ad
can_network_client($1, `dns_port_t')
Chris PeBenito ab58ad
allow $1 dns_port_t:tcp_socket name_connect;
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`can_portmap',`
Chris PeBenito ab58ad
can_network_client($1, `portmap_port_t')
Chris PeBenito ab58ad
allow $1 portmap_port_t:tcp_socket name_connect;
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`can_ldap',`
Chris PeBenito ab58ad
can_network_client_tcp($1, `ldap_port_t')
Chris PeBenito ab58ad
allow $1 ldap_port_t:tcp_socket name_connect;
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`can_winbind',`
Chris PeBenito ab58ad
ifdef(`winbind.te', `
Chris PeBenito ab58ad
allow $1 winbind_var_run_t:dir { getattr search };
Chris PeBenito ab58ad
allow $1 winbind_t:unix_stream_socket connectto;
Chris PeBenito ab58ad
allow $1 winbind_var_run_t:sock_file { getattr read write };
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# nsswitch_domain(domain)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Permissions for looking up uid/username mapping via nsswitch
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`nsswitch_domain', `
Chris PeBenito ab58ad
can_resolve($1)
Chris PeBenito ab58ad
can_ypbind($1)
Chris PeBenito ab58ad
can_ldap($1)
Chris PeBenito ab58ad
can_winbind($1)
Chris PeBenito ab58ad
')