blob: b35a16eb61b34f0e14f6e2ba40a26f6ba65d1f51 [file] [log] [blame]
Alex Klyubinf5446eb2017-03-23 14:27:32 -07001typeattribute keystore coredomain;
2
dcashmancc39f632016-07-22 13:13:11 -07003init_daemon_domain(keystore)
Alex Klyubin53656c12017-04-13 19:05:27 -07004
5# talk to keymaster
6hal_client_domain(keystore, hal_keymaster)
7
Janis Danisevskis97c56bd2018-01-09 17:42:53 -05008# talk to confirmationui
9hal_client_domain(keystore, hal_confirmationui)
10
Janis Danisevskisbd464a92020-08-24 07:52:32 -070011# talk to keymint
12hal_client_domain(keystore, hal_keymint)
13
Alice Wange79bbf92023-11-14 07:38:18 +000014# Ignore keystore attempts to access the AVF RKP Hal but keystore is not suppose to
15# access it.
16# TODO(b/312427637): Investigate the reason and fix the denial.
17dontaudit keystore hal_remotelyprovisionedcomponent_avf_service:service_manager { find };
18
Janis Danisevskis97c56bd2018-01-09 17:42:53 -050019# This is used for the ConfirmationUI async callback.
20allow keystore platform_app:binder call;
21
Pavel Grafovc5b33302018-01-24 19:49:18 +000022# Allow to check whether security logging is enabled.
23get_prop(keystore, device_logging_prop)
Janis Danisevskisc40681f2020-07-25 13:02:29 -070024
Max Biresaaacfdb2022-02-01 21:15:44 -080025# Allow keystore to check if the system is rkp only.
26get_prop(keystore, remote_prov_prop)
27
Vikram Gaure1c49f52022-09-29 21:20:22 +000028# Allow keystore to check rkpd feature flags
29get_prop(keystore, device_config_remote_key_provisioning_native_prop)
30
Hasini Gunasinghe0112daa2020-06-10 23:34:41 +000031# Allow keystore to write to statsd.
32unix_socket_send(keystore, statsdw, statsd)
Xin Li11da9e62020-08-29 01:45:24 -070033
Eric Biggerscc5cb432023-10-16 21:44:26 +000034# Keystore need access to the keystore2_key_contexts file to load the keystore key backend.
Janis Danisevskisc40681f2020-07-25 13:02:29 -070035allow keystore keystore2_key_contexts_file:file r_file_perms;
Hasini Gunasinghe83e1f142020-06-10 21:10:02 +000036
Paul Crowley283aef22022-08-22 09:00:25 -070037# Allow keystore to listen to changing boot levels
Paul Crowleyb0c55712021-02-23 08:40:05 -080038get_prop(keystore, keystore_listen_prop)
Satya Tangiralaa9990042021-03-01 02:53:46 -080039
Paul Crowley4a794522021-06-13 09:56:33 -070040# Keystore needs to transfer binder references to vold so that it
Satya Tangiralaa9990042021-03-01 02:53:46 -080041# can call keystore methods on those references.
42allow keystore vold:binder transfer;
Hasini Gunasinghe4fa6b1a2021-07-02 23:14:50 +000043
Hasini Gunasinghe4fa6b1a2021-07-02 23:14:50 +000044set_prop(keystore, keystore_crash_prop)
Rob Seymourecbadbb2022-07-28 16:23:42 +000045
46# keystore is using apex_info via libvintf
47use_apex_info(keystore)
Inseob Kim75806ef2024-03-27 17:18:41 +090048
49typeattribute keystore mlstrustedsubject;
50binder_use(keystore)
51binder_service(keystore)
52binder_call(keystore, remote_provisioning_service_server)
53binder_call(keystore, system_server)
54binder_call(keystore, wificond)
55
56allow keystore keystore_data_file:dir create_dir_perms;
57allow keystore keystore_data_file:notdevfile_class_set create_file_perms;
58allow keystore keystore_exec:file { getattr };
59
60add_service(keystore, keystore_service)
61allow keystore sec_key_att_app_id_provider_service:service_manager find;
62allow keystore dropbox_service:service_manager find;
63allow keystore remote_provisioning_service:service_manager find;
64add_service(keystore, apc_service)
65add_service(keystore, keystore_compat_hal_service)
66add_service(keystore, authorization_service)
67add_service(keystore, keystore_maintenance_service)
68add_service(keystore, keystore_metrics_service)
69add_service(keystore, legacykeystore_service)
70
71# Check SELinux permissions.
72selinux_check_access(keystore)
73
74r_dir_file(keystore, cgroup)
75r_dir_file(keystore, cgroup_v2)
76
77# The software KeyMint implementation used in km_compat needs
78# to read the vendor security patch level.
79get_prop(keystore, vendor_security_patch_level_prop);
80
81# Allow keystore to read its vendor configuration
82get_prop(keystore, keystore_config_prop)
83
84###
85### Neverallow rules
86###
87### Protect ourself from others
88###
89
90neverallow { domain -keystore } keystore_data_file:dir ~{ open create read getattr setattr search relabelto ioctl };
91neverallow { domain -keystore } keystore_data_file:notdevfile_class_set ~{ relabelto getattr };
92
93neverallow { domain -keystore -init } keystore_data_file:dir *;
94neverallow { domain -keystore -init } keystore_data_file:notdevfile_class_set *;
95
96# TODO(b/186868271): Remove the crash dump exception soon-ish (maybe by May 14, 2021?)
97neverallow { domain userdebug_or_eng(`-crash_dump') } keystore:process ptrace;
98
99# Only keystore can set keystore.crash_count system property. Since init is allowed to set any
100# system property, an exception is added for init as well.
101neverallow { domain -keystore -init } keystore_crash_prop:property_service set;