Skip to contentSkip to conversation

selinux(8): note on conflicting configurations

PATCH In review Johannes Segitz 3 participants 4 messages Jul 21 – Jul 23 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux(8): note on conflicting configurations

setting SELINUX=disabled while having selinux=1
results in a non-booting system. Document this
here in a note

---
 libselinux/man/man8/selinux.8 | 9 +++++++++
 1 file changed, 9 insertions(+)
libselinux/man/man8/selinux.8 +9 -0
index 5842150b..17df2a99 100644
@@ -50,6 +50,15 @@ regardless of what is set in the
 .I /etc/selinux/config
 file.
 
+.B NOTE:
+When setting a conflicting configuration like
+.B SELINUX=disabled
+in
+.I /etc/selinux/config
+while having
+.B selinux=1
+on the kernel boot options will result in a non-bootable system.
+
 The
 .I /etc/selinux/config
 configuration file also controls what policy

--
2.55.0

maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Johannes Segitz

setting SELINUX=disabled while having selinux=1
results in a non-booting system. Document this
here in a note

The patch is fine but wondering if we want to change the libselinux behavior in this situation.

Quoted 26 lines
---
 libselinux/man/man8/selinux.8 | 9 +++++++++
 1 file changed, 9 insertions(+)
libselinux/man/man8/selinux.8 +9 -1
index 5842150b..17df2a99 100644
@@ -50,6 +50,15 @@ regardless of what is set in the
 .I /etc/selinux/config
 file.
 
+.B NOTE:
+When setting a conflicting configuration like
+.B SELINUX=disabled
+in
+.I /etc/selinux/config
+while having
+.B selinux=1
+on the kernel boot options will result in a non-bootable system.
+
 The
 .I /etc/selinux/config
 configuration file also controls what policy
--

2.55.0

#2 lore raw
In reply to Johannes Segitz
Quoted 30 lines · Johannes Segitz

setting SELINUX=disabled while having selinux=1
results in a non-booting system. Document this
here in a note

---
 libselinux/man/man8/selinux.8 | 9 +++++++++
 1 file changed, 9 insertions(+)
libselinux/man/man8/selinux.8 +9 -1
index 5842150b..17df2a99 100644
@@ -50,6 +50,15 @@ regardless of what is set in the
 .I /etc/selinux/config
 file.
 
+.B NOTE:
+When setting a conflicting configuration like
+.B SELINUX=disabled
+in
+.I /etc/selinux/config
+while having
+.B selinux=1
+on the kernel boot options will result in a non-bootable system.
+
 The
 .I /etc/selinux/config
 configuration file also controls what policy
--
Quoted 1 line

2.55.0

It seems to work for me on CentOS Stream 10:

[root@default-0]# sestatus 
SELinux status:                 disabled
[root@default-0]# cat /proc/cmdline 
BOOT_IMAGE=(hd0,gpt2)/boot/vmlinuz-6.12.0-250.el10.x86_64 root=UUID=45db8c52-819d-4199-bca1-3f50a95d7fc5 ro console=ttyS0,115200n8 no_timer_check crashkernel=2G-64G:256M,64G-:512M selinux=1
[root@default-0]# cat /etc/selinux/config

# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.

# See also:
# https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-selinux/#getting-started-with-selinux-selinux-states-and-modes
#
# NOTE: In earlier Fedora kernel builds, SELINUX=disabled would also

# fully disable SELinux during boot. If you need a system with SELinux
# fully disabled instead of SELinux running with no policy loaded, you
# need to pass selinux=0 to the kernel command line. You can use grubby
# to persistently set the bootloader to boot with selinux=0:
#
#    grubby --update-kernel ALL --args selinux=0
#
# To revert back to SELinux enabled:
#
#    grubby --update-kernel ALL --remove-args selinux
#
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@default-0]# rpm -q libselinux
libselinux-3.11-1.el10.x86_64
#3 lore raw
Quoted 19 lines · Petr Lautrbach
Quoted 17 lines · Johannes Segitz

setting SELINUX=disabled while having selinux=1
results in a non-booting system. Document this
here in a note

---
 libselinux/man/man8/selinux.8 | 9 +++++++++
 1 file changed, 9 insertions(+)
libselinux/man/man8/selinux.8 +0 -0
index 5842150b..17df2a99 100644
@@ -50,6 +50,15 @@ regardless of what is set in the
 .I /etc/selinux/config
 file.
 
Quoted 16 lines
Quoted 13 lines
libselinux/man/man8/selinux.8 +9 -1
+.B NOTE:
+When setting a conflicting configuration like
+.B SELINUX=disabled
+in
+.I /etc/selinux/config
+while having
+.B selinux=1
+on the kernel boot options will result in a non-bootable system.
+
 The
 .I /etc/selinux/config
 configuration file also controls what policy
--
Quoted 1 line

2.55.0

It seems to work for me on CentOS Stream 10:

Interesting. We got this reported on an older SLES and carried the patch since then. I just reproduced on a current system and there it also doesn't happen, so please disregard this patch

Johannes

Signature · 4 lines
GPG Key                EE16 6BCE AD56 E034 BFB3  3ADD 7BF7 29D5 E7C8 1FA0
Subkey fingerprint:    250F 43F5 F7CE 6F1E 9C59  4F95 BC27 DD9D 2CC4 FD66
SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg, Germany
www.suse.com, Geschäftsführer: Jochen Jaser, Andrew McDonald, Abhinav Puri, (HRB 36809, AG Nürnberg)