1type runas, domain, mlstrustedsubject; 2type runas_exec, exec_type, file_type; 3 4allow runas adbd:process sigchld; 5allow runas adbd:unix_stream_socket { read write }; 6allow runas shell:fd use; 7allow runas shell:fifo_file { read write }; 8allow runas shell:unix_stream_socket { read write }; 9allow runas devpts:chr_file { read write ioctl }; 10allow runas shell_data_file:file { read write }; 11 12# run-as reads package information. 13allow runas system_data_file:file r_file_perms; 14 15# run-as checks and changes to the app data dir. 16dontaudit runas self:capability dac_override; 17allow runas app_data_file:dir { getattr search }; 18 19# run-as switches to the app UID/GID. 20allow runas self:capability { setuid setgid }; 21 22# run-as switches to the app security context. 23selinux_check_context(runas) # validate context 24allow runas self:process setcurrent; 25allow runas non_system_app_set:process dyntransition; # setcon 26 27# runas/libselinux needs access to seapp_contexts_file to 28# determine which domain to transition to. 29allow runas seapp_contexts_file:file r_file_perms; 30 31### 32### neverallow rules 33### 34 35# run-as cannot have capabilities other than CAP_SETUID and CAP_SETGID 36neverallow runas self:capability ~{ setuid setgid }; 37neverallow runas self:capability2 *; 38