我正在嘗試讓 dspam 在 SELinux (CentOS 7) 下工作。我添加了以下內容沒有問題:
allow dspam_t dspam_rw_content_t:dir getattr;
allow dspam_t dspam_rw_content_t:file { append getattr lock open write };
然而 dspam 仍然無法透過 procmail 運作:
/bin/sh: /usr/bin/dspam: Permission denied
procmail: Program failure (126) of "/usr/bin/dspam"
當我將 SELinux 設定為寬容時,它工作得很好。我嘗試使用audit2allow
來識別缺少的內容:
[root@opus ~]# audit2allow -i /var/log/audit/audit.log
#============= dspam_t ==============
allow dspam_t dspam_rw_content_t:dir search;
但是將其添加到我的策略中會導致checkmodule
錯誤:
checkmodule: loading policy configuration from OPUS.te
OPUS.te:19:ERROR 'permission search is not defined for class dir' at token ';' on line 19:
allow dspam_t dspam_rw_content_t:dir getattr;
allow dspam_t dspam_rw_content_t:dir search;
checkmodule: error(s) encountered while parsing configuration
我進行了一些搜索,但找不到解決方案。我如何新增或定義search
所示的權限?
答案1
雖然它沒有解決我的最終問題(dspam 無法在 SELinux 強制模式下工作),但我發布此內容是因為它確實回答了我提出的實際問題(如何授予搜尋權限)。
結果我search
在require
這個模組的區塊中丟失了。我有:
require {
[...]
class dir getattr;
}
當我發現瀏覽 @harrymc 評論中的連結時,我需要:
require {
[...]
class dir { write getattr add_name search };
}
此後,模組將正確編譯並載入。