blob: f8c9ffbbc7311e22e3df26669fba1444154eec53 [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
Geremy Condra3bb1ccc2013-09-16 14:53:41 -07008allow netd self:capability { net_admin net_raw kill fsetid };
Nick Kralevichdbd28d92013-06-27 15:11:02 -07009allow netd self:netlink_kobject_uevent_socket *;
10allow netd self:netlink_route_socket *;
11allow netd self:netlink_nflog_socket *;
12allow netd self:rawip_socket *;
Nick Kralevichdbd28d92013-06-27 15:11:02 -070013allow netd self:unix_stream_socket *;
14allow netd shell_exec:file rx_file_perms;
15allow netd system_file:file x_file_perms;
16allow netd devpts:chr_file rw_file_perms;
17
18# For /proc/sys/net/ipv[46]/route/flush.
Robert Craig529fcbe2014-01-07 13:46:56 -050019allow netd proc_net:file write;
Nick Kralevichdbd28d92013-06-27 15:11:02 -070020
21# For /sys/modules/bcmdhd/parameters/firmware_path
22# XXX Split into its own type.
23allow netd sysfs:file write;
24
25# Set dhcp lease for PAN connection
26unix_socket_connect(netd, property, init)
27allow netd system_prop:property_service set;
28
29# Connect to PAN
Stephen Smalley9de4c692013-04-04 11:31:00 -040030domain_auto_trans(netd, dhcp_exec, dhcp)
Nick Kralevichdbd28d92013-06-27 15:11:02 -070031allow 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
36allow netd self:capability { dac_override chown fowner };
37allow netd wifi_data_file:file create_file_perms;
38allow netd wifi_data_file:dir rw_dir_perms;
39
40# Allow netd to spawn hostapd in it's own domain
41domain_auto_trans(netd, hostapd_exec, hostapd)
42allow netd hostapd:process signal;
43
44# Allow netd to spawn dnsmasq in it's own domain
45domain_auto_trans(netd, dnsmasq_exec, dnsmasq)
46allow netd dnsmasq:process signal;
47
Lorenzo Colittiab7dfab2013-08-05 15:32:56 +090048# Allow netd to start clatd in its own domain
49domain_auto_trans(netd, clatd_exec, clatd)
50allow netd clatd:process signal;
51
Nick Kralevich4a13f782013-07-10 14:58:27 -070052# Support netd running mdnsd
53# TODO: prune this back further
54allow netd ctl_default_prop:property_service set;
55allow netd device:sock_file write;
Nick Kralevich9a198852013-07-12 21:28:41 -070056
57###
58### Neverallow rules
59###
60### netd should NEVER do any of this
61
62# Block device access.
63neverallow netd dev_type:blk_file { read write };
64
Nick Kralevich9a198852013-07-12 21:28:41 -070065# Setting SELinux enforcing status or booleans.
Nick Kralevich9a198852013-07-12 21:28:41 -070066neverallow netd kernel:security { setenforce setbool };
67
68# Load security policy.
69neverallow netd kernel:security load_policy;
70
71# ptrace any other app
72neverallow netd { domain }:process ptrace;
73
74# Write to /system.
75neverallow netd system_file:dir_file_class_set write;
76
77# Write to files in /data/data or system files on /data
78neverallow netd { app_data_file system_data_file }:dir_file_class_set write;