SELinux访问拒绝了由perl-cgi脚本触发的bash脚本的错误

我有一个自动化框架,使用Perl-CGI在服务器上运行脚本。 正如我们启用SELinux,当脚本尝试运行bash脚本时,我得到访问被拒绝的错误。

以下是我可以在脚本的audit.log中find的错误日志

type=AVC msg=audit(1397170377.265:109255): avc: denied { execute } for pid=23776 comm="run_step.sh" name="step.sh" dev=sda1 ino=795126 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=system_u:object_r:httpd_sys_rw_content_t:s0 tclass=file type=AVC msg=audit(1397170377.265:109255): avc: denied { execute_no_trans } for pid=23776 comm="run_step.sh" path="/var/www/html/test/generated.5465/step.sh" dev=sda1 ino=795126 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=system_u:object_r:httpd_sys_rw_content_t:s0 tclass=file 

当我在宽容模式下设置SELinux时,我能够运行这些脚本,没有任何错误。 但是在执行的时候,我不能这样做。

此外,我已经设置了文件的httpd标签,但仍然得到这些错误。 任何想法如何解决它。

看一下audit.log消息,看起来好像你可能会有一些文件标记错误。 如果您正在尝试运行这些文件,那么我认为它们应该标记为httpd_sys_script_t而不是httpd_sys_rw_content_t