chcon:在使用 SELinux 安装 nagios 时无法将部分上下文应用于未标记的文件

Moh*_*naq 9 linux selinux centos nagios

我正在使用 SELINUX=enforcing 在 CentOS 上设置 Nagios 核心。

我试着跑

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
Run Code Online (Sandbox Code Playgroud)

按照手册中的建议,但我收到此错误消息:

chcon: can't apply partial context to unlabeled file `cmd.cgi'
chcon: can't apply partial context to unlabeled file `trends.cgi'
chcon: can't apply partial context to unlabeled file `histogram.cgi'
chcon: can't apply partial context to unlabeled file `avail.cgi'
chcon: can't apply partial context to unlabeled file `history.cgi'
chcon: can't apply partial context to unlabeled file `status.cgi'
chcon: can't apply partial context to unlabeled file `tac.cgi'
chcon: can't apply partial context to unlabeled file `showlog.cgi'
chcon: can't apply partial context to unlabeled file `notifications.cgi'
chcon: can't apply partial context to unlabeled file `extinfo.cgi'
chcon: can't apply partial context to unlabeled file `statuswml.cgi'
chcon: can't apply partial context to unlabeled file `outages.cgi'
chcon: can't apply partial context to unlabeled file `statuswrl.cgi'
chcon: can't apply partial context to unlabeled file `statusmap.cgi'
chcon: can't apply partial context to unlabeled file `config.cgi'
chcon: can't apply partial context to unlabeled file `summary.cgi'
Run Code Online (Sandbox Code Playgroud)

任何想法如何避免这些错误?

Ser*_*kov 5

您需要使用正确的 selinux 类型重新标记文件:

semanage fcontext -a -s system_u -t httpd_sys_script_exec_t /usr/local/nagios/sbin/*
Run Code Online (Sandbox Code Playgroud)