2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-11-21 18:02:27 +00:00

Merge pull request #329 from Obihoernchen/fix/installtodisk-selinux-relabel

Label disk installs of diskless images for SELinux at the end
This commit is contained in:
Jarrod Johnson
2026-10-30 17:25:55 -04:00
committed by GitHub
2 changed files with 10 additions and 8 deletions
@@ -25,10 +25,6 @@ mkdir -p /opt/confluent/bin
curl -f https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/firstboot.sh > /opt/confluent/bin/firstboot.sh
chmod +x /opt/confluent/bin/firstboot.sh
systemctl enable firstboot
selinuxpolicy=$(grep ^SELINUXTYPE /etc/selinux/config |awk -F= '{print $2}')
if [ ! -z "$selinuxpolicy" ]; then
setfiles /etc/selinux/${selinuxpolicy}/contexts/files/file_contexts /etc/
fi
run_remote_python syncfileclient
run_remote post.custom
# post scripts may be placed into post.d, e.g. post.d/01-firstaction.sh, post.d/02-secondaction.sh
@@ -39,6 +35,11 @@ run_remote_config post.d
cd /root/
fetch_remote confignet
selinuxpolicy=$(grep ^SELINUXTYPE /etc/selinux/config |awk -F= '{print $2}')
if [ ! -z "$selinuxpolicy" ] && grep -Eq '^SELINUX=(enforcing|permissive)' /etc/selinux/config; then
# Label what the install wrote, setfiles does not cross mounts
setfiles /etc/selinux/${selinuxpolicy}/contexts/files/file_contexts $(awk '$3 ~ /^(xfs|ext[34]|btrfs)$/ {print $2}' /proc/mounts) || echo "Warning: SELinux labeling failed"
fi
curl -sf -X POST -d 'status: staged' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$confluent_mgr/confluent-api/self/updatestatus
kill $logshowpid
@@ -32,10 +32,6 @@ mkdir -p /opt/confluent/bin
curl -f https://$confluent_websrv/confluent-public/os/$confluent_profile/scripts/firstboot.sh > /opt/confluent/bin/firstboot.sh
chmod +x /opt/confluent/bin/firstboot.sh
systemctl enable firstboot
selinuxpolicy=$(grep ^SELINUXTYPE /etc/selinux/config |awk -F= '{print $2}')
if [ ! -z "$selinuxpolicy" ]; then
setfiles /etc/selinux/${selinuxpolicy}/contexts/files/file_contexts /etc/
fi
run_remote_python syncfileclient
run_remote post.custom
# post scripts may be placed into post.d, e.g. post.d/01-firstaction.sh, post.d/02-secondaction.sh
@@ -48,6 +44,11 @@ fetch_remote confignet
# rebuild initrd, pick up new drivers if needed
dracut -f /boot/initramfs-$(uname -r).img $(uname -r)
selinuxpolicy=$(grep ^SELINUXTYPE /etc/selinux/config |awk -F= '{print $2}')
if [ ! -z "$selinuxpolicy" ] && grep -Eq '^SELINUX=(enforcing|permissive)' /etc/selinux/config; then
# Label what the install wrote, setfiles does not cross mounts
setfiles /etc/selinux/${selinuxpolicy}/contexts/files/file_contexts $(awk '$3 ~ /^(xfs|ext[34]|btrfs)$/ {print $2}' /proc/mounts) || echo "Warning: SELinux labeling failed"
fi
curl -sf -X POST -d 'status: staged' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$confluent_websrv/confluent-api/self/updatestatus
kill $logshowpid