要檢查 SELinux 是否已啟動,請輸入以下命令:'sestatus'。當 SELinux 政策設定為啟動並封鎖 ds_agent 時,系統日誌或 SELinux
日誌(
/var/log/audit/audit.log
或 /var/log/audit.log
)中可能會出現以下警示範例:[TIMESTAMP] [HOSTNAME] python: SELinux is preventing [/PATH/BINARY] from 'read, write' accesses on the file/var/opt/ds_agent/dsa_core/ds_agent.db-shm. ***** Plugin leaks (86.2 confidence) suggests ***************************** If you want to ignore [BINARY] trying to read write access the ds_agent.db-shm file, because you believe it should not need this access. Then you should report this as a bug. You can generate a local policy module to dontaudit this access. Do ausearch -x [/PATH/BINARY] --raw | audit2allow -D -M [POLICYNAME] semodule -i POLICYNAME.pp
要解決此問題,請使用 Audit2allow 建立自訂的 SELinux 政策:
步驟
- 以 root 使用者身份連接到代理。
- 執行以下命令以建立允許存取代理檔案的自訂原則:
cd /tmp
grep ds_agent /var/log/audit/audit\* | audit2allow -M ds_agent
semodule -i ds_agent.pp
- 重新啟動 ds_agent。
- 檢查系統訊息並確認沒有與 ds_agent 相關的警報。
cat /var/log/messages | grep ds_agent
- 如果警報仍然出現,請再次執行步驟2中的命令。這將更新現有的政策並重新應用它。
接下來需執行的動作
要移除 SELinux 政策,請使用以下指令:
semodule -r ds_agent
。