Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-check for user permissions before sending command to salt-api #22

Open
arthurzenika opened this issue Jan 30, 2015 · 1 comment
Labels
Milestone

Comments

@arthurzenika
Copy link
Contributor

At some point in testing, I was quite surprised to find :

$ pepper -H -v '*' cmd.run 'whoami'
{u'perms': [u'test.ping'], u'start': 1422612427.829301, u'token': u'318dec9ad3007ccbc978f2dea72bf285e0b0f8ae', u'expire': 1422655627.829302, u'user': u'saltdev', u'eauth': u'pam'}
{u'return': [{u'jid': u'20150130110707846297', u'minions': [u'ursa', u'cetus.logilab.priv']}]}
{
    "cetus.logilab.priv": "root", 
    "ursa": "root"
}

Investigating further made me understand that the one enforcing the policy was salt-master and since I had not restarted the salt-master (but only salt-api) between changing from '.*' to 'test.ping' in the external_auth, it would return results for a cmd.run query.

Could I argue that every intermediary (pepper or any webapp and salt-api) should look at the permissions before trying to run them ? Is this what was meant for when returning the "perms" information when on logs in ?

Am heading to salt issue tracker to add an issue for this one as well.

@whiteinge
Copy link
Contributor

The perms return after logging in is intended for consumption by clients of the REST API so they can provide a more user-friendly experience. It is decidedly not intended for any kind of security.

As a real-world example, a web UI could use the perms output to only display or auto-complete function names the current user has permission to run. It makes sense to add something similar to Pepper (probably requiring #4). That would allow Pepper to quickly perform a pre-flight check before sending any comparatively slow HTTP requests only to arrive at the same 'denied' answer.

I am marking this as a feature addition and will edit the issue title to coincide.

@whiteinge whiteinge added this to the Approved for future release milestone Jan 30, 2015
@whiteinge whiteinge changed the title [security] pepper or salt-api could filter commands based on permissions Add pre-check for user permissions before sending command to salt-api Jan 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants