blob: ea58814e1a353444ca8311c01feae94260f1abc5 [file] [log] [blame]
Sandeep Patilc6d89022017-04-14 19:06:56 -07001typeattribute netutils_wrapper coredomain;
2
3r_dir_file(netutils_wrapper, system_file);
4
5# For netutils (ip, iptables, tc)
Benjamin Gordon9b2e0cb2017-11-09 15:51:26 -07006allow netutils_wrapper self:global_capability_class_set net_raw;
Sandeep Patilc6d89022017-04-14 19:06:56 -07007
8allow netutils_wrapper system_file:file { execute execute_no_trans };
9allow netutils_wrapper proc_net:file { open read getattr };
10allow netutils_wrapper self:rawip_socket create_socket_perms;
11allow netutils_wrapper self:udp_socket create_socket_perms;
Benjamin Gordon9b2e0cb2017-11-09 15:51:26 -070012allow netutils_wrapper self:global_capability_class_set net_admin;
Sandeep Patilc6d89022017-04-14 19:06:56 -070013# ip utils need everything but ioctl
14allow netutils_wrapper self:netlink_route_socket ~ioctl;
15allow netutils_wrapper self:netlink_xfrm_socket ~ioctl;
16
17# For netutils (ndc) to be able to talk to netd
18allow netutils_wrapper netd_socket:sock_file { open getattr read write append };
19allow netutils_wrapper netd:unix_stream_socket { read getattr connectto };
20
Chenbo Feng2623ebc2018-03-28 16:51:26 -070021# For vendor code that update the iptables rules at runtime. They need to reload
22# the whole chain including the xt_bpf rules. They need to access to the pinned
23# program when reloading the rule.
24allow netutils_wrapper fs_bpf:dir search;
25allow netutils_wrapper fs_bpf:file { read write };
26allow netutils_wrapper bpfloader:bpf prog_run;
27
Sandeep Patilc6d89022017-04-14 19:06:56 -070028# For /data/misc/net access to ndc and ip
29r_dir_file(netutils_wrapper, net_data_file)
30
31domain_auto_trans({
32 domain
33 -coredomain
34 -appdomain
35}, netutils_wrapper_exec, netutils_wrapper)
Jeff Vander Stoepf7a7f7d2018-04-11 10:46:30 -070036
37# suppress spurious denials
38dontaudit netutils_wrapper self:global_capability_class_set sys_resource;
39
40# netutils wrapper may only use the following capabilities.
41neverallow netutils_wrapper self:global_capability_class_set ~{ net_admin net_raw };