Summary: | initramfs (dracut) fails to boot up a SELinux system in enforcing/strict mode | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sven Vermeulen (RETIRED) <swift> |
Component: | Hardened | Assignee: | SE Linux Bugs <selinux> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | h.v.bruinehsen |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Sven Vermeulen (RETIRED)
![]() Booting with enforcing=0 and then later switching (setenforce 1) works fine. But SELinux kernels without this (development) support still fail. Current issue seems to be that the /init in the initramfs runs in kernel_t but does too many things before it calls load_policy (which is needed to have knowledge about other domains than kernel_t) so labels are all wrong. But calling load_policy earlier might require that policy.26 is part of the initramfs as well (which is again an issue since the policy file is updated many times compared to the initramfs) Current advise: if you need initramfs support, boot with enforcing=0 (so enable selinux development in the kernel) and then switch to enforcing afterwards (for instance in an initscript). Also, grsec users which configure chroot restrictions will need to /unset/ CONFIG_GRKERNSEC_SYSCTL_ON since an initramfs uses chroot extensively (and grsec would deny most of them). You can set them later (through sysctl.conf) and then lock (grsec_lock) the sysctls. Need to check https://bugs.gentoo.org/attachment.cgi?id=302829 as well here (see if tar needs to be updated) Use of "permissive" boot solution documented in hardened-docs overlay and on gentoo wiki (http://wiki.gentoo.org/wiki/Knowledge_Base:Booting_SELinux_with_an_initramfs) Seems recently initramfs systems might boot pretty far even without the enforcing=0 at the beginning. As long as the initramfs doesn't load the policy itself, it is pretty much running in unconfined (the initramfs is treated as a trusted resource) and when Gentoo's init is called, the policy is loaded. Marking this as fixed, I've been able to boot in enforcing mode immediately using genkernel, where the initramfs is responsible for the LVM (root is on lvm, and separate /usr as well). |