Repository navigation
[Feature]: Isolate salt daemon writable state under /var/lib/salt/<daemon>/, keep the onedir tree read-only #70536
dwoz
started this conversation in
Feature Requests
Replies: 1 comment
|
This feature request was moved out of the issue tracker as part of a backlog cleanup — there is no active development commitment behind it. If you intend to implement this, please leave a comment and a maintainer can convert the discussion back to an issue to track the PR. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Motivation
/opt/saltstack/salt/currently serves as both the salt user's home (SALT_HOMEdefault) and the parent of the relenv extras dir (SALT_EXTRAS_DIRdefault/opt/saltstack/salt/extras-<py>/). Because the daemon processes need write access to those, packaging postinst scriptletschown -R $SALT_USER /opt/saltstack/salt. Splitting the writable state out of the code tree aligns with the existing/var/cache/salt/<daemon>/,/etc/salt/pki/<daemon>/,/var/run/salt/<daemon>/layout and gives per-daemon isolation on multi-role hosts.Change
New packaging flag
SALT_ONEDIR_HARDEN(env var +/etc/default/salt-setup//etc/sysconfig/salt-<daemon>-setup).When
SALT_ONEDIR_HARDEN=1, for each ofminion/master/syndic/api/cloud:SALT_HOMEdefault →/var/lib/salt/<daemon>/homeSALT_EXTRAS_DIRdefault →/var/lib/salt/<daemon>/extras-<py>/opt/saltstack/salt/staysroot:root 0755.Unset /
0preserves current behavior.salt/scripts.py::salt_pipandpkg/common/onedir/_salt_onedir_extras.pyalso need to honorSALT_EXTRAS_DIRat runtime — today only the packaging layer does.Upgrade migration
With
SALT_ONEDIR_HARDEN=1, postinst /%posttransmoves an existing populated/opt/saltstack/salt/extras-<py>/into/var/lib/salt/<daemon>/extras-<py>/. No-op otherwise.Scoping
SALT_ONEDIR_HARDEN=1becomes the default.=0escape hatch stays one release, then deprecates.Same rollout as #69443, #69597.
Testing
Extend
tests/pytests/pkg/to cover, per daemon (minion/master/syndic/api/cloud) on both LTS and master defaults:SALT_ONEDIR_HARDENunset — verify legacy chown of/opt/saltstack/salt/on LTS; hardened layout (only per-daemon/var/lib/salt/<daemon>/{home,extras-<py>}chowned,/opt/saltstack/salt/staysroot:root 0755) on master.SALT_ONEDIR_HARDEN=1on LTS — hardened layout.SALT_ONEDIR_HARDEN=0on master — legacy layout; deprecation warning surfaces./var/lib/salt/<daemon>/extras-<py>/,/opt/saltstack/salt/reverts toroot:root, previouslysalt-pip-installed packages still import at daemon runtime.SALT_HOME/SALT_EXTRAS_DIRoverrides win over theSALT_ONEDIR_HARDENdefault in both directions.salt-pip install <pkg>writes to$SALT_EXTRAS_DIRregardless of packaging default, and the daemon's Python resolves imports from that location./opt/saltstack/salt/file mode assertion in the hardened case — spot-check a sampling of files under the tree stay owned by root.Coverage must land alongside the packaging change, not after — the default flips on 3009.0, and the LTS branches will carry the opt-in for the deprecation window, so tests exercise both branches of the gate on both branch families.
Related
#69402 /
962dd41e579— addedSALT_HOME/SALT_EXTRAS_DIRoverrides this builds on.Versions
3006.x, 3007.x, 3008.x, master.
All reactions