selinux¶
Notes¶
- Tutorial Video: https://www.youtube.com/watch?v=MxjenQ31b70
- CentOS HowTo: http://wiki.centos.org/HowTos/SELinux
- Labels are in user:role:type:level(optional)
- Logs go in /var/log/audit/audit.log and /var/log/messages
-
Additional tools:
-
semanage and more are included in CentOS package
policycoreutils setroubleshoothas a bunch of tools included. Lots of prerequisitessetroubleshoot-serverhas a bunch of tools included. Lots of prerequisites
Examples¶
Show status of selinux¶
Disable without rebooting¶
or...
List selinux contexts for processes¶
List selinux contexts for processes that have open sockets¶
List selinux contexts for the current user¶
List selinux contexts for files¶
Recursively set a context type¶
Copy the selinux context from another file or directory¶
Restore default contexts¶
This command restores the contexts as referenced in /etc/selinux/targeted/contexts/files/file_contexts
Restore defaults context automatically at system reboot¶
This should take roughly the same amount of time as a fsck would.
Define a default context for a directory¶
Define a default context for a directory, using a reference from the original policy¶
semanage fcontext -a -e /var/www /z5/sole
cat /etc/selinux/targeted/contexts/files/file_contexts.subs # view the result