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.
More on Firewalls, MAC & Compliance
How do ufw, firewalld, nftables and iptables relate?BeginnerConfigure ufw for a web server with SSH only from the office.BeginnerExplain firewalld zones and runtime vs permanent configuration.IntermediateWrite a minimal nftables ruleset for a server.AdvancedWhy are nftables preferred over iptables at scale?AdvancedHow do you avoid locking yourself out when changing remote firewall rules?Intermediate