Skip to content

salt-call and salt-pip honor configured user#68685

Merged
dwoz merged 2 commits intosaltstack:3006.xfrom
dwoz:salt-call-user
Mar 12, 2026
Merged

salt-call and salt-pip honor configured user#68685
dwoz merged 2 commits intosaltstack:3006.xfrom
dwoz:salt-call-user

Conversation

@dwoz
Copy link
Copy Markdown
Contributor

@dwoz dwoz commented Feb 5, 2026

Fixes #68684, #68777

  • Ensure salt-call drops privileges to the configured 'user' to prevent root-owned cache files.
  • Add --priv flag to salt-call for explicit user switching.
  • Update sudo executor to use --priv to maintain sudo_user context.
  • Ensure salt-pip drops privileges to the configured 'user' before package installation.
  • Add unit and integration tests for privilege dropping and file ownership.

@dwoz dwoz requested a review from a team as a code owner February 5, 2026 09:00
@dwoz dwoz added the test:full Run the full test suite label Feb 5, 2026
@dwoz dwoz changed the title salt-call and salt-pip honor configured user [wip] salt-call and salt-pip honor configured user Feb 5, 2026
twangboy
twangboy previously approved these changes Feb 10, 2026
twangboy
twangboy previously approved these changes Feb 25, 2026
twangboy
twangboy previously approved these changes Feb 27, 2026
dwoz added 2 commits March 11, 2026 17:01
This change ensures that Salt file and directory ownership is correctly
detected and preserved during upgrades, and that salt-call and salt-pip
correctly honor the configured user for privilege dropping.

Core Changes:
- Update salt-pip to detect the configured user and drop privileges
  when run as root, ensuring files in the onedir 'extras' directory
  maintain correct ownership.
- Update salt-call to properly distinguish between the configured
  user (for environment verification/ownership) and the execution
  user (provided via --priv), preventing accidental ownership resets
  to root when running maintenance tasks.

RPM Changes:
- Implement robust ownership detection in %pre by checking runtime PID
  files, PKI directories, and cache paths.
- Restore ownership in %post and %posttrans for all critical Salt
  paths, including the onedir installation directory (/opt/saltstack/salt)
  and extras directories.
- Fix a bug in %posttrans where upgrades were incorrectly detected as
  fresh installs. A marker file is now used for reliable state transition.
- Clean up debug logging and fix shell logic errors in the spec file.

Debian Changes:
- Prevent usermod from resetting the salt user's shell in preinst,
  ensuring salt-call and salt-pip remain functional after upgrade.
- Ensure onedir installation paths are included in ownership management.
- Update service postinst scripts to only apply default ownership on
  fresh installs, preventing resets during upgrades.

Test and Tooling Changes:
- Update Debian upgrade tests to use exact version pinning.
- Add comprehensive upgrade tests to verify ownership preservation and
  the functionality of salt-call and salt-pip under non-root configurations.
- Remove temporary relenv runtime patches from build rules.

Fixes saltstack#68684
- Add ci_build_pkg and ci_test_pkg tools to salt-test MCP server
- Generalize MCP server launcher to work across different worktrees
- Update agents documentation for package building
- Add changelog entry and update work summary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants