2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 17:02:15 +00:00
Files
xcat-core/xCAT-probe/subcmds
Daniel Hilst fabfaedc89 feat(xcat-core): provision compute and service nodes with SELinux enabled
Every compute and service node was provisioned with SELinux disabled.
mknetboot added selinux=0, the kickstart templates said selinux
--disable, and the genimage postinstall and the dracut hooks wrote
SELINUX=disabled into the image. noderes.selinux and site.selinux had no
consumer on the node side.

The mode that xCAT::SELinux->node_modes resolves now reaches the node:

- Kernel command line: mknetboot appends kcmdline_selinux(): selinux=0
  for disabled, enforcing=0 for permissive, nothing for enforcing. An
  image built without the relabel hook (EL7 and older), and a squashfs
  image without labels, boot with selinux=0 and nodeset says why.
  Test: selinux_netboot_kcmdline.t.
- Kickstart: #SELINUXMODE# and #SELINUXRELABEL# in xCAT::Template. The
  rh el8/9/10, riscv64 and openEuler templates use them; the %post ends
  with restorecon -RF over the paths the xCAT scripts write. mkinstall
  warns when a template cannot express the mode of the node.
  Test: selinux_kickstart_template.t.
- genimage: the el8-10 postinstalls no longer write SELINUX=disabled, and
  the stateless xcatroot no longer writes /etc/sysconfig/selinux. genimage
  sets SELINUX=enforcing in the image, adds dracut 98selinux, and installs
  a pre-pivot hook that runs setfiles with the image file_contexts unless
  selinux=0 is set. Tests: selinux_image_config.t, selinux_relabel_hook.bats.
- packimage -m squashfs stores the labels of the image policy through
  mksquashfs pseudo xattr definitions (squashfs-tools 4.6 or later), and
  writes rootimg.sfs.selinux beside the image. Test:
  selinux_squashfs_labels.t.
- Service nodes mount /install and /tftpboot from the management node with
  context=public_content_t and tftpdir_t when SELinux is on.
  Test: selinux_sn_mount_options.t.
- makedns no longer warns about SELinux. xcatprobe xcatmn checks the xcat
  module and the labels of installdir and tftpdir instead of failing on
  enforcing. Test: probe_utils_selinux_policy.t.

The selinux/cases1 xcattest cases provision a diskful, a stateless and a
squashfs node enforcing, and a stateless node with site.selinux=disabled.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:33:16 -03:00
..
2024-05-07 16:43:07 +02:00
2024-05-07 16:43:07 +02:00
2024-05-07 16:43:07 +02:00
2024-05-07 16:43:07 +02:00
2024-05-07 16:43:07 +02:00