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