5) SELINUX Flashcards
Which packages have restorecon & semanage commands?
policycoreutils & policycoreutils-python
How do you show SELINUX file context?
$ semanage fcontext -l
$ ls -Zd /virtual
How do you temporarily change SELINUX file context?
chcon -t httpd_sys_content_t /virtual
returns to default if restorecon is run
What does the expression (/.*)? mean
optionally, match a / followed by any nubmer of characters
Define a SELinux file context rule that defines httpd_sys_content_t for /custom recursively
# semanage fcontext -a -t httpd_sys_content_t '/custom(/.*)?' # restorecon -Rv /custom
What do SELinux booleans do?
booleans are switches that change the behavior of SELinux policy. They are rule that can be disabled or enabled.
Show SELinux boolean settings
$ getsebool -a
$ getsebool httpd_enable_homedirs
Enable httpd hosting within home directories using SELinux. Make it persistent across reboot.
$ setsebool -P httpd_enable_homedirs on
Compare SELinux file context of /moo to /moocow
ls -dZ /moo /moocow