Debian:无法设置 SELinux

Ele*_*eno 6 debian selinux

我正在尝试根据(Debian wiki 上报告的说明)在 Debian 6 上设置 SELinux 。

我已经运行了这个命令:

apt-get install selinux-basics selinux-policy-default 
selinux-activate
Run Code Online (Sandbox Code Playgroud)

重新启动后,系统应该在引导时花费一些时间来标记文件系统,然后在完成后第二次重新启动。但是,既没有标记也没有重新启动。

命令:

check-selinux-installation
Run Code Online (Sandbox Code Playgroud)

返回:

/usr/sbin/check-selinux-installation:19: DeprecationWarning: os.popen3 is deprecated.  Use the subprocess module.
  @staticmethod
/usr/sbin/check-selinux-installation:23: DeprecationWarning: os.popen2 is deprecated.  Use the subprocess module.
  def fix():
getfilecon:  getfilecon(/proc/1) failed
SELinux is not enabled.
Could not read the domain of PID 1.
/etc/pam.d/login is not SELinux enabled
FSCKFIX is not enabled - not serious, but could prevent system from booting...
Run Code Online (Sandbox Code Playgroud)

这很奇怪,因为内核启用了 SELinux,并且grub.cfg确实包含该selinux=1选项。

有什么建议吗?

Sha*_*pai 5

检查sestatus它是否返回enabled然后它工作正常。

也输入命令

grep FSC /etc/default/rcS 
Run Code Online (Sandbox Code Playgroud)

如果它返回,#FSCKFIX=no则使用 gedit 或任何其他编辑工具编辑 rcS 文件,取消注释该行并将其设置为 yes(像这样FSCKFIX=yes),然后保存并退出 gedit。编辑文件后重新输入命令 grep FSC /etc/default/rcS应该返回FSCKFIX=yes

如果命令check-selinux-installation只返回

/etc/pam.d/login is not SELinux enabled
Run Code Online (Sandbox Code Playgroud)

那么就可以了,上面的回报是一个误报。用于编辑 grub.cfg 和检查审计;按照Debian Wiki 提供的 SELinux Setup步骤 进行操作。使用具有增强安全性的 linux ~ SELinux