I am learning about SELinux and have a question:
There doesn't appear to be a direct correlation between the fields of the source and the target. For example Apache may run with Type httpd_t and the files under /var/www/html/ may have type label set to httpd_sys_content_t. These "labels" appear to be just human readable strings unless I am wrong.
So where is the mapping? How does the system know which target contexts are allowed to be accessed by processes with any specific source context?
semanage fcontext -a Will set a custom file context policy which can then be attached to matching files with restorecon, but this does not tell me what Type should be used.
What is the "purpose" of the User, Role, and Level fields? Which fields have to match for an action to be allowed?
On a related note: How does a process get labeled with a specific source context?