xref: /aosp_15_r20/system/sepolicy/private/aconfigd.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Worker# aconfigd -- manager for aconfig flags
2*e4a36f41SAndroid Build Coastguard Workertype aconfigd, domain, coredomain, mlstrustedsubject;
3*e4a36f41SAndroid Build Coastguard Workertype aconfigd_exec, exec_type, file_type, system_file_type;
4*e4a36f41SAndroid Build Coastguard Worker
5*e4a36f41SAndroid Build Coastguard Workerinit_daemon_domain(aconfigd)
6*e4a36f41SAndroid Build Coastguard Worker
7*e4a36f41SAndroid Build Coastguard Workerallow aconfigd metadata_file:dir search;
8*e4a36f41SAndroid Build Coastguard Worker
9*e4a36f41SAndroid Build Coastguard Workerallow aconfigd {
10*e4a36f41SAndroid Build Coastguard Worker    aconfig_storage_metadata_file
11*e4a36f41SAndroid Build Coastguard Worker    aconfig_storage_flags_metadata_file
12*e4a36f41SAndroid Build Coastguard Worker}:dir create_dir_perms;
13*e4a36f41SAndroid Build Coastguard Worker
14*e4a36f41SAndroid Build Coastguard Workerallow aconfigd {
15*e4a36f41SAndroid Build Coastguard Worker    aconfig_storage_metadata_file
16*e4a36f41SAndroid Build Coastguard Worker    aconfig_storage_flags_metadata_file
17*e4a36f41SAndroid Build Coastguard Worker}:file create_file_perms;
18*e4a36f41SAndroid Build Coastguard Worker
19*e4a36f41SAndroid Build Coastguard Worker# allow aconfigd to log to the kernel dmesg via a file descriptor
20*e4a36f41SAndroid Build Coastguard Worker# passed from init to aconfigd
21*e4a36f41SAndroid Build Coastguard Workerallow aconfigd kmsg_device:chr_file write;
22*e4a36f41SAndroid Build Coastguard Worker
23*e4a36f41SAndroid Build Coastguard Worker# allow aconfigd to read vendor partition storage files
24*e4a36f41SAndroid Build Coastguard Workerallow aconfigd vendor_aconfig_storage_file:file r_file_perms;
25*e4a36f41SAndroid Build Coastguard Workerallow aconfigd vendor_aconfig_storage_file:dir r_dir_perms;
26*e4a36f41SAndroid Build Coastguard Worker
27*e4a36f41SAndroid Build Coastguard Worker# allow aconfigd to read /apex dir
28*e4a36f41SAndroid Build Coastguard Workerallow aconfigd apex_mnt_dir:dir r_dir_perms;
29*e4a36f41SAndroid Build Coastguard Workerallow aconfigd apex_mnt_dir:file r_file_perms;
30*e4a36f41SAndroid Build Coastguard Workerdontaudit aconfigd apex_info_file:file r_file_perms;
31*e4a36f41SAndroid Build Coastguard Worker
32*e4a36f41SAndroid Build Coastguard Worker###
33*e4a36f41SAndroid Build Coastguard Worker### Neverallow assertions
34*e4a36f41SAndroid Build Coastguard Worker###
35*e4a36f41SAndroid Build Coastguard Worker
36*e4a36f41SAndroid Build Coastguard Worker# only init is allowed to enter the aconfigd domain
37*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init } aconfigd:process transition;
38*e4a36f41SAndroid Build Coastguard Workerneverallow * aconfigd:process dyntransition;
39*e4a36f41SAndroid Build Coastguard Worker
40*e4a36f41SAndroid Build Coastguard Worker# Do not allow write access to boot/map storage files except, aconfigd and aconfigd_mainline.
41*e4a36f41SAndroid Build Coastguard Worker# These files are meant to serve flag reads for all processes. They are created by aconfigd (for
42*e4a36f41SAndroid Build Coastguard Worker# platform storage files) and aconfigd_mainline (mainline storage files) processes.
43*e4a36f41SAndroid Build Coastguard Workerneverallow {
44*e4a36f41SAndroid Build Coastguard Worker  domain
45*e4a36f41SAndroid Build Coastguard Worker  -init
46*e4a36f41SAndroid Build Coastguard Worker  -aconfigd
47*e4a36f41SAndroid Build Coastguard Worker  -aconfigd_mainline
48*e4a36f41SAndroid Build Coastguard Worker} aconfig_storage_metadata_file:dir no_w_dir_perms;
49*e4a36f41SAndroid Build Coastguard Workerneverallow {
50*e4a36f41SAndroid Build Coastguard Worker  domain
51*e4a36f41SAndroid Build Coastguard Worker  -init
52*e4a36f41SAndroid Build Coastguard Worker  -aconfigd
53*e4a36f41SAndroid Build Coastguard Worker  -aconfigd_mainline
54*e4a36f41SAndroid Build Coastguard Worker} aconfig_storage_metadata_file:file no_w_file_perms;
55*e4a36f41SAndroid Build Coastguard Worker
56*e4a36f41SAndroid Build Coastguard Worker# Only aconfigd and aconfigd_mainline can access persist storage files
57*e4a36f41SAndroid Build Coastguard Worker# These files are meant to serve as persist flag value storage, only aconfigd and
58*e4a36f41SAndroid Build Coastguard Worker# aconfigd_mainline process should manage them. Other processes should have zero access.
59*e4a36f41SAndroid Build Coastguard Workerneverallow {
60*e4a36f41SAndroid Build Coastguard Worker  domain
61*e4a36f41SAndroid Build Coastguard Worker  -init
62*e4a36f41SAndroid Build Coastguard Worker  -aconfigd
63*e4a36f41SAndroid Build Coastguard Worker  -aconfigd_mainline
64*e4a36f41SAndroid Build Coastguard Worker} aconfig_storage_flags_metadata_file:dir *;
65*e4a36f41SAndroid Build Coastguard Workerneverallow {
66*e4a36f41SAndroid Build Coastguard Worker  domain
67*e4a36f41SAndroid Build Coastguard Worker  -init
68*e4a36f41SAndroid Build Coastguard Worker  -aconfigd
69*e4a36f41SAndroid Build Coastguard Worker  -aconfigd_mainline
70*e4a36f41SAndroid Build Coastguard Worker} aconfig_storage_flags_metadata_file:file no_rw_file_perms;
71