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

Client ACL and external auth system should have support for limiting functions to certain arguments #3077

Closed
torhve opened this issue Dec 30, 2012 · 11 comments
Assignees
Labels
Core relates to code central or existential to Salt Feature new functionality including changes to functionality and code refactors, etc. ZD The issue is related to a Zendesk customer support ticket. ZRELEASED - Boron
Milestone

Comments

@torhve
Copy link
Contributor

torhve commented Dec 30, 2012

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.

@thatch45
Copy link
Contributor

wow, this will be a bit of a challenge. But I am open to it, the hard part I think will be deciding exactly how these will look in the config, since this is already the most complicated config component

@torhve
Copy link
Contributor Author

torhve commented Jan 1, 2013

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.

@thatch45
Copy link
Contributor

thatch45 commented Jan 1, 2013

Yes, I am game for adding this, but I won't be able to get to it right away.

@rallytime rallytime added the Feature new functionality including changes to functionality and code refactors, etc. label Sep 30, 2014
@thatch45 thatch45 modified the milestones: Be 0, Approved Sep 1, 2015
@basepi basepi modified the milestones: Be 0, B 12, Approved Sep 15, 2015
@basepi basepi added ZRELEASED - Boron Core relates to code central or existential to Salt labels Sep 17, 2015
@meggiebot
Copy link

Committed for Boron

@meggiebot
Copy link

ZD 411

@meggiebot meggiebot added the ZD The issue is related to a Zendesk customer support ticket. label Oct 27, 2015
@DmitryKuzmenko DmitryKuzmenko modified the milestones: B 9, Approved Oct 30, 2015
@DmitryKuzmenko DmitryKuzmenko modified the milestones: B 8, B 9 Nov 9, 2015
@DmitryKuzmenko DmitryKuzmenko modified the milestones: B 7, B 8 Nov 23, 2015
@DmitryKuzmenko
Copy link
Contributor

Here is an example of usage:

external_auth:
  pam:
    my_user:
      - '*':
        - 'my_mod.*':
          args:
            - 'a.*'
            - 'b.*'
          kwargs:
            'kwa': 'kwa.*'
            'kwb': 'kwb'

The rules:

  1. The arguments values are matched as regexp.
  2. If arguments restrictions are specified the only matched are allowed.
  3. If an argument isn't specified any value is allowed.
  4. To skip an arg use "everything" regexp .*. I.e. if arg0 and arg2 should be limited but arg1 and other arguments could have any value use:
          args:
            - 'value0'
            - '.*'
            - 'value2'

@mikepietruszka
Copy link

mikepietruszka commented Aug 11, 2016

@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+.

@thatsk
Copy link

thatsk commented May 21, 2018

can you just show one example by using any module
?

@thatsk
Copy link

thatsk commented May 21, 2018

publisher_acl:
user:
- nodename:
- test.ping
- pkg.clean_metadata
- pkg.upgrade:
args:
- 'httpd'
- 'nginx'
kwargs:

@thatsk
Copy link

thatsk commented May 21, 2018

how to use kwargs?

@rallytime
Copy link
Contributor

@thatsk Can you file a new issue about your documentation questions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core relates to code central or existential to Salt Feature new functionality including changes to functionality and code refactors, etc. ZD The issue is related to a Zendesk customer support ticket. ZRELEASED - Boron
Projects
None yet
Development

No branches or pull requests

8 participants