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