A developer says "SELinux keeps breaking my app, can we just disable it?" How do you respond and what do you do?
IntermediateScenarioSecurity, hardening and incident response
Answer
Situation read → Fix the policy issue, don't remove the protection.
What I'd do →
- Find the denial:
sudo ausearch -m AVC -ts recent
sudo sealert -a /var/log/audit/audit.log # setroubleshoot
- Usually it's a label or boolean:
restorecon -Rv /srv/app,semanage fcontext -a -t httpd_sys_content_t '/srv/app(/.*)?',setsebool -P httpd_can_network_connect on. - Only if nothing fits, build a small local module:
audit2allow -M myappand review it before loading. - If needed during debugging, make only that domain permissive:
semanage permissive -a httpd_t.
Why → SELinux contains exploits; most "breakage" is a missing label after files were moved.
Interview tip → "setenforce 0 is a diagnostic, not a fix" is the line to say.
More on Security, hardening and incident response
Monitoring shows a web server making outbound connections to an unknown IP on port 4444 at 2 AM. You suspect it is compromised. What do you do?AdvancedAfter the compromise you need to find how the attacker got in. Where do you look?AdvancedYour CISO asks you to harden a fresh Linux server baseline. What's on your list?IntermediateYou need to know when anyone modifies `/etc/sudoers`, `/etc/passwd` or SSH config. How?IntermediateA critical OpenSSL CVE is announced. How do you find and patch affected servers quickly?IntermediateHow do you make sure only signed, approved packages can be installed on your servers?Intermediate