netd.te 2.76 KB
Newer Older
Stephen Smalley's avatar
Stephen Smalley committed
1
# network manager
2
type netd, domain, mlstrustedsubject;
Stephen Smalley's avatar
Stephen Smalley committed
3 4 5
type netd_exec, exec_type, file_type;

init_daemon_domain(netd)
Nick Kralevich's avatar
Nick Kralevich committed
6 7
net_domain(netd)

Stephen Smalley's avatar
Stephen Smalley committed
8 9 10 11 12 13
allow netd self:capability { net_admin net_raw kill };
# Note: fsetid is deliberately not included above. fsetid checks are
# triggered by chmod on a directory or file owned by a group other
# than one of the groups assigned to the current process to see if
# the setgid bit should be cleared, regardless of whether the setgid
# bit was even set.  We do not appear to truly need this capability
Nick Kralevich's avatar
Nick Kralevich committed
14 15
# for netd to operate.
dontaudit netd self:capability fsetid;
Stephen Smalley's avatar
Stephen Smalley committed
16

Stephen Smalley's avatar
Stephen Smalley committed
17 18 19
allow netd self:netlink_kobject_uevent_socket create_socket_perms;
allow netd self:netlink_route_socket nlmsg_write;
allow netd self:netlink_nflog_socket create_socket_perms;
20
allow netd self:netlink_socket create_socket_perms;
21 22 23 24 25
allow netd shell_exec:file rx_file_perms;
allow netd system_file:file x_file_perms;
allow netd devpts:chr_file rw_file_perms;

# For /proc/sys/net/ipv[46]/route/flush.
26
allow netd proc_net:file write;
27 28 29 30 31 32

# For /sys/modules/bcmdhd/parameters/firmware_path
# XXX Split into its own type.
allow netd sysfs:file write;

# Set dhcp lease for PAN connection
33 34
set_prop(netd, dhcp_prop)
set_prop(netd, system_prop)
35
auditallow netd system_prop:property_service set;
36 37

# Connect to PAN
38
domain_auto_trans(netd, dhcp_exec, dhcp)
39 40 41 42 43 44 45 46 47
allow netd dhcp:process signal;

# Needed to update /data/misc/wifi/hostapd.conf
# TODO: See what we can do to reduce the need for
# these capabilities
allow netd self:capability { dac_override chown fowner };
allow netd wifi_data_file:file create_file_perms;
allow netd wifi_data_file:dir rw_dir_perms;

48 49 50 51
# Needed to update /data/misc/net/rt_tables
allow netd net_data_file:file create_file_perms;
allow netd net_data_file:dir rw_dir_perms;

52 53 54 55 56 57 58 59
# Allow netd to spawn hostapd in it's own domain
domain_auto_trans(netd, hostapd_exec, hostapd)
allow netd hostapd:process signal;

# Allow netd to spawn dnsmasq in it's own domain
domain_auto_trans(netd, dnsmasq_exec, dnsmasq)
allow netd dnsmasq:process signal;

60 61 62 63
# Allow netd to start clatd in its own domain
domain_auto_trans(netd, clatd_exec, clatd)
allow netd clatd:process signal;

64
set_prop(netd, ctl_mdnsd_prop)
65

66 67 68 69
# Allow netd to operate on sockets that are passed to it.
allow netd netdomain:{tcp_socket udp_socket rawip_socket dccp_socket tun_socket} {read write getattr setattr getopt setopt};
allow netd netdomain:fd use;

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
###
### Neverallow rules
###
### netd should NEVER do any of this

# Block device access.
neverallow netd dev_type:blk_file { read write };

# ptrace any other app
neverallow netd { domain }:process ptrace;

# Write to /system.
neverallow netd system_file:dir_file_class_set write;

# Write to files in /data/data or system files on /data
neverallow netd { app_data_file system_data_file }:dir_file_class_set write;