![SELinux 正在阻止 Gunicorn](https://rvso.com/image/170258/SELinux%20%E6%AD%A3%E5%9C%A8%E9%98%BB%E6%AD%A2%20Gunicorn.png)
我寫了一個systemd單元來啟動gunicorn,但不幸的是它一直失敗,在檢查journalctl時我發現了以下錯誤。
SELinux is preventing /usr/lib/systemd/systemd from execute access on the file gunicorn.
理想情況下,我希望避免停用 SElinux,因為它是一個附加的安全層。
我怎麼能告訴SElinux允許gunicorn而不需要完全停用SElinux?
任何建議/見解將非常感激,謝謝。
答案1
如果您使用的是 Red Hat(或從它派生的東西,例如 Centos 或 Scientific Linux),您可以使用 yum 安裝 policycoreutils-python 和 setroubleshoot-server 軟體包,這將為您提供一些強大的診斷工具。
從它的聲音來看,在不知道您的發行版詳細資訊的情況下,您可能需要在檔案 Gunicorn 上設定 selinux 上下文,以便允許 systemd 使用它。您可以使用 ls -Z [filepath] 查看目前上下文