I formatted again and followed the guide to the letter using Hardened stage 3 and then converting it to SELinux. I get exactly the same result as in the screenshot in the first post. So it does not seem to be anything I did wrong after all...
Code: Select all
SELinux: Unable to switch to permissive mode: Invalid argument
I tried following the below from
https://wiki.gentoo.org/wiki/SELinux/Installation using the H/SELinux stage 3
Code: Select all
SELinux stage3 tarballs are also available and supported - this is significantly easier than performing the steps below. The tarballs can be simply unpacked onto a target system, relabel the entire system, add the initial user to the administration SELinux user and reboot.
This is the result when I try relabelling as the above suggests
Code: Select all
localhost / # rlpkg -a
Relabeling filesystem types: btrfs encfs ext2 ext3 ext4 ext4dev f2fs gfs gfs2 gpfs jffs2 jfs lustre xfs zfs
Running /sbin/setfiles /etc/selinux/strict/contexts/files/file_contexts /
/etc/selinux/strict/contexts/files/file_contexts: No such file or directory
Scanning for shared libraries with text relocations...
/usr/lib/python3.12/subprocess.py:1016: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, 'rb', bufsize)
0 libraries with text relocations, 0 not relabeled.
Scanning for PIE binaries with text relocations...
0 binaries with text relocations detected.
localhost / # ls -Z /etc/portage/make.conf
? /etc/portage/make.conf
localhost / # semanage login -a -s staff_u admin
libsemanage.semanage_read_policydb: Could not open kernel policy /var/lib/selinux/strict/active/policy.kern for reading. (No such file or directory).
FileNotFoundError: No such file or directory
I am really trying to decipher these guides but they are proving to be full of catch 22s. How am I supposed to relabel a system when no file_contexts exists? Is it even possible to assign a user to staff_u while being booted into a Live CD kernel?