blob: 6d1c10c095b97b609d23c1beaf8ae36993faf3cc [file] [log] [blame]
Alex Klyubinf5446eb2017-03-23 14:27:32 -07001typeattribute netd coredomain;
Steven Moreland65981752022-02-10 00:32:44 +00002typeattribute netd bpfdomain;
Alex Klyubinf5446eb2017-03-23 14:27:32 -07003
dcashmancc39f632016-07-22 13:13:11 -07004init_daemon_domain(netd)
5
6# Allow netd to spawn dnsmasq in it's own domain
7domain_auto_trans(netd, dnsmasq_exec, dnsmasq)
8
Maciej Żenczykowski37ca69e2023-11-18 03:36:05 +00009allow netd { fs_bpf fs_bpf_netd_readonly fs_bpf_netd_shared fs_bpf_vendor }:dir search;
10allow netd { fs_bpf fs_bpf_netd_readonly fs_bpf_netd_shared fs_bpf_vendor }:file { getattr read };
11allow netd { fs_bpf fs_bpf_netd_shared }:file write;
Maciej Żenczykowskib13921c2022-05-21 05:03:29 -070012
Chenbo Feng7b571042018-12-04 17:57:27 -080013# give netd permission to setup iptables rule with xt_bpf, attach program to cgroup, and read/write
14# the map created by bpfloader
15allow netd bpfloader:bpf { prog_run map_read map_write };
Joel Fernandesb76a6392019-01-11 08:32:45 -050016
Chenbo Feng8a5539b2019-02-27 17:44:26 -080017# in order to invoke side effect of close() on such a socket calling synchronize_rcu()
18# TODO: Remove this permission when 4.9 kernel is deprecated.
Ken Chen1aed0062022-01-28 15:04:09 +080019# TODO: Remove this after we remove all bpf interactions from netd.
Chenbo Feng8a5539b2019-02-27 17:44:26 -080020allow netd self:key_socket create;
21
Inseob Kim55e5c9b2020-03-04 17:20:35 +090022set_prop(netd, ctl_mdnsd_prop)
23set_prop(netd, netd_stable_secret_prop)
24
steven_fannd3e8f6f2021-01-26 13:34:00 +080025get_prop(netd, adbd_config_prop)
Inseob Kim55e5c9b2020-03-04 17:20:35 +090026get_prop(netd, hwservicemanager_prop)
27get_prop(netd, device_config_netd_native_prop)
lifr980c08c2018-11-21 22:53:48 +080028
29# Allow netd to write to statsd.
30unix_socket_send(netd, statsdw, statsd)
Remi NGUYEN VAN780fbad2019-01-28 13:08:42 +090031
32# Allow netd to send callbacks to network_stack
33binder_call(netd, network_stack)
34
Chalard Jeana4c9f7b2019-04-05 17:33:56 +090035# Allow netd to send dump info to dumpstate
36allow netd dumpstate:fd use;
37allow netd dumpstate:fifo_file { getattr write };
Inseob Kim55e5c9b2020-03-04 17:20:35 +090038
39# persist.netd.stable_secret contains RFC 7217 secret key which should never be
40# leaked to other processes. Make sure it never leaks.
41neverallow { domain -netd -init -dumpstate } netd_stable_secret_prop:file r_file_perms;
42
43# We want to ensure that no other process ever tries tampering with persist.netd.stable_secret,
44# the RFC 7217 secret key managed by netd. Doing so could compromise user privacy.
45neverallow { domain -netd -init } netd_stable_secret_prop:property_service set;