Stephen Smalley | 2dd4e51 | 2012-01-04 12:33:27 -0500 | [diff] [blame] | 1 | # network manager |
| 2 | type netd, domain; |
| 3 | type netd_exec, exec_type, file_type; |
| 4 | |
| 5 | init_daemon_domain(netd) |
Nick Kralevich | bc19050 | 2013-12-15 19:04:09 -0800 | [diff] [blame] | 6 | net_domain(netd) |
| 7 | |
Stephen Smalley | d581b81 | 2014-02-24 13:00:59 -0500 | [diff] [blame] | 8 | allow 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 Smalley | 1601132 | 2014-02-24 15:06:11 -0500 | [diff] [blame] | 18 | allow netd self:netlink_kobject_uevent_socket create_socket_perms; |
| 19 | allow netd self:netlink_route_socket nlmsg_write; |
| 20 | allow netd self:netlink_nflog_socket create_socket_perms; |
Nick Kralevich | dbd28d9 | 2013-06-27 15:11:02 -0700 | [diff] [blame] | 21 | allow netd shell_exec:file rx_file_perms; |
| 22 | allow netd system_file:file x_file_perms; |
| 23 | allow netd devpts:chr_file rw_file_perms; |
| 24 | |
| 25 | # For /proc/sys/net/ipv[46]/route/flush. |
Robert Craig | 529fcbe | 2014-01-07 13:46:56 -0500 | [diff] [blame] | 26 | allow netd proc_net:file write; |
Nick Kralevich | dbd28d9 | 2013-06-27 15:11:02 -0700 | [diff] [blame] | 27 | |
| 28 | # For /sys/modules/bcmdhd/parameters/firmware_path |
| 29 | # XXX Split into its own type. |
| 30 | allow netd sysfs:file write; |
| 31 | |
| 32 | # Set dhcp lease for PAN connection |
| 33 | unix_socket_connect(netd, property, init) |
| 34 | allow netd system_prop:property_service set; |
| 35 | |
| 36 | # Connect to PAN |
Stephen Smalley | 9de4c69 | 2013-04-04 11:31:00 -0400 | [diff] [blame] | 37 | domain_auto_trans(netd, dhcp_exec, dhcp) |
Nick Kralevich | dbd28d9 | 2013-06-27 15:11:02 -0700 | [diff] [blame] | 38 | allow netd dhcp:process signal; |
| 39 | |
| 40 | # Needed to update /data/misc/wifi/hostapd.conf |
| 41 | # TODO: See what we can do to reduce the need for |
| 42 | # these capabilities |
| 43 | allow netd self:capability { dac_override chown fowner }; |
| 44 | allow netd wifi_data_file:file create_file_perms; |
| 45 | allow netd wifi_data_file:dir rw_dir_perms; |
| 46 | |
| 47 | # Allow netd to spawn hostapd in it's own domain |
| 48 | domain_auto_trans(netd, hostapd_exec, hostapd) |
| 49 | allow netd hostapd:process signal; |
| 50 | |
| 51 | # Allow netd to spawn dnsmasq in it's own domain |
| 52 | domain_auto_trans(netd, dnsmasq_exec, dnsmasq) |
| 53 | allow netd dnsmasq:process signal; |
| 54 | |
Lorenzo Colitti | ab7dfab | 2013-08-05 15:32:56 +0900 | [diff] [blame] | 55 | # Allow netd to start clatd in its own domain |
| 56 | domain_auto_trans(netd, clatd_exec, clatd) |
| 57 | allow netd clatd:process signal; |
| 58 | |
Robert Craig | 4b3893f | 2014-02-18 13:24:26 -0500 | [diff] [blame] | 59 | allow netd ctl_mdnsd_prop:property_service set; |
Nick Kralevich | 9a19885 | 2013-07-12 21:28:41 -0700 | [diff] [blame] | 60 | |
| 61 | ### |
| 62 | ### Neverallow rules |
| 63 | ### |
| 64 | ### netd should NEVER do any of this |
| 65 | |
| 66 | # Block device access. |
| 67 | neverallow netd dev_type:blk_file { read write }; |
| 68 | |
Nick Kralevich | 9a19885 | 2013-07-12 21:28:41 -0700 | [diff] [blame] | 69 | # ptrace any other app |
| 70 | neverallow netd { domain }:process ptrace; |
| 71 | |
| 72 | # Write to /system. |
| 73 | neverallow netd system_file:dir_file_class_set write; |
| 74 | |
| 75 | # Write to files in /data/data or system files on /data |
| 76 | neverallow netd { app_data_file system_data_file }:dir_file_class_set write; |