Skip to content

Fix non-root salt CLI when publisher_acl is configured (#65317)#69484

Merged
dwoz merged 1 commit into
saltstack:3006.xfrom
dwoz:fix/issue-65317
Jun 19, 2026
Merged

Fix non-root salt CLI when publisher_acl is configured (#65317)#69484
dwoz merged 1 commit into
saltstack:3006.xfrom
dwoz:fix/issue-65317

Conversation

@dwoz

@dwoz dwoz commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Restores non-root salt CLI access on masters running as the salt user when publisher_acl or external_auth is configured. The master now adds the world-execute bit to sock_dir and cachedir so authorised non-root users can traverse into them to reach the IPC sockets and per-user key files.

What issues does this PR fix or reference?

Fixes #65317

Previous Behavior

After upgrading to 3006.3 (where the master defaults to running as the salt user) non-root callers configured in publisher_acl lost access to the salt CLI:

$ salt '*' test.ping
[ERROR   ] Unable to connect to the salt master publisher at /var/run/salt/master
The salt master could not be contacted. Is master running?

Manually loosening sock_dir got them past that error and onto the next failure:

Authentication error occurred.

Both symptoms came from the runtime/packaging leaving /var/run/salt/master and /var/cache/salt/master mode 0o750 owned by salt:salt. The CLI's os.path.exists(publish_pull.ipc) check and check_path_traversal walk of cachedir both fail because the user has neither read nor execute on those parents.

New Behavior

When publisher_acl or external_auth is configured, the master adds the world-execute bit (no world-read) to:

  • sock_dir — done in EventPublisher.run next to the existing master_event_pub.ipc 0o660 chmod, gated on the same condition.
  • cachedir — done in salt.daemons.masterapi.access_keys next to where per-user .<user>_key files are already being created and chowned.

Directory listings stay hidden; individual sockets/files inside still rely on their own perms (master_event_pub.ipc remains 0o660 group salt, key files remain 0o600 chowned to their user). The chmod is idempotent and never narrows existing perms. Operators who have not opted into non-root usage (no publisher_acl/external_auth) see no change.

Merge requirements satisfied?

Tests

  • tests/pytests/unit/test_issue_65317_non_root_publisher_acl.py (5 cases): asserts access_keys adds o+x to cachedir when publisher_acl/external_auth is set, leaves it untouched without ACLs, preserves more-permissive existing modes, and short-circuits cleanly when cachedir is missing.
  • tests/pytests/functional/master/test_event_publisher_perms.py (2 cases): spawns the EventPublisher process and verifies sock_dir ends up with o+x when publisher_acl is configured, and is left alone otherwise.

Commits signed with GPG?

Yes

Since 3006.3 the master defaults to running as the ``salt`` user.
The runtime/packaging then leaves ``sock_dir`` and ``cachedir`` owned
by ``salt:salt`` with mode ``0o750``.  Non-root users authorised
through ``publisher_acl`` (or ``external_auth``) can no longer
traverse those directories to reach ``master_event_pub.ipc`` /
``publish_pull.ipc`` (sock_dir) or their per-user ``.<user>_key``
(cachedir), so the salt CLI fails with::

    [ERROR   ] Unable to connect to the salt master publisher at /var/run/salt/master
    Authentication error occurred.

When the operator has explicitly opted into non-root usage by
configuring ``publisher_acl`` or ``external_auth``, add the
world-execute bit to ``sock_dir`` (in ``EventPublisher.run``) and to
``cachedir`` (in ``salt.daemons.masterapi.access_keys``) so other
users can traverse without exposing directory listings.  Individual
files inside still rely on their own permissions for read/write
access; this is the same security tradeoff already in place for the
existing ``master_event_pub.ipc`` ``0o660`` chmod next to it.

Fixes saltstack#65317
@dwoz dwoz merged commit 7f2d0fd into saltstack:3006.x Jun 19, 2026
826 of 833 checks passed
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.

2 participants