CentOS 6.4でSELinux上でgitweb.cgiを動作させる設定

gitweb.cgiがSELinuxに拒否されたケースをaudit.logから取得して、audit2allowで作成したポリシーファイルは以下の通り。

これをsemodule -i c.ppでSELinuxに反映すると、動作するようになった。

module c 1.0;

require {

        type httpd_git_script_t;

        type httpd_sys_rw_content_t;

        class file { read ioctl open getattr append };

        class dir { read search open getattr };

}

#============= httpd_git_script_t ==============

allow httpd_git_script_t httpd_sys_rw_content_t:dir { read search open getattr };

allow httpd_git_script_t httpd_sys_rw_content_t:file { read ioctl open getattr append };