file contexts and .te files
selinux-implementation
good-question-SO
visual_guide_to_sepolicy
formate to understand sepolicy:
1.
file_contexts
/dev/foo u:object_r:source_type:s0
policy.te
allow source_type target_type: target_class permission(s)
So this means
"allow source_type to do permitted actions on target_class of target_type "
2.
file_context
/dev/catfile u:object_r:cat_chow:s0
cat.te
type cat, domain
allow cat cat_chow:food eat
"allow cat to eat food of type cat_chow "
3.
file_contexts
/dev/mma8x5x u:object_r:sensors_device:s0
sensors.te
type sensors, domain
allow sensors sensors_device:chr_file rw_file_perms
"allow sensors to do rw on chr_file of type sensors_device"
good-question-SO
visual_guide_to_sepolicy
Policy files
Files that end with*.te are SELinux policy source files, which
define domains and their labels. You may need to create new policy files in
/device/manufacturer/device-name/sepolicy,
but you should try to update existing files where possible. Context files
Context files are where you specify labels for your objects.file_contextsassigns labels to files and is used by various userspace components. As you create new policies, create or update this file to assign new labels to files. To apply newfile_contexts, rebuild the filesystem image or runrestoreconon the file to be relabeled. On upgrades, changes tofile_contextsare automatically applied to the system and userdata partitions as part of the upgrade. Changes can also be automatically applied on upgrade to other partitions by addingrestorecon_recursivecalls to your init.board.rc file after the partition has been mounted read-write.seapp_contextsassigns labels to app processes and/data/datadirectories. This configuration is read by thezygoteprocess on each app launch and byinstalldduring startup.mac_permissions.xmlassigns aseinfotag to apps based on their signature and optionally their package name. Theseinfotag can then be used as a key in theseapp_contextsfile to assign a specific label to all apps with thatseinfotag. This configuration is read bysystem_serverduring startup.
formate to understand sepolicy:
1.
file_contexts
/dev/foo u:object_r:source_type:s0
policy.te
allow source_type target_type: target_class permission(s)
So this means
"allow source_type to do permitted actions on target_class of target_type "
2.
file_context
/dev/catfile u:object_r:cat_chow:s0
cat.te
type cat, domain
allow cat cat_chow:food eat
"allow cat to eat food of type cat_chow "
3.
file_contexts
/dev/mma8x5x u:object_r:sensors_device:s0
sensors.te
type sensors, domain
allow sensors sensors_device:chr_file rw_file_perms
"allow sensors to do rw on chr_file of type sensors_device"
Comments
Post a Comment