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

Feature request: Add finer grained authorization for @runner, @job and @wheel in external_auth #19732

Closed
UtahDave opened this issue Jan 14, 2015 · 22 comments
Assignees
Labels
Core relates to code central or existential to Salt Feature new functionality including changes to functionality and code refactors, etc. P1 Priority 1 severity-critical top severity, seen by most users, serious issues ZD The issue is related to a Zendesk customer support ticket. ZRELEASED - 2018.3.0
Milestone

Comments

@UtahDave
Copy link
Contributor

UtahDave commented Jan 14, 2015

Consider the following config:

external_auth:
  pam:
    sarah:
      - 'test.version'
      - 'network.ip_addrs'
      - 'state.highstate'
      - '@runner'

I have pretty fine grained control over which functions Sarah can execute, but with @runner , @wheel and @job , it's a binary all or nothing.

I think it's pretty important to be able to have the same fine grained control as with execution modules.
I'm not sure exactly what that should look like, but maybe something like this?

external_auth:
  pam:
    sarah:
      - 'test.version'
      - 'network.ip_addrs'
      - 'state.highstate'
      - '@runner.myrunner.myfunction'
      - '@runner.my_other_runner.*'
      - '@wheel.key.accept'
      - '@jobs'

In the above scenario I'm allowing Sarah to execute only the myfunction function in the myrunner.py runner and any function in the my_other_runner.py runner. As well as only the accept function in the wheel's key module. (I didn't go verify that there is an accept function, but regardless, I'm sure you can see what I mean.)

@rallytime rallytime added the Feature new functionality including changes to functionality and code refactors, etc. label Jan 14, 2015
@rallytime rallytime added this to the Approved milestone Jan 14, 2015
@whiteinge
Copy link
Contributor

This would be great. There was a recent @jobs addition but there really should be granular function-level control.

@arthurzenika
Copy link
Contributor

+1

@jfroche
Copy link

jfroche commented Sep 2, 2015

That would be realy nice. (as explained in #26832: We have different teams and they would like to orchestrate deployements using salt. orchestrate runner seems like the perfect match for that but we need auth to limit/control which orchestrate sls can be run by users.)

@whiteinge
Copy link
Contributor

/cc @cachedout - relevant issue to our discussion yesterday about pattern matching on args in addition to runner/wheel functions.

@DanyC97
Copy link

DanyC97 commented Sep 3, 2015

+1

4 similar comments
@damon-atkins
Copy link
Contributor

+1

@PierreR
Copy link
Contributor

PierreR commented Sep 9, 2015

+1

@jagguli
Copy link
Contributor

jagguli commented Sep 23, 2015

+1

@danlsgiga
Copy link
Contributor

+1

@CptSupermrkt
Copy link

+1

I just spent a day getting salt-api working and understanding it, then realized if the account I'm using gets compromised, the account could use wheel to do things like alter the master config and probably a whole slew of other nasty things. This unfortunately isn't an acceptable security risk, especially when I only want the account to have access to wheel.key.gen_accept.

@whiteinge whiteinge added the Core relates to code central or existential to Salt label Jun 8, 2016
@meggiebot meggiebot added the P2 Priority 2 label Jun 8, 2016
@danlsgiga
Copy link
Contributor

Hello there... Bringing up this thread... I saw a similar feature was released in Boron (#29153) including the ability to limit args and kwargs but only to modules. Being able to do the same fine grained ACLs for runners and wheel would be totally awesome!!

@rickh563
Copy link

zd-913

@rickh563 rickh563 added the ZD The issue is related to a Zendesk customer support ticket. label Aug 24, 2016
@meggiebot meggiebot added P1 Priority 1 and removed P2 Priority 2 labels Aug 25, 2016
@bemeyert
Copy link

Hi all, what's the status here? We could really use that "feature". No one here wants to implement that in the Nginx proxy before Cherrypy in Lua.

@rickh563
Copy link

@bemeyert, this Feature-Request is under active consideration for the Spring Feature-Release of Salt.

Final decisions regarding which Feature-Requests that will be included in the Spring Feature-Release of Salt will be made in January-2017.

Regards,
Rick

@hoitsang
Copy link

hoitsang commented Dec 8, 2016

@rickh563 ... as long as it's not released under "commercial license only" do you have any news?

@rickh563
Copy link

rickh563 commented Dec 8, 2016

@hoitsang, this Feature would be delivered as part of open source Salt.
As noted above, news will exist in Januray, no later than Jan-31-2017.
-- Rick

@hoitsang
Copy link

hoitsang commented Dec 8, 2016

Thank you @rickh563! Really looking forward to it!

In the meantime I hope this hack will buy some time for everyone else, especially those of us who live at least 6 months behind the latest and greatest.

In salt/utils/minions.py:

    def wheel_check(self, auth_list, fun):
        '''
        Check special API permissions
        '''
        comps = fun.split('.')
        if len(comps) != 2:
            return False
        mod = comps[0]
        fun = comps[1]
        for ind in auth_list:
            if isinstance(ind, six.string_types):
                if ind.startswith('@') and ind[1:] == mod:
                    return True
                if ind == '@wheel':
                    return True
                if ind == '@wheels':
                    return True
                # ======================= #
                # ADD ONE MORE CHECK HERE #
                # ======================= #
                if ind == '@wheel.{0}.{1}'.format(mod, fun):
                    return True

So that at the barebone we could grant wheel module level function call

external_auth:
  ldap:
    Salt NOC Users%:
      - test.*
      - '@wheel.key.list_all'

Same story goes with runner_check() in the same module for @runner.

@UtahDave UtahDave changed the title Feature request: Add finer grained authorization for @runner and @wheel in external_auth Feature request: Add finer grained authorization for @runner, @job and @wheel in external_auth Jun 15, 2017
@rickh563
Copy link

ZD-1540

@PierreR
Copy link
Contributor

PierreR commented Jun 15, 2017

Let's make a prediction for the years to come : Oxygen -> Fluor ?

@DmitryKuzmenko
Copy link
Contributor

#42729 updates external_auth syntax to support @runner and @wheel as it's done for execution modules.

Example:

external_auth:
  pam:
    user_name:
      - @runner:  # or any of @runners, @wheel, @wheels
        - 'module.function.*regex'
        - 'module.another.*function':
          args: ['a', 'b[cde]f']
          kwargs:
            'kwa': 'kwvalue'
      # as well as
      - @module:
        - 'function.*regex':
          args: ['and', 'so', 'on']

@danlsgiga
Copy link
Contributor

Thanks a bunch for this @DmitryKuzmenko!!
Tough question: Is this PR going to land in any 2017.7 point release? Any ideas?

@rallytime
Copy link
Contributor

@danlsgiga This will be available in the next feature release, Oxygen.

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. P1 Priority 1 severity-critical top severity, seen by most users, serious issues ZD The issue is related to a Zendesk customer support ticket. ZRELEASED - 2018.3.0
Projects
None yet
Development

No branches or pull requests