
根據SELinux 簡介,第 14.4.2 節,
SELinux 支援內建於 Debian 提供的標準核心中。核心 Unix 工具無需任何修改即可支援 SELinux。
我已經在我的上安裝了selinux-basics
和軟體包selinux-policy-default
Debian 威茲(穩定的)系統,我看到它在安裝過程中加載了一些策略,所以我很確定安裝本身進展順利。
我編輯 /etc/default/grub 說:
GRUB_CMDLINE_LINUX="selinux=1 audit=1 enforcing=0"
(變數曾經為空)並執行 update-grub。 /boot/grub/grub.cfg 確實包含了 SELinux 相關的核心參數。
/.autorelabel
我根據 /usr/sbin/selinux-activate 腳本的“enable”分支建立了一個檔案。
進行上述變更後,我已重新啟動系統。重啟期間沒有發生任何異常情況。
dmesg | head
輸出,除其他外:
Command line: BOOT_IMAGE=/boot/vmlinuz-3.2.0-4-amd64 root=UUID=c050d662-f94a-447a-9342-0fc69f65a513 ro selinux=1 audit=1 enforcing=0 quiet pci=nomsi
據我所知,一切都已就位。然而,它似乎不起作用。 id -Z
返回:
$ id -Z
id: --context (-Z) works only on an SELinux-enabled kernel
$
狀態給出:
# sestatus
SELinux status: disabled
#
# check-selinux-installation
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
Postfix init script is syncing the chroots.
Postfix has chrooted service in master.cf
FSCKFIX is not enabled - not serious, but could prevent system from booting...
#
在我的系統上啟用 SELinux 還缺少什麼?
答案1
security=selinux
正如評論中指出的,您還需要將參數傳遞給核心。在 Debian 系統上,這應該會自動添加到 grub 配置中selinux-activate
。
核心文件參數解釋security
:
[安全性] 選擇啟動時啟用的安全性模組。如果未指定該引導參數,則僅載入第一個請求安全註冊的安全模組。無效的安全模組名稱將被視為未選擇任何模組。
在 Debian 上這是相關的,因為 Debian 也支援 AppArmor 安全模組。