我应该在 Unix 套接字上应用什么 SELinux 类型?

Chr*_*jer 5 nginx selinux centos socket centos7

我有一个 Gunicorn 套接字文件:/opt/rtd/gunicorn/run.sock. 我需要 nginx 才能打开这个套接字并写入它。

当我运行时,sesearch --allow -s httpd_t | grep unix_stream_socket我注意到httpd_t被允许连接到httpd_t类型的套接字。但当我尝试应用它时,我得到:

# semanage fcontext -a -t httpd_t "/opt/rtd/gunicorn/run.sock"
ValueError: Type httpd_t is invalid, must be a file or device type
Run Code Online (Sandbox Code Playgroud)

我尝试过从 sesearch 找到的其他类型,例如httpd_sys_script_t甚至乘客_t。相同的结果。

我应该将类型设置为什么?

我希望不必制定额外的政策来允许超出必要的范围。一定有办法允许 httpd_t 从具有 CentOS 7.2 中现有策略的文件套接字中读取数据,对吧?