[master] Isolate salt daemon writable state under /var/lib/salt/<daemon>/ (#70198) - #70199
Open
dwoz wants to merge 1 commit into
Open
[master] Isolate salt daemon writable state under /var/lib/salt/<daemon>/ (#70198)#70199dwoz wants to merge 1 commit into
dwoz wants to merge 1 commit into
Conversation
…tstack#70198) Default SALT_ONEDIR_HARDEN=1 on 3009.0+ so each daemon's writable state lives under per-daemon /var/lib/salt/<daemon>/{home,extras-<py>} directories and /opt/saltstack/salt stays root:root 0755. Set SALT_ONEDIR_HARDEN=0 in /etc/default/salt-setup (DEB) or /etc/sysconfig/salt-minion-setup (RPM) to restore the legacy chown -R salt /opt/saltstack/salt behavior for one release; the opt-out is deprecated and will be removed in a future release. Runtime salt-pip and the onedir _salt_onedir_extras .pth hook honor SALT_EXTRAS_DIR so packages installed via salt-pip continue to be importable by the daemon after the packaging layer relocates the extras tree. Postinst / posttrans scriptlets migrate any populated legacy /opt/saltstack/salt/extras-<py>/ contents into the per-daemon location once, idempotent no-op otherwise.
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.
Ships the
SALT_ONEDIR_HARDEN=1default for 3009.0 (master). Per-daemonwritable state moves under
/var/lib/salt/<daemon>/{home,extras-<py>}so the
/opt/saltstack/saltonedir tree staysroot:root 0755.What changes
salt-{common,minion,master,syndic,api,cloud}.{preinst,postinst}compute
SALT_HOME/SALT_EXTRAS_DIRper-daemon under/var/lib/salt/<daemon>/and chown only those (not the onedir tree)when
SALT_ONEDIR_HARDEN=1(default on 3009.0). Adds a newsalt-cloud.preinst.salt-common.dirsgains/var/lib/salt.pkg/rpm/salt.spec— same treatment in%pre,%post minion,%posttrans {master,syndic,api,cloud,minion}. Adds/var/lib/saltto%files.salt/scripts.py::salt_pipandpkg/common/onedir/_salt_onedir_extras.pyhonorSALT_EXTRAS_DIRso
salt-pip installwrites where the daemon's Python imports from.%posttrans/ DEBpostinstmove any populated/opt/saltstack/salt/extras-<py>/into the per-daemon locationonce (idempotent no-op otherwise).
SALT_ONEDIR_HARDEN=0in/etc/default/salt-setup(DEB) or
/etc/sysconfig/salt-minion-setup(RPM) preserves thelegacy chown, logs a
logger -t salt-<daemon>deprecation notice,and is planned for removal after one release cycle.
Tests
tests/pytests/unit/test_scripts.py— 3 new tests for_resolve_extras_dir(fallback, env override, empty env).tests/pytests/unit/test_salt_onedir_extras.py— 3 new tests forthe
.pthhook (fallback, env override, path promotion).tests/pytests/pkg/integration/test_onedir_harden.py— new pkgintegration coverage:
/opt/saltstack/saltmode assertion,per-daemon dir ownership,
salt-piphonorsSALT_EXTRAS_DIR.3006.x / 3007.x / 3008.x opt-in PRs are follow-ups on their own
branches, per the rollout in issue #70198.
Refs #70198.