blob: 045de39365ca4480c647a893e26ebca1a6ecf5aa [file] [log] [blame]
Ricardo Cerqueira09159ac2014-11-26 21:34:15 +00001type superuser_device, file_type;
2
3## Perms for the daemon
4
5type sudaemon, domain;
6
7userdebug_or_eng(`
8 domain_trans(init, su_exec, sudaemon)
9 # The userspace app uses /dev sockets to control per-app access
10 allow sudaemon superuser_device:dir { create rw_dir_perms setattr unlink };
11 allow sudaemon superuser_device:sock_file { create setattr unlink write };
12
13 # sudaemon is also permissive to permit setenforce.
14 permissive sudaemon;
15
16 # Add sudaemon to various domains
17 net_domain(sudaemon)
18 app_domain(sudaemon)
19
20 dontaudit sudaemon self:capability_class_set *;
21 dontaudit sudaemon kernel:security *;
22 dontaudit sudaemon kernel:system *;
23 dontaudit sudaemon self:memprotect *;
24 dontaudit sudaemon domain:process *;
25 dontaudit sudaemon domain:fd *;
26 dontaudit sudaemon domain:dir *;
27 dontaudit sudaemon domain:lnk_file *;
28 dontaudit sudaemon domain:{ fifo_file file } *;
29 dontaudit sudaemon domain:socket_class_set *;
30 dontaudit sudaemon domain:ipc_class_set *;
31 dontaudit sudaemon domain:key *;
32 dontaudit sudaemon fs_type:filesystem *;
33 dontaudit sudaemon {fs_type dev_type file_type}:dir_file_class_set *;
34 dontaudit sudaemon node_type:node *;
35 dontaudit sudaemon node_type:{ tcp_socket udp_socket rawip_socket } *;
36 dontaudit sudaemon netif_type:netif *;
37 dontaudit sudaemon port_type:socket_class_set *;
38 dontaudit sudaemon port_type:{ tcp_socket dccp_socket } *;
39 dontaudit sudaemon domain:peer *;
40 dontaudit sudaemon domain:binder *;
41 dontaudit sudaemon property_type:property_service *;
42')
43
44## Perms for the app
45
46userdebug_or_eng(`
47 typealias shell alias suclient;
48
49 # Translate user apps to the shell domain when using su
50 domain_auto_trans(untrusted_app, su_exec, suclient)
51
52 allow suclient sudaemon:unix_stream_socket { connectto read write setopt ioctl };
53
54 allow suclient superuser_device:dir { create rw_dir_perms setattr unlink };
55 allow suclient superuser_device:sock_file { create setattr unlink write };
56 allow suclient untrusted_app_devpts:chr_file { read write ioctl };
57 # For Settings' control of access
58 allow system_app superuser_device:sock_file { read write create setattr unlink getattr };
59 allow system_app sudaemon:unix_stream_socket { connectto read write setopt ioctl };
60 allow system_app superuser_device:dir { create rw_dir_perms setattr unlink };
61')