GUIDE 14 / SECURITY
SELinux
Inspect mandatory access controls, investigate denials, and restore file labels.
Commands use class paths and example filenames. Replace placeholders and inspect the target before making changes.
Inspect SELinux mode and labels
SELinux adds policy checks beyond ordinary file permissions. Nginx processes run in httpd_t. A readable Unix mode can still result in a denied request if the label is unsuitable.
getenforce
sestatus
ps -eZ | grep nginx
ls -lZ /usr/share/itfdn-docs
sudo ausearch -m avc -ts recentAn AVC identifies source context, target context, object class, and denied operation. permissive=0 means the denial was enforced. Do not disable SELinux to work around a labeling problem.
Restore the expected file label
Moving a file within a filesystem can preserve its old label. In the class exercise, a home-created notes.html retained user_home_t and nginx received 403 until its path label was restored.
matchpathcon /usr/share/itfdn-docs/notes.html
restorecon -v /usr/share/itfdn-docs/notes.html
ls -lZ /usr/share/itfdn-docs/notes.htmlrestorecon uses the configured path mapping. In the observed exercise that mapping was usr_t and serving succeeded. Dedicated web roots commonly use httpd_sys_content_t; persistent custom mappings should be defined with semanage fcontext before restorecon.