2020-11-27 12:23:54 +01:00
|
|
|
# odsign - on-device signing.
|
|
|
|
type odsign, domain;
|
|
|
|
|
|
|
|
# odsign - Binary for signing ART artifacts.
|
|
|
|
typeattribute odsign coredomain;
|
|
|
|
|
|
|
|
type odsign_exec, exec_type, file_type, system_file_type;
|
|
|
|
|
|
|
|
# Allow init to start odsign
|
|
|
|
init_daemon_domain(odsign)
|
|
|
|
|
|
|
|
# Allow using persistent storage in /data/odsign
|
|
|
|
allow odsign odsign_data_file:dir create_dir_perms;
|
|
|
|
allow odsign odsign_data_file:file create_file_perms;
|
|
|
|
|
2022-02-24 12:50:35 +01:00
|
|
|
# Allow using persistent storage in /data/odsign/metrics - to add metrics related files
|
|
|
|
allow odsign odsign_metrics_file:dir rw_dir_perms;
|
|
|
|
allow odsign odsign_metrics_file:file create_file_perms;
|
|
|
|
|
2020-11-27 12:23:54 +01:00
|
|
|
# Create and use pty created by android_fork_execvp().
|
|
|
|
create_pty(odsign)
|
|
|
|
|
|
|
|
# FS_IOC_ENABLE_VERITY and FS_IOC_MEASURE_VERITY on ART data files
|
|
|
|
allowxperm odsign apex_art_data_file:file ioctl {
|
|
|
|
FS_IOC_ENABLE_VERITY FS_IOC_MEASURE_VERITY FS_IOC_GETFLAGS
|
|
|
|
};
|
|
|
|
|
2021-02-04 11:56:24 +01:00
|
|
|
# talk to binder services (for keystore)
|
|
|
|
binder_use(odsign);
|
|
|
|
|
|
|
|
# talk to keystore specifically
|
|
|
|
use_keystore(odsign);
|
|
|
|
|
|
|
|
# Use our dedicated keystore key
|
|
|
|
allow odsign odsign_key:keystore2_key {
|
|
|
|
delete
|
|
|
|
get_info
|
|
|
|
rebind
|
|
|
|
use
|
|
|
|
};
|
|
|
|
|
2020-11-27 12:23:54 +01:00
|
|
|
# talk to keymaster
|
|
|
|
hal_client_domain(odsign, hal_keymaster)
|
|
|
|
|
|
|
|
# For ART apex data dir access
|
|
|
|
allow odsign apex_module_data_file:dir { getattr search };
|
|
|
|
|
2021-07-02 12:43:41 +02:00
|
|
|
allow odsign apex_art_data_file:dir { rw_dir_perms rmdir rename };
|
2020-11-27 12:23:54 +01:00
|
|
|
allow odsign apex_art_data_file:file { rw_file_perms unlink };
|
|
|
|
|
|
|
|
# Run odrefresh to refresh ART artifacts
|
|
|
|
domain_auto_trans(odsign, odrefresh_exec, odrefresh)
|
|
|
|
|
2023-07-26 08:21:30 +02:00
|
|
|
# Run fsverity_init to add key to fsverity keyring
|
|
|
|
domain_auto_trans(odsign, fsverity_init_exec, fsverity_init)
|
|
|
|
|
2022-02-14 15:33:37 +01:00
|
|
|
# Run compos_verify to verify CompOs signatures
|
|
|
|
domain_auto_trans(odsign, compos_verify_exec, compos_verify)
|
2021-09-02 12:10:59 +02:00
|
|
|
|
2021-03-16 08:34:30 +01:00
|
|
|
# only odsign can set odsign sysprop
|
|
|
|
set_prop(odsign, odsign_prop)
|
|
|
|
neverallow { domain -odsign -init } odsign_prop:property_service set;
|
|
|
|
|
2021-07-27 13:47:42 +02:00
|
|
|
# Allow odsign to stop itself
|
|
|
|
set_prop(odsign, ctl_odsign_prop)
|
|
|
|
|
2020-11-27 12:23:54 +01:00
|
|
|
# Neverallows
|
2023-07-26 08:21:30 +02:00
|
|
|
neverallow { domain -odsign -init -fsverity_init} odsign_data_file:dir ~search;
|
|
|
|
neverallow { domain -odsign -init -fsverity_init} odsign_data_file:file *;
|