Repository navigation
Conversation
dcasota
force-pushed
the
fix-selinux-relabel
branch
3 times, most recently
from
September 9, 2026 20:08
d9736ed to
7e55681
Compare
dcasota
force-pushed
the
fix-selinux-relabel
branch
2 times, most recently
from
September 17, 2026 06:02
ecd14e2 to
a34ccdf
Compare
dcasota
force-pushed
the
fix-selinux-relabel
branch
from
October 9, 2026 07:24
a34ccdf to
a56fc2d
Compare
The installer kernel boots with no SELinux policy loaded, so files the STIG playbook writes during installation stay unlabeled; with SELINUX enforcing, confined services then cannot read them on the first boot. A oneshot unit relabels the filesystem before the units that read the playbook's files. v3r4 (subrelease 92 and later) gets the relabel. The 2.1 playbook (subrelease 90 and 91) also gets the PHTN-50-000192 pam_faillock guard, ima_hash=sha256 with fips=1, and fipsmodule.cnf generation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dcasota
force-pushed
the
fix-selinux-relabel
branch
from
October 22, 2026 18:24
a56fc2d to
8c62f4e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The installer kernel has SELinux compiled in but boots with no policy loaded, so
lsetxattrforsecurity.selinuxreturnsEINVALand files cannot be labeled at install time. Every file the STIG playbook writes during installation therefore lands asunlabeled_t, and confined processes are denied access to them once the installed system boots enforcing.Ordering a first-boot relabel only against
sysinit.targetis not enough:systemd-sysctl.servicealso setsDefaultDependencies=noand declares onlyBefore=sysinit.target, so the two units are not ordered against each other. On a STIG install systemd runssystemd-sysctlfirst:systemd-sysctlaborts on the first unreadable file, so every kernel parameter inzz-stig-hardening.confis absent for the whole first boot - a compliance gap on a system installed to be STIG-hardened.The playbook also has three FIPS/PAM defects:
regex_search()inset_factreturnsNonewhen nothing matches,preauthsearch == ""is then false, the cleanup step is skipped while the add steps run, and the PAM auth stack gets duplicatepam_faillock.soentries.fips=1, IMA still defaults to sha1, which FIPS mode disables./etc/ssl/fipsmodule.cnfis missing, OpenSSL cannot initialise FIPS mode underfips=1andpam_unix.socannot verify passwords.Change
Two new patches to the playbook, in both maintained 5.0 copies of
stig-hardening:fix-selinux-relabel-first-boot.patch: addsfiles/selinux-relabel.serviceto the role and, as the last task oftasks/photon.yml, when/etc/selinux/confighasSELINUX=enforcing, copies that unit to/etc/systemd/system(an administrator unit, owned by no package), enables it and creates/.selinux-relabel. The oneshot unit runsrestorecon -R -e /proc -e /sys -e /dev /on first boot, removes the trigger file, and is orderedAfter=local-fs.target,Before=getty-pre.target sysinit.targetand explicitlyBefore=systemd-sysctl.service auditd.service systemd-networkd.service.fix-stig-playbook-fips-pam.patch:| default('')on the PHTN-50-000192 search results,ima_hash=sha256added to the kernel command line whenfips=1is set, andopenssl fipsinstallgenerating/etc/ssl/fipsmodule.cnfwhenfips.soexists and the file does not.%installcopies an explicit list of role directories;filesis added to it in both specs, so the unit the copy task needs is packaged.SPECS/stig-hardening/stig-hardening.spec(Patch3, Patch4)2.1-9->2.1-10SPECS/90/stig-hardening/stig-hardening.spec(Patch2, Patch3)2.1-5.1.2->2.1-5.1.3Both copies carry byte-identical patch files; the subrelease-90 copy only differs in patch numbering, because it does not have
fix-photon.yml-for-latest-audit-and-ansible.patch. Each spec gets one%changelogentry.Testing
rpmspec -P(x86_64 and aarch64) succeeds forSPECS/stig-hardeningat subreleases 91, 92 and 93 (Release: 10) and forSPECS/90/stig-hardeningat subrelease 90 (Release: 5.1.3).check_spec.py --mainline 93exits 0 forSPECS/stig-hardeningat subreleases 91, 92 and 93 and forSPECS/90/stig-hardeningat subrelease 90.stig-hardening-ph5-2.1.tar.gzmatchesconfig.yaml'sarchive_sha512sum; for each spec all its patches apply in spec order withpatch -p1 --fuzz=0, the%installcopy list succeeds on the patched tree and installsfiles/selinux-relabel.service, and the patchedtasks/photon.ymlandvars/main.ymlparse as YAML.🤖 Generated with Claude Code