blob: b27628c315cf91b74f5ce66a55d40fae232fa47b [file] [log] [blame]
Stephen Smalley2dd4e512012-01-04 12:33:27 -05001# network manager
2type netd, domain;
3type netd_exec, exec_type, file_type;
4
5init_daemon_domain(netd)
Nick Kralevichbc190502013-12-15 19:04:09 -08006net_domain(netd)
7
Stephen Smalleyd581b812014-02-24 13:00:59 -05008allow netd self:capability { net_admin net_raw kill };
9# Note: fsetid is deliberately not included above. fsetid checks are
10# triggered by chmod on a directory or file owned by a group other
11# than one of the groups assigned to the current process to see if
12# the setgid bit should be cleared, regardless of whether the setgid
13# bit was even set. We do not appear to truly need this capability
14# for netd to operate. Uncomment the dontaudit rule below after
15# sufficient testing of the fsetid removal.
16# dontaudit netd self:capability fsetid;
17
Stephen Smalley16011322014-02-24 15:06:11 -050018allow netd self:netlink_kobject_uevent_socket create_socket_perms;
19allow netd self:netlink_route_socket nlmsg_write;
20allow netd self:netlink_nflog_socket create_socket_perms;
Nick Kralevichdbd28d92013-06-27 15:11:02 -070021allow netd shell_exec:file rx_file_perms;
22allow netd system_file:file x_file_perms;
23allow netd devpts:chr_file rw_file_perms;
24
25# For /proc/sys/net/ipv[46]/route/flush.
Robert Craig529fcbe2014-01-07 13:46:56 -050026allow netd proc_net:file write;
Nick Kralevichdbd28d92013-06-27 15:11:02 -070027
28# For /sys/modules/bcmdhd/parameters/firmware_path
29# XXX Split into its own type.
30allow netd sysfs:file write;
31
32# Set dhcp lease for PAN connection
33unix_socket_connect(netd, property, init)
Stephen Smalleyfee49152014-06-19 10:27:02 -040034allow netd dhcp_prop:property_service set;
Nick Kralevichdbd28d92013-06-27 15:11:02 -070035allow netd system_prop:property_service set;
Stephen Smalleyfee49152014-06-19 10:27:02 -040036auditallow netd system_prop:property_service set;
Nick Kralevichdbd28d92013-06-27 15:11:02 -070037
38# Connect to PAN
Stephen Smalley9de4c692013-04-04 11:31:00 -040039domain_auto_trans(netd, dhcp_exec, dhcp)
Nick Kralevichdbd28d92013-06-27 15:11:02 -070040allow netd dhcp:process signal;
41
42# Needed to update /data/misc/wifi/hostapd.conf
43# TODO: See what we can do to reduce the need for
44# these capabilities
45allow netd self:capability { dac_override chown fowner };
46allow netd wifi_data_file:file create_file_perms;
Paul Zhang67d9cba2014-09-16 10:53:38 +080047allow netd wifi_data_file:dir create_dir_perms;
48allow netd wifi_data_file:sock_file { create setattr unlink write };
49
50# Allow netd to chmod dir /data/misc/dhcp
51allow netd dhcp_data_file:dir create_dir_perms;
Nick Kralevichdbd28d92013-06-27 15:11:02 -070052
Sreeram Ramachandran65edb752014-07-07 22:04:57 -070053# Needed to update /data/misc/net/rt_tables
54allow netd net_data_file:file create_file_perms;
55allow netd net_data_file:dir rw_dir_perms;
56
Nick Kralevichdbd28d92013-06-27 15:11:02 -070057# Allow netd to spawn hostapd in it's own domain
58domain_auto_trans(netd, hostapd_exec, hostapd)
59allow netd hostapd:process signal;
60
61# Allow netd to spawn dnsmasq in it's own domain
62domain_auto_trans(netd, dnsmasq_exec, dnsmasq)
63allow netd dnsmasq:process signal;
64
Lorenzo Colittiab7dfab2013-08-05 15:32:56 +090065# Allow netd to start clatd in its own domain
66domain_auto_trans(netd, clatd_exec, clatd)
67allow netd clatd:process signal;
68
Robert Craig4b3893f2014-02-18 13:24:26 -050069allow netd ctl_mdnsd_prop:property_service set;
Nick Kralevich9a198852013-07-12 21:28:41 -070070
Sreeram Ramachandran56ecf4b2014-05-01 11:12:10 -070071# Allow netd to operate on sockets that are passed to it.
72allow netd netdomain:{tcp_socket udp_socket rawip_socket dccp_socket tun_socket} {read write getattr setattr getopt setopt};
73allow netd netdomain:fd use;
74
Nick Kralevich9a198852013-07-12 21:28:41 -070075###
76### Neverallow rules
77###
78### netd should NEVER do any of this
79
80# Block device access.
81neverallow netd dev_type:blk_file { read write };
82
Nick Kralevich9a198852013-07-12 21:28:41 -070083# ptrace any other app
84neverallow netd { domain }:process ptrace;
85
86# Write to /system.
87neverallow netd system_file:dir_file_class_set write;
88
89# Write to files in /data/data or system files on /data
90neverallow netd { app_data_file system_data_file }:dir_file_class_set write;