| 1 |
policy_module(ipsecspd-full-perm, 1.0.0) |
| 2 |
|
| 3 |
require { |
| 4 |
role unconfined_r; |
| 5 |
|
| 6 |
type bin_t; |
| 7 |
type ifconfig_t; |
| 8 |
type ipsec_mgmt_t; |
| 9 |
type ipsec_spd_t; |
| 10 |
type ipsec_t; |
| 11 |
type iptables_t; |
| 12 |
type netlabel_peer_t; |
| 13 |
type ping_t; |
| 14 |
type sshd_t; |
| 15 |
type unconfined_service_t; |
| 16 |
type unconfined_t; |
| 17 |
type unlabeled_t; |
| 18 |
|
| 19 |
class association { polmatch sendto setcontext }; |
| 20 |
class capability { net_raw }; |
| 21 |
class chr_file { append getattr ioctl lock read write }; |
| 22 |
class dir { getattr ioctl lock open read search }; |
| 23 |
class file { entrypoint execute getattr ioctl lock map open read }; |
| 24 |
class lnk_file { getattr read }; |
| 25 |
class netif { egress ingress tcp_recv tcp_send udp_recv udp_send }; |
| 26 |
class node { recvfrom tcp_recv tcp_send udp_recv udp_send sendto }; |
| 27 |
class process { noatsecure rlimitinh siginh }; |
| 28 |
class tcp_socket { create_stream_socket_perms name_connect node_bind recv_msg send_msg }; |
| 29 |
class udp_socket { create_socket_perms recv_msg send_msg }; |
| 30 |
} |
| 31 |
|
| 32 |
#============= BEGIN nping_t ============== |
| 33 |
|
| 34 |
type nping_t; |
| 35 |
|
| 36 |
role unconfined_r types nping_t; |
| 37 |
|
| 38 |
domain_type(nping_t) |
| 39 |
domain_entry_file(nping_t, bin_t) |
| 40 |
|
| 41 |
sysnet_read_config(nping_t) |
| 42 |
|
| 43 |
userdom_use_inherited_user_ptys(nping_t) |
| 44 |
|
| 45 |
allow nping_t self:capability net_raw; |
| 46 |
|
| 47 |
# Allow UDP network traffic on all generic interfaces for `nping_t`. |
| 48 |
allow nping_t self:udp_socket create_socket_perms; |
| 49 |
corenet_udp_sendrecv_generic_if(nping_t) |
| 50 |
corenet_udp_sendrecv_generic_node(nping_t) |
| 51 |
corenet_udp_sendrecv_all_ports(nping_t) |
| 52 |
|
| 53 |
# Allow TCP network traffic on all generic interfaces for `nping_t`. |
| 54 |
allow nping_t self:tcp_socket create_stream_socket_perms; |
| 55 |
corenet_tcp_sendrecv_generic_if(nping_t) |
| 56 |
corenet_tcp_sendrecv_generic_node(nping_t) |
| 57 |
corenet_tcp_sendrecv_all_ports(nping_t) |
| 58 |
corenet_tcp_connect_all_ports(nping_t) |
| 59 |
corenet_tcp_bind_generic_node(nping_t) |
| 60 |
|
| 61 |
#============= END nping_t ============== |
| 62 |
|
| 63 |
#============= unconfined_service_t ============== |
| 64 |
# Required when running `pluto` under `rr`. |
| 65 |
allow unconfined_service_t unconfined_t:association setcontext; |
| 66 |
allow unconfined_service_t ping_t:association setcontext; |
| 67 |
allow unconfined_service_t ipsec_t:association setcontext; |
| 68 |
allow unconfined_service_t netlabel_peer_t:association setcontext; |
| 69 |
allow unconfined_service_t nping_t:association setcontext; |
| 70 |
allow unconfined_service_t sshd_t:association setcontext; |
| 71 |
|
| 72 |
#============= netlabel_peer_t ============== |
| 73 |
# Required when using NAT at the IPsec gateway with Netlabel fallback |
| 74 |
# labeling enabled for the WAN facing network interface. |
| 75 |
corenet_out_generic_node(netlabel_peer_t) |
| 76 |
allow netlabel_peer_t ipsec_spd_t:association polmatch; |
| 77 |
allow netlabel_peer_t self:association sendto; |
| 78 |
|
| 79 |
#============= ipsec_t ============== |
| 80 |
allow ipsec_t ipsec_mgmt_t:process { noatsecure rlimitinh siginh }; |
| 81 |
allow ipsec_t unconfined_t:association setcontext; |
| 82 |
allow ipsec_t ping_t:association setcontext; |
| 83 |
allow ipsec_t ipsec_t:association setcontext; |
| 84 |
allow ipsec_t netlabel_peer_t:association setcontext; |
| 85 |
allow ipsec_t nping_t:association setcontext; |
| 86 |
allow ipsec_t sshd_t:association setcontext; |
| 87 |
ipsec_setcontext_default_spd(ipsec_t) |
| 88 |
|
| 89 |
#============= ipsec_mgmt_t ============== |
| 90 |
allow ipsec_mgmt_t ifconfig_t:process { noatsecure rlimitinh siginh }; |
| 91 |
allow ipsec_mgmt_t ipsec_t:process { noatsecure siginh }; |
| 92 |
allow ipsec_mgmt_t iptables_t:process { noatsecure rlimitinh siginh }; |
| 93 |
|
| 94 |
#============= unlabeled_t ============== |
| 95 |
corenet_out_generic_if(unlabeled_t) |
| 96 |
corenet_out_generic_node(unlabeled_t) |