DLPX-86523 CIS: /home filesystem and mount options (with reworked upgrade migration)#868
DLPX-86523 CIS: /home filesystem and mount options (with reworked upgrade migration)#868prakashsurya wants to merge 1 commit into
Conversation
On-engine testing — finding: autofs
|
On-engine testing — in-place upgrade ✅Engine: fresh
After reboot:
Idempotency ✅Re-running Test status
Note on not-in-place: in this branch's design the not-in-place container/new-rootfs gets |
Full build/test triggered —
|
ca24e0f to
21e4266
Compare
e80d363 to
b7cade3
Compare
Mount the home ZFS dataset at /home (with the nodev and nosuid options) instead of /export/home, to satisfy the CIS requirement for a dedicated, hardened /home filesystem. Build / new installs: - Create and mount the home dataset at /home in the raw-disk-image hook and the upgrade-container template, with nodev,nosuid on the /home fstab entry. Update ansible roles and the FAQ for the new path. In-place upgrades (upgrade-scripts): - common.sh: migrate_export_home_to_home() repoints the home dataset's /etc/fstab entry and any affected /etc/passwd home directories from /export/home to /home, then mounts /home -- leaving the existing /export/home mount live until the next reboot so processes holding it open are not disrupted and a busy unmount cannot fail the upgrade. It self-guards on the fstab entry, so it is a no-op once migrated and on fresh installs / upgrade containers that already use /home. - common.sh: harden_home_mount_options() ensures the /home fstab entry carries nodev,nosuid. Idempotent (a no-op once the options are set). - execute: call both functions late in the upgrade, after the package phase and set-bootfs. The migration runs before the hardening, which depends on the /home entry the migration creates. Neither call is host-only; the functions self-guard and no-op in containers. Dev images: - delphix-ldap (internal-dev / internal-dcenter only): stop adding the '/home auto_home -nobrowse' autofs map. With the home dataset at /home, that automount reasserts /home on its timeout, shadowing the dataset and breaking home-directory access and SSH login. Customer variants never applied it, so no upgrade-time handling is required. Co-Authored-By: Prakash Surya <prakash.surya@perforce.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b7cade3 to
8e514fc
Compare
|
Superseding this with a clean, single-commit PR (squashed history, standalone description). Link to follow. |
|
Superseded by #869 (clean single-commit version). |
Background
Consolidates the CIS
/homework into two commits ondevelop:DLPX-86523 CIS: /home filesystem and mount options— a squash of DLPX-86523 CIS: /home filesystem and mount options #756 (authored by Sanjeev), unchanged in intent: mount the home ZFS dataset at/homeinstead of/export/home, withnodev,nosuidon the/homefstab entry (build-side fstab,upgrade-containertemplate, ansible path updates, and the upgradeexecutechanges).DLPX-86523 Re-implement /home upgrade migration; drop dev-only autofs /home— our changes on top (see Solution).(Supersedes the earlier stacked-on-#756 form of this PR.)
Problem
#756's upgrade migration ran inline near the top of
executeusing a whole-filesed 's|/export/home|/home|g'on/etc/fstaband/etc/passwd(broad; runs before package maintainer scripts settle/etc/passwd). Separately, on dev images/homeis an autofs automount (auto_home, added by thedelphix-ldaprole); mounting the home dataset at/homecollides with it.Solution
Commit 2 reworks the upgrade path:
common.sh— idempotentmigrate_export_home_to_home(): targeted/etc/fstabmountpoint rewrite (home dataset line only) and targeted/etc/passwdfield-6 rewrite, thenmkdir -p /home+mount /home, leaving the old/export/homemount live until reboot. Self-guards on the fstab entry → no-op once migrated or inside an already-/homeupgrade container.execute— replace DLPX-86523 CIS: /home filesystem and mount options #756's inline block with a single guarded call placed late (after the package phase andset-bootfs, before thenodev,nosuidblock that hardens the/homeentry it creates).delphix-ldap— stop adding/home auto_home -nobrowse. This dev-only autofs map reasserts/homeon its timeout, shadowing the dataset and breaking home-dir access / SSH login. Customer variants never applied it, so no upgrade-migration handling is needed.Testing Done
Static:
shellcheck(-e SC1090 -e SC1091 -e SC2329) andshfmtclean oncommon.sh/execute;bash -nclean. sed transforms verified on representativefstab/passwdsamples.On-engine (dcoa
dlpx-develop,2026.4.0.0):/homeand/export/home.delphix-ldapchange); validated/homestable across reboot once removed.upgrade -v deferred, exit 0) + reboot — fstab→/home, passwd→/home/delphix, dual-mount pre-reboot, single/homezfs mount post-reboot, home contents intact, SSH login works./etc/fstab+/etc/passwdbyte-identical.ab-pre-pushbuild in progress — result posted in comments.🤖 Generated with Claude Code