blob: c2c68fd849ddf1235c4bc86acaf8f0b6828e0600 [file] [log] [blame]
Dirk Vogt0db35282016-01-18 14:40:09 +01001type 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
10 type_transition sudaemon socket_device:sock_file superuser_device;
11 # The userspace app uses /dev sockets to control per-app access
12 allow sudaemon superuser_device:dir { create rw_dir_perms setattr unlink };
13 allow sudaemon superuser_device:sock_file { create setattr unlink write };
14
15 # sudaemon is also permissive to permit setenforce.
16 permissive sudaemon;
17
18 # Add sudaemon to various domains
19 net_domain(sudaemon)
20 app_domain(sudaemon)
21
22 dontaudit sudaemon self:capability_class_set *;
23 dontaudit sudaemon kernel:security *;
24 dontaudit sudaemon kernel:system *;
25 dontaudit sudaemon self:memprotect *;
26 dontaudit sudaemon domain:process *;
27 dontaudit sudaemon domain:fd *;
28 dontaudit sudaemon domain:dir *;
29 dontaudit sudaemon domain:lnk_file *;
30 dontaudit sudaemon domain:{ fifo_file file } *;
31 dontaudit sudaemon domain:socket_class_set *;
32 dontaudit sudaemon domain:ipc_class_set *;
33 dontaudit sudaemon domain:key *;
34 dontaudit sudaemon fs_type:filesystem *;
35 dontaudit sudaemon {fs_type dev_type file_type}:dir_file_class_set *;
36 dontaudit sudaemon node_type:node *;
37 dontaudit sudaemon node_type:{ tcp_socket udp_socket rawip_socket } *;
38 dontaudit sudaemon netif_type:netif *;
39 dontaudit sudaemon port_type:socket_class_set *;
40 dontaudit sudaemon port_type:{ tcp_socket dccp_socket } *;
41 dontaudit sudaemon domain:peer *;
42 dontaudit sudaemon domain:binder *;
43 dontaudit sudaemon property_type:property_service *;
44')
45
46## Perms for the app
47
48userdebug_or_eng(`
49 # Translate user apps to the shell domain when using su
50 #
51 # PR_SET_NO_NEW_PRIVS blocks this :(
52 # we need to find a way to narrow this down to the actual exec.
53 # typealias shell alias suclient;
54 # domain_auto_trans(untrusted_app, su_exec, suclient)
55
56 allow untrusted_app su_exec:file { execute_no_trans getattr open read execute };
57 allow untrusted_app sudaemon:unix_stream_socket { connectto read write setopt ioctl };
58 allow untrusted_app superuser_device:dir { r_dir_perms };
59 allow untrusted_app superuser_device:sock_file { write };
60
61
62 # For Settings control of access
63 allow system_app superuser_device:sock_file { read write create setattr unlink getattr };
64 allow system_app sudaemon:unix_stream_socket { connectto read write setopt ioctl };
65 allow system_app superuser_device:dir { create rw_dir_perms setattr unlink };
66')