From ce335ba3b3c8b10106808c3ced5ecd077dd05cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:39:47 -0300 Subject: [PATCH] fix(netboot): correct SELinux assignments in postinstall profiles Match the complete enforcing or permissive setting. Preserve comments and whitespace, and do not change unrelated lines or create a missing policy file. --- .../share/xcat/netboot/rh/compute.rhels10.aarch64.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels10.ppc64le.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels10.x86_64.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels8.ppc64le.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels8.x86_64.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels9.ppc64le.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels9.x86_64.postinstall | 2 +- xCAT-server/share/xcat/netboot/rh/service.postinstall | 2 +- .../xcat/netboot/rocky/compute.rocky10.riscv64.postinstall | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.aarch64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.aarch64.postinstall index 2ad53bb406..c5fcc45dfa 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.aarch64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.aarch64.postinstall @@ -37,7 +37,7 @@ END #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #--for redhat 8 and 8.1 #-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.ppc64le.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.ppc64le.postinstall index dd2576c8f7..9028a7b75b 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.ppc64le.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.ppc64le.postinstall @@ -37,7 +37,7 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #--for redhat 8 and 8.1 diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.x86_64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.x86_64.postinstall index 2ad53bb406..c5fcc45dfa 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.x86_64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.x86_64.postinstall @@ -37,7 +37,7 @@ END #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #--for redhat 8 and 8.1 #-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall index eac5a8f4d8..fa1737a632 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall @@ -37,7 +37,7 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #-- Example of booted image versioning diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall index 366e3d1df4..1787b10290 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall @@ -37,7 +37,7 @@ END #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #-- Example of booted image versioning diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.postinstall index dd2576c8f7..9028a7b75b 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.postinstall @@ -37,7 +37,7 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #--for redhat 8 and 8.1 diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.postinstall index 2ad53bb406..c5fcc45dfa 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.postinstall @@ -37,7 +37,7 @@ END #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #--for redhat 8 and 8.1 #-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.postinstall index dd2576c8f7..9028a7b75b 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.postinstall @@ -37,7 +37,7 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #--for redhat 8 and 8.1 diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.postinstall index 2ad53bb406..c5fcc45dfa 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.postinstall @@ -37,7 +37,7 @@ END #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #--for redhat 8 and 8.1 #-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys diff --git a/xCAT-server/share/xcat/netboot/rh/service.postinstall b/xCAT-server/share/xcat/netboot/rh/service.postinstall index e410490db4..a0707a17b5 100755 --- a/xCAT-server/share/xcat/netboot/rh/service.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/service.postinstall @@ -41,7 +41,7 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #-- Example of booted image versioning diff --git a/xCAT-server/share/xcat/netboot/rocky/compute.rocky10.riscv64.postinstall b/xCAT-server/share/xcat/netboot/rocky/compute.rocky10.riscv64.postinstall index 015cfec0f9..c69a051426 100755 --- a/xCAT-server/share/xcat/netboot/rocky/compute.rocky10.riscv64.postinstall +++ b/xCAT-server/share/xcat/netboot/rocky/compute.rocky10.riscv64.postinstall @@ -37,7 +37,7 @@ END #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/^\([[:blank:]]*SELINUX=\)\(enforcing\|permissive\)\([[:blank:]]*\(#.*\)\{0,1\}\)$/\1disabled\3/' "$installroot/etc/selinux/config" fi #--for redhat 8 and 8.1 #-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys