2019-01-12 00:24:35 +01:00
|
|
|
## Network types
|
2012-01-04 18:33:27 +01:00
|
|
|
type node, node_type;
|
|
|
|
type netif, netif_type;
|
|
|
|
type port, port_type;
|
2019-01-12 00:24:35 +01:00
|
|
|
|
|
|
|
###
|
|
|
|
### Domain with network access
|
|
|
|
###
|
|
|
|
|
|
|
|
# Use network sockets.
|
|
|
|
allow netdomain self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow netdomain self:{ icmp_socket udp_socket rawip_socket } create_socket_perms;
|
|
|
|
|
|
|
|
# Connect to ports.
|
|
|
|
allow netdomain port_type:tcp_socket name_connect;
|
|
|
|
# Bind to ports.
|
2019-01-12 00:50:21 +01:00
|
|
|
allow {netdomain -ephemeral_app} node_type:{ icmp_socket rawip_socket tcp_socket udp_socket } node_bind;
|
2019-01-12 00:24:35 +01:00
|
|
|
allow {netdomain -ephemeral_app} port_type:udp_socket name_bind;
|
|
|
|
allow {netdomain -ephemeral_app} port_type:tcp_socket name_bind;
|
|
|
|
# See changes to the routing table.
|
2020-01-28 10:42:41 +01:00
|
|
|
allow netdomain self:netlink_route_socket { create read getattr write setattr lock append connect getopt setopt shutdown nlmsg_read };
|
2020-01-20 10:14:48 +01:00
|
|
|
# b/141455849 gate RTM_GETLINK with a new permission nlmsg_readpriv and block access from
|
|
|
|
# untrusted_apps. Some untrusted apps (e.g. untrusted_app_25-29) are granted access elsewhere
|
|
|
|
# to avoid app-compat breakage.
|
|
|
|
allow {
|
|
|
|
netdomain
|
|
|
|
-ephemeral_app
|
|
|
|
-mediaprovider
|
|
|
|
-untrusted_app_all
|
2020-01-28 10:42:41 +01:00
|
|
|
} self:netlink_route_socket { bind nlmsg_readpriv };
|
2019-01-12 00:24:35 +01:00
|
|
|
|
|
|
|
# Talks to netd via dnsproxyd socket.
|
|
|
|
unix_socket_connect(netdomain, dnsproxyd, netd)
|
|
|
|
|
|
|
|
# Talks to netd via fwmarkd socket.
|
|
|
|
unix_socket_connect(netdomain, fwmarkd, netd)
|
|
|
|
|
|
|
|
# Connect to mdnsd via mdnsd socket.
|
|
|
|
unix_socket_connect(netdomain, mdnsd, mdnsd)
|