blob: 11139761c762c558e59e29b803a522dcc91c9f7b [file] [log] [blame]
Ricardo Cerqueirab3dce3f2014-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)
Ricardo Cerqueira51ecbf72014-12-16 19:27:32 +00009
10 type_transition sudaemon socket_device:sock_file superuser_device;
Ricardo Cerqueirab3dce3f2014-11-26 21:34:15 +000011 # 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 typealias shell alias suclient;
50
Lars Greiss68266e62014-12-10 20:45:38 +010051 # Translate user apps to the shell domain when using su
Ricardo Cerqueirab3dce3f2014-11-26 21:34:15 +000052 domain_auto_trans(untrusted_app, su_exec, suclient)
53
54 allow suclient sudaemon:unix_stream_socket { connectto read write setopt ioctl };
55
56 allow suclient superuser_device:dir { create rw_dir_perms setattr unlink };
57 allow suclient superuser_device:sock_file { create setattr unlink write };
58 allow suclient untrusted_app_devpts:chr_file { read write ioctl };
Chirayu Desai97b2e182014-11-27 21:00:01 +053059 # For Settings control of access
Ricardo Cerqueirab3dce3f2014-11-26 21:34:15 +000060 allow system_app superuser_device:sock_file { read write create setattr unlink getattr };
61 allow system_app sudaemon:unix_stream_socket { connectto read write setopt ioctl };
62 allow system_app superuser_device:dir { create rw_dir_perms setattr unlink };
Ricardo Cerqueirab3dce3f2014-11-26 21:34:15 +000063')