My use case is that I want to limit a certain PAM user to control his own virtual machine using the virt module. The virt module often takes the VM name as the argument.
Example:
salt-call virt.destroy VMName
But if I give a user access to the virt.destroy function, the user could then destroy all VMs on the host.
What would solve it is support for checking arguments to function, for example like this:
external_auth:
pam:
vmuser:
- virt.destroy:
arg0: VMName
I'm not sure how the arg-system should work, but should probably include support for regexes, or at the very least a static list of allowed arguments.
wow,
Since my use case is mostly relevant to the API, it could be solved in salt API instead of here, but I guess the feature would be useful for all salt clients, not just the API. But maybe the API would/could have additional checks ?
My final resort would be to filter this in nginx proxy, using lua to check all the args. Would be very easy to implement.
Yes, I am game for adding this, but I won't be able to get to it right away.
Committed for Boron
ZD 411
Here is an example of usage:
external_auth:
pam:
my_user:
- '*':
- 'my_mod.*':
args:
- 'a.*'
- 'b.*'
kwargs:
'kwa': 'kwa.*'
'kwb': 'kwb'
The rules:
.*. I.e. if arg0 and arg2 should be limited but arg1 and other arguments could have any value use: args:
- 'value0'
- '.*'
- 'value2'
@DmitryKuzmenko Does this work for client_acl as well, or just external_auth?
Edit: Actually just saw that this is for external_auth only and works in 2016.3.0+.
can you just show one example by using any module
?
publisher_acl:
user:
- nodename:
- test.ping
- pkg.clean_metadata
- pkg.upgrade:
args:
- 'httpd'
- 'nginx'
kwargs:
how to use kwargs?
@thatsk Can you file a new issue about your documentation questions?
Most helpful comment
Here is an example of usage:
The rules:
.*. I.e. ifarg0andarg2should be limited butarg1and other arguments could have any value use: