How to troubleshoot SELinux issues
The popular belief is that it is very difficult to determine and fix SELinux issues. This stems from the fact that the logs get logged with the system audit. This log reading is not intuitive and, in fact, to the human eye is quite complex; but it isn’t.
Carrying on with the example of the httpd
web server, consider the following sequence of commands:
- As the
root
user, create themyfile
file:# touch myfile
- Move the
myfile
file to the web content directory:# mv myfile /var/www/html/
- Use the
curl
command to get the contents of themyfile
file published by the web server:# curl http://localhost/myfile
- Observe the output:
Figure 12.7 – Creating the myfile web file
- Use the
grep
command to search for themyfile
string in the system audit log:# grep myfile /var/log/audit/audit.log ... type=AVC msg=audit(1689045662.823:264): avc: denied { getattr } for ...