You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
whitelist_modules on the minion blocks internal module composition, forcing all-or-nothing security #69983
Salt has a whitelist_modules setting on the minion that restricts which
execution modules a remote caller can invoke. It looks like exactly what you
want when you don't fully trust the master and only need to expose a small
surface (say test.ping, saltutil.sync_*, and a couple of company modules).
In practice it's unusable, because almost every built-in Salt module reaches
for cmd (or config, grains, pillar, etc.) internally via __salt__[...].
If you whitelist your custom module but not cmd, your module fails at runtime
even though the caller never asked for cmd.
Example
# /etc/salt/minionwhitelist_modules:
- test
- mycompany
- saltutil
salt '*' mycompany.deploy fails, because mycompany.deploy internally does __salt__['cmd.run'](...). Two bad options remain:
Add cmd to the whitelist — now the master can also publish salt '*' cmd.run 'rm -rf /', so the whitelist stopped protecting anything.
Rewrite the module to bypass the loader (import salt.modules.cmdmod) —
ugly, and it defeats other loader-level checks too.
History
Same trap has been reported twice and closed with no fix:
Disabling cmd module causes connection error to master #52592 (2019) — "Disabling cmd module causes connection error to master".
Maintainer reply: "Many parts of salt use the cmd module... it would be
hard to now allowing the cmd module to load". Suggested workaround was publisher_acl_blacklist on the master, which is coarse (all-or-nothing
per host) and master-side.
whitelist_modules should only restrict what a remote caller can invoke.
Modules calling each other via __salt__ should keep working. This is the
intent behind the feature but was never fully delivered.
Whitelisted modules can still call any other module via __salt__ (so mycompany.deploy keeps working with cmd.run off the whitelist)
Direct remote publish of a non-whitelisted module is still refused
Combined with the existing cmd_blacklist_glob (which lets you additionally
block specific command strings like *rm -rf*), this closes both the
coarse-grained ("keep cmd off the wire") and fine-grained ("block this
specific command") halves of the ask in #52592.
Activity
Make whitelist_modules only apply to remote dispatch
Make whitelist_modules only apply to remote dispatch
Make whitelist_modules only apply to remote dispatch
Make whitelist_modules only apply to remote dispatch
Fix semantic regressions from merge-forward missed by per-file agents
Complete the whitelist_modules two-loader model across the state stack
Complete the whitelist_modules two-loader model across the state stack
Complete the whitelist_modules two-loader model across the state stack
Add functional coverage for scheduler two-loader model
Route scheduler internal helpers through unfiltered inner loader
Add functional coverage for scheduler two-loader model
Route beacons, engines, and sys.doc through unfiltered inner loader
Add end-to-end tests for whitelist_modules exec-dispatch dichotomy
Add end-to-end tests for whitelist_modules exec-dispatch dichotomy (#…