From Security-Enhanced Linux for mere mortals and SELinux For Dummies
All as root.
yum -y install setroubleshoot setroubleshoot-server
service auditd restartjournalctl -b -0SFD
ausearch -i -m AVC,USER_AVC -sv no -ts recent-mtype Access Vector Cache denials-iinterpret them-sv nodon't care about the positive-ts recentlast 5 minutes
Also
-se prelude_manager_tto search for type
setsebool httpd_enable_homedirs 1 -Phttpd_enable_homedirsis the boolean to set1istrue-Pmakes it permanent
semanage boolean -lgetsebool -aSFD
semanage port -a -t http_port_t -p tcp 8080cat /etc/selinux/targeted/modules/active/boolean.localchcon -u system_u -r object_r -t httpd_sys_content_t /var/www/html/index.htmlIn targeted, only -t matters.
chcon --reference /var/www/html/ /var/www/html/index.htmlReset entire dir.
restorecon -vR /var/www/html/-vverbose-Rrecursively
Defaults come from /etc/selinux/targeted/contexts/files/file_contexts.
E.g., add /foo/bar as a web DocumentRoot.
ls -ldZ /var/www/html/
semanage fcontext -a -t http_sys_content_r "/foo(/.*)?"
restorecon -vR /fooor copy from known good
semanage fcontext -a -e /var/www/html /foo
restorecon -vR /foosetenforce 0 to turn off enforcement but still log all the issues.
Run the application through everything it needs to do.
Look at the alert:
sealert -l someguidIt will instruct that you should grep the audit log and create a policy for it:
grep httpd /var/audit/audit.log | audit2allow -M mypollocal
semodule -i mypollocal.ppmypollocal.teis the file name for the readable policymypollocal.ppis the file name for the policy to apply
SFD 1:07:40
ausearch -i -m AVC -sv no -ts recent -se nrpe_t | audit2allow -m drwho-nrpe > drwho-nrpe.te
checkmodule -M -m -o drwho-nrpe.mod drwho-nrpe.te
semodule_package -o drwho-nrpe.pp -m drwho-nrpe.mod
semodule -install drwho-nrpe.ppSFD 1:11:11
semanage permissive -a nrpe_t
semanage permissive -d nrpe_t
semanage permissive -l-ato enable permissive domain-dto disable (no more permissive)-lto list
- Set
SLLINUX=permissivein/etc/selinux/config touch /.autorelabel- Reboot
- Set
SELINUX=enforcingin/etc/selinux/config
yum -y install xorg-x11-xauth policycoreutils-gui bitmap-fixed-fontsThen SSH into the box
ssh -Y root@mybox
system-config-selinuxSFD 1:15:18
ps -eZ | egrep "initrc" | egrep -vw "tr|ps|egrep|bash|awk" | tr ':' ' ' | awk '{print $NF }'