Skip to content
Snippets Groups Projects
  • Nick Kralevich's avatar
    cd905ec0
    Protect keystore's files. · cd905ec0
    Nick Kralevich authored
    Only keystore itself should be reading / writing it's files.
    Remove keystore file access from other SELinux domains, including
    unconfined. Add neverallow rules to protect against regressions.
    Allow init limited access to recurse into keystore's directory.
    
    Change-Id: I0bb5de7804f4314997c16fac18507933014bcadf
    cd905ec0
    History
    Protect keystore's files.
    Nick Kralevich authored
    Only keystore itself should be reading / writing it's files.
    Remove keystore file access from other SELinux domains, including
    unconfined. Add neverallow rules to protect against regressions.
    Allow init limited access to recurse into keystore's directory.
    
    Change-Id: I0bb5de7804f4314997c16fac18507933014bcadf
keystore.te 935 B
type keystore, domain;
type keystore_exec, exec_type, file_type;

# keystore daemon
init_daemon_domain(keystore)
typeattribute keystore mlstrustedsubject;
binder_use(keystore)
binder_service(keystore)
allow keystore keystore_data_file:dir create_dir_perms;
allow keystore keystore_data_file:notdevfile_class_set create_file_perms;
allow keystore keystore_exec:file { getattr };
allow keystore tee_device:chr_file rw_file_perms;
allow keystore tee:unix_stream_socket connectto;

###
### Neverallow rules
###
### Protect our files from others
###

neverallow { domain -keystore } keystore_data_file:dir ~{ open create read getattr setattr search relabelto };
neverallow { domain -keystore } keystore_data_file:notdevfile_class_set ~{ relabelto getattr };

neverallow { domain -keystore -init -kernel -recovery } keystore_data_file:dir *;
neverallow { domain -keystore -init -kernel -recovery } keystore_data_file:notdevfile_class_set *;