我們有 API 伺服器(tomcat),它具有 clamAV 配置來掃描任何上傳到系統的檔案。
clamAV 設定需要 API 伺服器連接到 clamAV 伺服器。
兩台伺服器上都啟用了 SELinux,每當我們嘗試上傳檔案時,都會收到以下錯誤/異常:
tomcat: java.net.socketexception permission denied (connect failed)
此錯誤與 SELinux 有關,這裡是此拒絕的審核日誌:
type=AVC msg=audit(1632293242.892:403): avc: denied { name_connect } for pid=2663 comm="http-nio-8780-e" dest=3310 scontext=system_u:system_r:tomcat_t:s0 tcontext=system_uSmiley Surprisedbject_r:clamd_port_t:s0 tclass=tcp_socket permissive=0
Was caused by:
Missing type enforcement (TE) allow rule.
You can use audit2allow to generate a loadable module to allow this access.
我們透過使用Audit2Allow
命令建立 SELinux 自訂策略來解決這個問題。
但是,我們需要知道是否有其他方法可以使用 SELinux 布林值或我們可以應用的任何標籤變更來解決此問題。
您能否提一些建議 ?
謝謝
答案1
如果有其他方法的話audit2why
就會告訴你。
您也可以嘗試該sealert
工具,它將顯示最近的 SELinux 拒絕並提供詳細資訊。