Interview Prep/Linux/Firewalls, MAC & Compliance

An app gets "Permission denied" only with SELinux enforcing. How do you fix it properly?

IntermediateProductionFirewalls, MAC & Compliance
Answer

Do not disable SELinux. Find the denial and apply the right fix:

sudo ausearch -m AVC -ts recent
sudo sealert -a /var/log/audit/audit.log           # setroubleshoot explains + suggests
sudo semanage fcontext -a -t httpd_sys_content_t '/srv/www(/.*)?'
sudo restorecon -Rv /srv/www                        # wrong file label
sudo setsebool -P httpd_can_network_connect on      # needed boolean
sudo semanage port -a -t http_port_t -p tcp 8081    # non-standard port

Only as a last resort build a local module with audit2allow -M, and review what it allows.

All Linux questions Roadmap: Linux

More on Firewalls, MAC & Compliance