Ubuntu默認未啟用SELinux,若需使用需手動配置,以下是其安全增強措施及操作要點:
sudo apt install selinux-basics selinux-policy-default。sudo selinux-activate。/etc/selinux/config,將SELINUX=disabled改為SELINUX=enforcing,重啟生效。cat /etc/selinux/config。semanage工具管理上下文(如文件、端口),例如:sudo semanage fcontext -a -t httpd_sys_content_t "/path/to/file"。sudo restorecon -v /path/to/file。sudo ausearch -m avc -ts recent。sudo ausearch -m avc -ts recent | audit2allow -M mypol。enforcing模式,開發環境可臨時用permissive模式調試。提示:SELinux配置復雜,建議優先使用Ubuntu默認的AppArmor,如需啟用SELinux需充分測試以避免影響系統穩定性。