blob: d4c51531732bda959472115bd652eb2a7b36588c [file] [log] [blame]
Stephen Smalley2dd4e512012-01-04 12:33:27 -05001# network manager
Stephen Smalley45731c72014-09-08 16:06:40 -04002type netd, domain, mlstrustedsubject;
Stephen Smalley2dd4e512012-01-04 12:33:27 -05003type 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
Nick Kralevich8d200812015-04-02 15:36:51 -070014# for netd to operate.
15dontaudit netd self:capability fsetid;
Stephen Smalleyd581b812014-02-24 13:00:59 -050016
Stephen Smalley16011322014-02-24 15:06:11 -050017allow netd self:netlink_kobject_uevent_socket create_socket_perms;
18allow netd self:netlink_route_socket nlmsg_write;
19allow netd self:netlink_nflog_socket create_socket_perms;
Jeff Sharkey33bf0532014-12-16 13:08:16 -080020allow netd self:netlink_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.
Nick Kralevich5cf39942015-02-25 13:28:40 -080026allow 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
William Roberts2f5a6a92015-05-04 18:22:45 -070033set_prop(netd, dhcp_prop)
34set_prop(netd, system_prop)
Stephen Smalleyfee49152014-06-19 10:27:02 -040035auditallow netd system_prop:property_service set;
Nick Kralevichdbd28d92013-06-27 15:11:02 -070036
37# Connect to PAN
Stephen Smalley9de4c692013-04-04 11:31:00 -040038domain_auto_trans(netd, dhcp_exec, dhcp)
Nick Kralevichdbd28d92013-06-27 15:11:02 -070039allow netd dhcp:process signal;
40
41# Needed to update /data/misc/wifi/hostapd.conf
42# TODO: See what we can do to reduce the need for
43# these capabilities
44allow netd self:capability { dac_override chown fowner };
45allow netd wifi_data_file:file create_file_perms;
46allow netd wifi_data_file:dir rw_dir_perms;
47
Sreeram Ramachandran65edb752014-07-07 22:04:57 -070048# Needed to update /data/misc/net/rt_tables
49allow netd net_data_file:file create_file_perms;
50allow netd net_data_file:dir rw_dir_perms;
51
Nick Kralevichdbd28d92013-06-27 15:11:02 -070052# Allow netd to spawn hostapd in it's own domain
53domain_auto_trans(netd, hostapd_exec, hostapd)
54allow netd hostapd:process signal;
55
56# Allow netd to spawn dnsmasq in it's own domain
57domain_auto_trans(netd, dnsmasq_exec, dnsmasq)
58allow netd dnsmasq:process signal;
59
Lorenzo Colittiab7dfab2013-08-05 15:32:56 +090060# Allow netd to start clatd in its own domain
61domain_auto_trans(netd, clatd_exec, clatd)
62allow netd clatd:process signal;
63
William Roberts2f5a6a92015-05-04 18:22:45 -070064set_prop(netd, ctl_mdnsd_prop)
Nick Kralevich9a198852013-07-12 21:28:41 -070065
Sreeram Ramachandran56ecf4b2014-05-01 11:12:10 -070066# Allow netd to operate on sockets that are passed to it.
67allow netd netdomain:{tcp_socket udp_socket rawip_socket dccp_socket tun_socket} {read write getattr setattr getopt setopt};
68allow netd netdomain:fd use;
69
Nick Kralevich9a198852013-07-12 21:28:41 -070070###
71### Neverallow rules
72###
73### netd should NEVER do any of this
74
75# Block device access.
76neverallow netd dev_type:blk_file { read write };
77
Nick Kralevich9a198852013-07-12 21:28:41 -070078# ptrace any other app
79neverallow netd { domain }:process ptrace;
80
81# Write to /system.
82neverallow netd system_file:dir_file_class_set write;
83
84# Write to files in /data/data or system files on /data
85neverallow netd { app_data_file system_data_file }:dir_file_class_set write;