如何在安装Selinux策略时处理错误

发布于 2025-02-03 21:15:08 字数 243 浏览 5 评论 0 原文

现在,我正在尝试安装我制定的Selinux政策。 但是我遇到了如下:

无法解决filecon语句在/var/lib/selinux/targeted/tmp/tmp/tocules/400/mypolicy/cil:303 半模型:失败! 安装失败:

我希望知道如何处理此错误。如何在.te或.fc文件中找到错误点? 数字“ 303”是什么意思?是行号吗?但是CIL文件是二进制文件。 您能让我知道一种处理此错误的方法吗?

谢谢。

Now I'm trying to install SELinux policy that I made.
But I met error like follow:

Failed to resolve filecon statement at /var/lib/selinux/targeted/tmp/modules/400/mypolicy/cil:303
semodule: Failed!
install failed :

I hope to know how can I handle this error. How can I find the error point in the .te or .fc file?
What does the number '303' mean? Is it a line number? But cil file is binary.
Could you please let me know a way to handle this error?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浮云落日 2025-02-10 21:15:08

您的 .te .if .fc 文件中的转换是一个多步骤过程。

当系统构建策略模块时,首先,CheckModule用于构建.mod中间文件。接下来,称为semodule_package,将此中间文件和相应的文件 - 封闭文件转换为.pp文件。

在您的错误中, semodule 现在在策略软件包中抱怨一些问题,并给出了相应的常见中间语言行号作为参考。如果您想了解更多有关CIL的信息,请参阅此处:

在CIL文件中获取失败线,找到您的PP文件并调用PP编译器以获取CIL代码。 PP编译器位于名为HLL的高级语言基础架构文件夹中(请参阅)。

/recipe-sysroot-native/usr/libexec/selinux/hll/pp ./refpolicy/mypolicy.pp > mypolicy.txt

现在,您可以在mypolicy.txt中检查给定的行号。

The transformation of your .te .if and .fc files into the actual policy is a multi-step process.

When the system builds a policy module, first, checkmodule is used to construct a .mod intermediate file. Next, semodule_package is called, transforming this intermediate file and the corresponding file-context file into a .pp file.

In your error, semodule now complains about some problem in the policy package and gives the corresponding Common Intermediate Language line number as a reference. If you want to know more about CIL, see here: https://github.com/SELinuxProject/selinux/blob/master/secilc/docs/README.md

To get the failing line within the CIL file, locate your pp file and call the pp compiler to get the CIL code. The pp compiler is in the High-Level Language Infrastructure folder called hll (see https://github.com/SELinuxProject/selinux/wiki/High-Level-Language-Infrastructure).

/recipe-sysroot-native/usr/libexec/selinux/hll/pp ./refpolicy/mypolicy.pp > mypolicy.txt

Now you can check the given line number in the mypolicy.txt.

静谧 2025-02-10 21:15:08

我找到了一个原因。
在RH8中,将UMASK添加到/ETC/PAM.D/PostLogin中。因此,对于sftp,拉动了/etc/login.defs中的umask值,并将其应用于sftp的umask值。是077

I found a reason.
In RH8, umask is added to /etc/pam.d/postlogin. So, for sFtp, the UMASK value in /etc/login.defs is pulled and it is applied to umask value for sFtp. It was 077.

Redhat link

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文