From 2ba9a794db7d31f738df6de6b6f780867d0f878b Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Fri, 17 Jun 2005 19:17:57 +0000 Subject: [PATCH] interface review, and remove net_raw from raw node sends. only give capability for raw send on an interface --- .../policy/modules/kernel/corenetwork.if.in | 522 +++++++----------- 1 file changed, 190 insertions(+), 332 deletions(-) diff --git a/refpolicy/policy/modules/kernel/corenetwork.if.in b/refpolicy/policy/modules/kernel/corenetwork.if.in index 60fd6dff..f1189cf3 100644 --- a/refpolicy/policy/modules/kernel/corenetwork.if.in +++ b/refpolicy/policy/modules/kernel/corenetwork.if.in @@ -13,49 +13,40 @@ ## # define(`corenet_tcp_sendrecv_generic_if',` - gen_require(`$0'_depend) + gen_require(` + type netif_t; + class netif { tcp_send tcp_recv }; + ') allow $1 netif_t:netif { tcp_send tcp_recv }; ') -define(`corenet_tcp_sendrecv_generic_if_depend',` - type netif_t; - - class netif { tcp_send tcp_recv }; -') - ####################################### # # corenet_udp_send_generic_if(domain) # define(`corenet_udp_send_generic_if',` - gen_require(`$0'_depend) + gen_require(` + type netif_t; + class netif udp_send; + ') allow $1 netif_t:netif udp_send; ') -define(`corenet_udp_send_generic_if_depend',` - type netif_t; - - class netif udp_send; -') - ####################################### # # corenet_udp_receive_generic_if(domain) # define(`corenet_udp_receive_generic_if',` - gen_require(`$0'_depend) + gen_require(` + type netif_t; + class netif udp_recv; + ') allow $1 netif_t:netif udp_recv; ') -define(`corenet_udp_receive_generic_if_depend',` - type netif_t; - - class netif udp_recv; -') - ####################################### # # corenet_udp_sendrecv_generic_if(domain) @@ -70,35 +61,29 @@ define(`corenet_udp_sendrecv_generic_if',` # corenet_raw_send_generic_if(domain) # define(`corenet_raw_send_generic_if',` - gen_require(`$0'_depend) + gen_require(` + type netif_t; + class netif rawip_send; + class capability net_raw; + ') allow $1 netif_t:netif rawip_send; allow $1 self:capability net_raw; ') -define(`corenet_raw_send_generic_if_depend',` - type netif_t; - - class netif rawip_send; - class capability net_raw; -') - ####################################### # # corenet_raw_receive_generic_if(domain) # define(`corenet_raw_receive_generic_if',` - gen_require(`$0'_depend) + gen_require(` + type netif_t; + class netif rawip_recv; + ') allow $1 netif_t:netif rawip_recv; ') -define(`corenet_raw_receive_generic_if_depend',` - type netif_t; - - class netif rawip_recv; -') - ####################################### # # corenet_raw_sendrecv_generic_if(domain) @@ -113,49 +98,40 @@ define(`corenet_raw_sendrecv_generic_if',` # corenet_tcp_sendrecv_all_if(domain) # define(`corenet_tcp_sendrecv_all_if',` - gen_require(`$0'_depend) + gen_require(` + attribute netif_type; + class netif { tcp_send tcp_recv }; + ') allow $1 netif_type:netif { tcp_send tcp_recv }; ') -define(`corenet_tcp_sendrecv_all_if_depend',` - attribute netif_type; - - class netif { tcp_send tcp_recv }; -') - ####################################### # # corenet_udp_send_all_if(domain) # define(`corenet_udp_send_all_if',` - gen_require(`$0'_depend) + gen_require(` + attribute netif_type; + class netif udp_send; + ') allow $1 netif_type:netif udp_send; ') -define(`corenet_udp_send_all_if_depend',` - attribute netif_type; - - class netif udp_send; -') - ####################################### # # corenet_udp_receive_all_if(domain) # define(`corenet_udp_receive_all_if',` - gen_require(`$0'_depend) + gen_require(` + attribute netif_type; + class netif udp_recv; + ') allow $1 netif_type:netif udp_recv; ') -define(`corenet_udp_receive_all_if_depend',` - attribute netif_type; - - class netif udp_recv; -') - ####################################### # # corenet_udp_sendrecv_all_if(domain) @@ -170,35 +146,29 @@ define(`corenet_udp_sendrecv_all_if',` # corenet_raw_send_all_if(domain) # define(`corenet_raw_send_all_if',` - gen_require(`$0'_depend) + gen_require(` + attribute netif_type; + class netif rawip_send; + class capability net_raw; + ') allow $1 netif_type:netif rawip_send; allow $1 self:capability net_raw; ') -define(`corenet_raw_send_all_if_depend',` - attribute netif_type; - - class netif rawip_send; - class capability net_raw; -') - ####################################### # # corenet_raw_receive_all_if(domain) # define(`corenet_raw_receive_all_if',` - gen_require(`$0'_depend) + gen_require(` + attribute netif_type; + class netif rawip_recv; + ') allow $1 netif_type:netif rawip_recv; ') -define(`corenet_raw_receive_all_if_depend',` - attribute netif_type; - - class netif rawip_recv; -') - ####################################### # # corenet_raw_sendrecv_all_if(domain) @@ -213,49 +183,40 @@ define(`corenet_raw_sendrecv_all_if',` # corenet_tcp_sendrecv_generic_node(domain) # define(`corenet_tcp_sendrecv_generic_node',` - gen_require(`$0'_depend) + gen_require(` + type node_t; + class node { tcp_send tcp_recv }; + ') allow $1 node_t:node { tcp_send tcp_recv }; ') -define(`corenet_tcp_sendrecv_generic_node_depend',` - type node_t; - - class node { tcp_send tcp_recv }; -') - ####################################### # # corenet_udp_send_generic_node(domain) # define(`corenet_udp_send_generic_node',` - gen_require(`$0'_depend) + gen_require(` + type node_t; + class node udp_send; + ') allow $1 node_t:node udp_send; ') -define(`corenet_udp_send_generic_node_depend',` - type node_t; - - class node udp_send; -') - ####################################### # # corenet_udp_receive_generic_node(domain) # define(`corenet_udp_receive_generic_node',` - gen_require(`$0'_depend) + gen_require(` + type node_t; + class node udp_recv; + ') allow $1 node_t:node udp_recv; ') -define(`corenet_udp_receive_generic_node_depend',` - type node_t; - - class node udp_recv; -') - ####################################### # # corenet_udp_sendrecv_generic_node(domain) @@ -270,17 +231,12 @@ define(`corenet_udp_sendrecv_generic_node',` # corenet_raw_send_generic_node(domain) # define(`corenet_raw_send_generic_node',` - gen_require(`$0'_depend) + gen_require(` + type node_t; + class node rawip_send; + ') allow $1 node_t:node rawip_send; - allow $1 self:capability net_raw; -') - -define(`corenet_raw_send_generic_node_depend',` - type node_t; - - class node rawip_send; - class capability net_raw; ') ####################################### @@ -288,17 +244,14 @@ define(`corenet_raw_send_generic_node_depend',` # corenet_raw_receive_generic_node(domain) # define(`corenet_raw_receive_generic_node',` - gen_require(`$0'_depend) + gen_require(` + type node_t; + class node rawip_recv; + ') allow $1 node_t:node rawip_recv; ') -define(`corenet_raw_receive_generic_node_depend',` - type node_t; - - class node rawip_recv; -') - ####################################### # # corenet_raw_sendrecv_generic_node(domain) @@ -313,81 +266,66 @@ define(`corenet_raw_sendrecv_generic_node',` # corenet_tcp_bind_generic_node(domain) # define(`corenet_tcp_bind_generic_node',` - gen_require(`$0'_depend) + gen_require(` + type node_t; + class tcp_socket node_bind; + ') allow $1 node_t:tcp_socket node_bind; ') -define(`corenet_tcp_bind_generic_node_depend',` - type node_t; - - class tcp_socket node_bind; -') - ####################################### # # corenet_udp_bind_generic_node(domain) # define(`corenet_udp_bind_generic_node',` - gen_require(`$0'_depend) + gen_require(` + type node_t; + class udp_socket node_bind; + ') allow $1 node_t:udp_socket node_bind; ') -define(`corenet_udp_bind_generic_node_depend',` - type node_t; - - class udp_socket node_bind; -') - ####################################### # # corenet_tcp_sendrecv_all_nodes(domain) # define(`corenet_tcp_sendrecv_all_nodes',` - gen_require(`$0'_depend) + gen_require(` + attribute node_type; + class node { tcp_send tcp_recv }; + ') allow $1 node_type:node { tcp_send tcp_recv }; ') -define(`corenet_tcp_sendrecv_all_nodes_depend',` - attribute node_type; - - class node { tcp_send tcp_recv }; -') - ####################################### # # corenet_udp_send_all_nodes(domain) # define(`corenet_udp_send_all_nodes',` - gen_require(`$0'_depend) + gen_require(` + attribute node_type; + class node udp_send; + ') allow $1 node_type:node udp_send; ') -define(`corenet_udp_send_all_nodes_depend',` - attribute node_type; - - class node udp_send; -') - ####################################### # # corenet_udp_receive_all_nodes(domain) # define(`corenet_udp_receive_all_nodes',` - gen_require(`$0'_depend) + gen_require(` + attribute node_type; + class node udp_recv; + ') allow $1 node_type:node udp_recv; ') -define(`corenet_udp_receive_all_nodes_depend',` - attribute node_type; - - class node udp_recv; -') - ####################################### # # corenet_udp_sendrecv_all_nodes(domain) @@ -402,17 +340,12 @@ define(`corenet_udp_sendrecv_all_nodes',` # corenet_raw_send_all_nodes(domain) # define(`corenet_raw_send_all_nodes',` - gen_require(`$0'_depend) + gen_require(` + attribute node_type; + class node rawip_send; + ') allow $1 node_type:node rawip_send; - allow $1 self:capability net_raw; -') - -define(`corenet_raw_send_all_nodes_depend',` - attribute node_type; - - class node rawip_send; - class capability net_raw; ') ####################################### @@ -420,17 +353,14 @@ define(`corenet_raw_send_all_nodes_depend',` # corenet_raw_receive_all_nodes(domain) # define(`corenet_raw_receive_all_nodes',` - gen_require(`$0'_depend) + gen_require(` + attribute node_type; + class node rawip_recv; + ') allow $1 node_type:node rawip_recv; ') -define(`corenet_raw_receive_all_nodes_depend',` - attribute node_type; - - class node rawip_recv; -') - ####################################### # # corenet_raw_sendrecv_all_nodes(domain) @@ -445,81 +375,66 @@ define(`corenet_raw_sendrecv_all_nodes',` # corenet_tcp_bind_all_nodes(domain) # define(`corenet_tcp_bind_all_nodes',` - gen_require(`$0'_depend) + gen_require(` + attribute node_type; + class tcp_socket node_bind; + ') allow $1 node_type:tcp_socket node_bind; ') -define(`corenet_tcp_bind_all_nodes_depend',` - attribute node_type; - - class tcp_socket node_bind; -') - ####################################### # # corenet_udp_bind_all_nodes(domain) # define(`corenet_udp_bind_all_nodes',` - gen_require(`$0'_depend) + gen_require(` + attribute node_type; + class udp_socket node_bind; + ') allow $1 node_type:udp_socket node_bind; ') -define(`corenet_udp_bind_all_nodes_depend',` - attribute node_type; - - class udp_socket node_bind; -') - ####################################### # # corenet_tcp_sendrecv_generic_port(domain) # define(`corenet_tcp_sendrecv_generic_port',` - gen_require(`$0'_depend) + gen_require(` + type port_t; + class tcp_socket { send_msg recv_msg }; + ') allow $1 port_t:tcp_socket { send_msg recv_msg }; ') -define(`corenet_tcp_sendrecv_generic_port_depend',` - type port_t; - - class tcp_socket { send_msg recv_msg }; -') - ####################################### # # corenet_udp_send_generic_port(domain) # define(`corenet_udp_send_generic_port',` - gen_require(`$0'_depend) + gen_require(` + type port_t; + class udp_socket send_msg; + ') allow $1 port_t:udp_socket send_msg; ') -define(`corenet_udp_send_generic_port_depend',` - type port_t; - - class udp_socket send_msg; -') - ####################################### # # corenet_udp_receive_generic_port(domain) # define(`corenet_udp_receive_generic_port',` - gen_require(`$0'_depend) + gen_require(` + type port_t; + class udp_socket recv_msg; + ') allow $1 port_t:udp_socket recv_msg; ') -define(`corenet_udp_receive_generic_port_depend',` - type port_t; - - class udp_socket recv_msg; -') - ####################################### # # corenet_udp_sendrecv_generic_port(domain) @@ -534,81 +449,66 @@ define(`corenet_udp_sendrecv_generic_port',` # corenet_tcp_bind_generic_port(domain) # define(`corenet_tcp_bind_generic_port',` - gen_require(`$0'_depend) + gen_require(` + type port_t; + class tcp_socket name_bind; + ') allow $1 port_t:tcp_socket name_bind; ') -define(`corenet_tcp_bind_generic_port_depend',` - type port_t; - - class tcp_socket name_bind; -') - ####################################### # # corenet_udp_bind_generic_port(domain) # define(`corenet_udp_bind_generic_port',` - gen_require(`$0'_depend) + gen_require(` + type port_t; + class udp_socket name_bind; + ') allow $1 port_t:udp_socket name_bind; ') -define(`corenet_udp_bind_generic_port_depend',` - type port_t; - - class udp_socket name_bind; -') - ####################################### # # corenet_tcp_sendrecv_all_ports(domain) # define(`corenet_tcp_sendrecv_all_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute port_type; + class tcp_socket { send_msg recv_msg }; + ') allow $1 port_type:tcp_socket { send_msg recv_msg }; ') -define(`corenet_tcp_sendrecv_all_ports_depend',` - attribute port_type; - - class tcp_socket { send_msg recv_msg }; -') - ####################################### # # corenet_udp_send_all_ports(domain) # define(`corenet_udp_send_all_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute port_type; + class udp_socket send_msg; + ') allow $1 port_type:udp_socket send_msg; ') -define(`corenet_udp_send_all_ports_depend',` - attribute port_type; - - class udp_socket send_msg; -') - ####################################### # # corenet_udp_receive_all_ports(domain) # define(`corenet_udp_receive_all_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute port_type; + class udp_socket recv_msg; + ') allow $1 port_type:udp_socket recv_msg; ') -define(`corenet_udp_receive_all_ports_depend',` - attribute port_type; - - class udp_socket recv_msg; -') - ####################################### # # corenet_udp_sendrecv_all_ports(domain) @@ -623,81 +523,66 @@ define(`corenet_udp_sendrecv_all_ports',` # corenet_tcp_bind_all_ports(domain) # define(`corenet_tcp_bind_all_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute port_type; + class tcp_socket name_bind; + ') allow $1 port_type:tcp_socket name_bind; ') -define(`corenet_tcp_bind_all_ports_depend',` - attribute port_type; - - class tcp_socket name_bind; -') - ####################################### # # corenet_udp_bind_all_ports(domain) # define(`corenet_udp_bind_all_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute port_type; + class udp_socket name_bind; + ') allow $1 port_type:udp_socket name_bind; ') -define(`corenet_udp_bind_all_ports_depend',` - attribute port_type; - - class udp_socket name_bind; -') - ####################################### # # corenet_tcp_sendrecv_reserved_port(domain) # define(`corenet_tcp_sendrecv_reserved_port',` - gen_require(`$0'_depend) + gen_require(` + type reserved_port_t; + class tcp_socket { send_msg recv_msg }; + ') allow $1 reserved_port_t:tcp_socket { send_msg recv_msg }; ') -define(`corenet_tcp_sendrecv_reserved_port_depend',` - type reserved_port_t; - - class tcp_socket { send_msg recv_msg }; -') - ####################################### # # corenet_udp_send_reserved_port(domain) # define(`corenet_udp_send_reserved_port',` - gen_require(`$0'_depend) + gen_require(` + type reserved_port_t; + class udp_socket send_msg; + ') allow $1 reserved_port_t:udp_socket send_msg; ') -define(`corenet_udp_send_reserved_port_depend',` - type reserved_port_t; - - class udp_socket send_msg; -') - ####################################### # # corenet_udp_receive_reserved_port(domain) # define(`corenet_udp_receive_reserved_port',` - gen_require(`$0'_depend) + gen_require(` + type reserved_port_t; + class udp_socket recv_msg; + ') allow $1 reserved_port_t:udp_socket recv_msg; ') -define(`corenet_udp_receive_reserved_port_depend',` - type reserved_port_t; - - class udp_socket recv_msg; -') - ####################################### # # corenet_udp_sendrecv_reserved_port(domain) @@ -712,85 +597,70 @@ define(`corenet_udp_sendrecv_reserved_port',` # corenet_tcp_bind_reserved_port(domain) # define(`corenet_tcp_bind_reserved_port',` - gen_require(`$0'_depend) + gen_require(` + type reserved_port_t; + class tcp_socket name_bind; + class capability net_bind_service; + ') allow $1 reserved_port_t:tcp_socket name_bind; allow $1 self:capability net_bind_service; ') -define(`corenet_tcp_bind_reserved_port_depend',` - type reserved_port_t; - - class tcp_socket name_bind; - class capability net_bind_service; -') - ####################################### # # corenet_udp_bind_reserved_port(domain) # define(`corenet_udp_bind_reserved_port',` - gen_require(`$0'_depend) + gen_require(` + type reserved_port_t; + class udp_socket name_bind; + class capability net_bind_service; + ') allow $1 reserved_port_t:udp_socket name_bind; allow $1 self:capability net_bind_service; ') -define(`corenet_udp_bind_reserved_port_depend',` - type reserved_port_t; - - class udp_socket name_bind; - class capability net_bind_service; -') - ####################################### # # corenet_tcp_sendrecv_all_reserved_ports(domain) # define(`corenet_tcp_sendrecv_all_reserved_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute reserved_port_type; + class tcp_socket { send_msg recv_msg }; + ') allow $1 reserved_port_type:tcp_socket { send_msg recv_msg }; ') -define(`corenet_tcp_sendrecv_all_reserved_ports_depend',` - attribute reserved_port_type; - - class tcp_socket { send_msg recv_msg }; -') - ####################################### # # corenet_udp_send_all_reserved_ports(domain) # define(`corenet_udp_send_all_reserved_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute reserved_port_type; + class udp_socket send_msg; + ') allow $1 reserved_port_type:udp_socket send_msg; ') -define(`corenet_udp_send_all_reserved_ports_depend',` - attribute reserved_port_type; - - class udp_socket send_msg; -') - ####################################### # # corenet_udp_receive_all_reserved_ports(domain) # define(`corenet_udp_receive_all_reserved_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute reserved_port_type; + class udp_socket recv_msg; + ') allow $1 reserved_port_type:udp_socket recv_msg; ') -define(`corenet_udp_receive_all_reserved_ports_depend',` - attribute reserved_port_type; - - class udp_socket recv_msg; -') - ####################################### # # corenet_udp_sendrecv_all_reserved_ports(domain) @@ -805,65 +675,53 @@ define(`corenet_udp_sendrecv_all_reserved_ports',` # corenet_tcp_bind_all_reserved_ports(domain) # define(`corenet_tcp_bind_all_reserved_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute reserved_port_type; + class tcp_socket name_bind; + class capability net_bind_service; + ') allow $1 reserved_port_type:tcp_socket name_bind; allow $1 self:capability net_bind_service; ') -define(`corenet_tcp_bind_all_reserved_ports_depend',` - attribute reserved_port_type; - - class tcp_socket name_bind; - class capability net_bind_service; -') - ####################################### # # corenet_dontaudit_tcp_bind_all_reserved_ports(domain) # define(`corenet_dontaudit_tcp_bind_all_reserved_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute reserved_port_type; + class tcp_socket name_bind; + ') dontaudit $1 reserved_port_type:tcp_socket name_bind; ') -define(`corenet_dontaudit_tcp_bind_all_reserved_ports_depend',` - attribute reserved_port_type; - - class tcp_socket name_bind; -') - ####################################### # # corenet_udp_bind_all_reserved_ports(domain) # define(`corenet_udp_bind_all_reserved_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute reserved_port_type; + class udp_socket name_bind; + class self:capability net_bind_service; + ') allow $1 reserved_port_type:udp_socket name_bind; allow $1 self:capability net_bind_service; ') -define(`corenet_udp_bind_all_reserved_ports_depend',` - attribute reserved_port_type; - - class udp_socket name_bind; - class self:capability net_bind_service; -') - ####################################### # # corenet_dontaudit_udp_bind_all_reserved_ports(domain) # define(`corenet_dontaudit_udp_bind_all_reserved_ports',` - gen_require(`$0'_depend) + gen_require(` + attribute reserved_port_type; + class udp_socket name_bind; + ') dontaudit $1 reserved_port_type:udp_socket name_bind; ') - -define(`corenet_dontaudit_udp_bind_all_reserved_ports_depend',` - attribute reserved_port_type; - - class udp_socket name_bind; -')