blob: cdc342db9ccb470f857da4b4feaeec53fd7526c5 [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 };
Jeff Vander Stoep7a4af302018-04-10 12:47:48 -07009allow netutils_wrapper proc_net_type:file { open read getattr };
Sandeep Patilc6d89022017-04-14 19:06:56 -070010allow 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
Luke Huang554b3342019-03-19 15:07:00 +080018allow netutils_wrapper netd_service:service_manager find;
19allow netutils_wrapper dnsresolver_service:service_manager find;
paulhu70b0a772021-12-09 11:49:23 +080020allow netutils_wrapper mdns_service:service_manager find;
Luke Huang554b3342019-03-19 15:07:00 +080021binder_use(netutils_wrapper);
22binder_call(netutils_wrapper, netd);
Sandeep Patilc6d89022017-04-14 19:06:56 -070023
Chenbo Feng2623ebc2018-03-28 16:51:26 -070024# For vendor code that update the iptables rules at runtime. They need to reload
25# the whole chain including the xt_bpf rules. They need to access to the pinned
26# program when reloading the rule.
27allow netutils_wrapper fs_bpf:dir search;
28allow netutils_wrapper fs_bpf:file { read write };
29allow netutils_wrapper bpfloader:bpf prog_run;
30
Sandeep Patilc6d89022017-04-14 19:06:56 -070031# For /data/misc/net access to ndc and ip
32r_dir_file(netutils_wrapper, net_data_file)
33
34domain_auto_trans({
35 domain
36 -coredomain
37 -appdomain
38}, netutils_wrapper_exec, netutils_wrapper)
Jeff Vander Stoepf7a7f7d2018-04-11 10:46:30 -070039
40# suppress spurious denials
41dontaudit netutils_wrapper self:global_capability_class_set sys_resource;
Jeff Vander Stoepc510da92019-03-29 14:29:42 -070042dontaudit netutils_wrapper sysfs_type:file read;
Jeff Vander Stoepf7a7f7d2018-04-11 10:46:30 -070043
44# netutils wrapper may only use the following capabilities.
45neverallow netutils_wrapper self:global_capability_class_set ~{ net_admin net_raw };