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

netapi modules incompatible with eauth acl #51515

Open
NicolasT opened this issue Feb 6, 2019 · 6 comments
Open

netapi modules incompatible with eauth acl #51515

NicolasT opened this issue Feb 6, 2019 · 6 comments
Labels
Bug broken, incorrect, or confusing behavior Salt-API severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@NicolasT
Copy link

NicolasT commented Feb 6, 2019

The SaltAPI/netapi modules as shipped with Salt 2018.3.3 (rest_cherrypy and rest_tornado) contain a perms field in the response structure to a successful POST request to /login. These perms are populated by retrieving the relevant ACLs from the (master) configuration file (there's a bit of code duplication here, by the way).

However, while this works for auth modules who have ACLs specified in the configuration file, it doesn't work for auth modules that expose an acl procedure to dynamically construct ACL lists. When using such auth module, the perms field in the /login response remains empty (I believe a similar issue may occur when using process_acl like the LDAP eauth module does).

As a work-around, I created a custom netapi module (wrapping functionality of rest_cherrypy) which does fill in these fields based on the auth_list field in the token generated using self.auth.mk_token, and sets the value of perms to this list, similar to how the current code special-cases the django auth module. However, this is a hack: it requires this auth_list to be populated, which is only the case if keep_acl_in_token is true in the configuration. There seems to be no way to retrieve the ACL list from a given token in the context of a netapi module otherwise.

@Ch3LL
Copy link
Contributor

Ch3LL commented Feb 6, 2019

Can you include the salt --versions-report you are seeing this one and a use case to help replicate this issue?

@Ch3LL Ch3LL added the info-needed waiting for more info label Feb 6, 2019
@Ch3LL Ch3LL added this to the Blocked milestone Feb 6, 2019
@NicolasT
Copy link
Author

NicolasT commented Feb 6, 2019

$ salt --version-report
Salt Version:
           Salt: 2018.3.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: unknown
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Oct 30 2018, 23:45:53)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.6.1810 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-957.1.3.el7.x86_64
         system: Linux
        version: CentOS Linux 7.6.1810 Core

Anyway: Salt 2018.3.3, Python 2.7, CentOS 7 host, Salt from 'official' SaltStack repository.

Shouldn't matter much, the issue lies here:

# Grab eauth config for the current backend for the current user
(same or roughly same code in 2018.3.3)
Also discussed on #develop in the Salt Slack workspace yesterday.

To pro-actively answer other questions:

  • This is unrelated to any of my Salt states or whatever
  • This is not related to any specific action modules
  • This is related to a discrepancy between how the (e)auth framework works (salt.auth.__init__) and what netapi modules / route handlers do

If unclear, let me know.

@Ch3LL
Copy link
Contributor

Ch3LL commented Feb 14, 2019

thanks for the additional information, seems we need to fix this up for those additional modules.

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Salt-API P4 Priority 4 and removed info-needed waiting for more info labels Feb 14, 2019
@Ch3LL Ch3LL modified the milestones: Blocked, Approved Feb 14, 2019
@stale
Copy link

stale bot commented Jan 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 9, 2020
@simmel
Copy link
Contributor

simmel commented Jan 11, 2020 via email

@stale
Copy link

stale bot commented Jan 11, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 11, 2020
@sagetherage sagetherage removed the P4 Priority 4 label Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Salt-API severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

4 participants