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

ldap.managed does not handle operational attributes #53364

Open
fpicot opened this issue Jun 4, 2019 · 3 comments
Open

ldap.managed does not handle operational attributes #53364

fpicot opened this issue Jun 4, 2019 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE severity-high 2nd top severity, seen by most users, causes major problems

Comments

@fpicot
Copy link

fpicot commented Jun 4, 2019

Description of Issue

It doesn't seem possible to handle operational attributes through ldap.managed. This makes impossible to managed things like the schema or the ACIs.

Setup

test.sls

ldap_aci:
  ldap.managed:
    - connect_spec:
        url: ldap://127.0.0.1:389/
        bind:
          method: simple
          dn: <bind dn>
          password: <password> 
    - entries:
      - ou=test_ou,dc=customers,dc=contoso,dc=com:
        - add:
            aci:
              - (target="ldap:///ou=test_ou,dc=customers,dc=contoso,dc=com")(targetattr=*)(version 3.0; acl "Test ACI"; allow (all) userdn="ldap:///dc=customers,dc=contoso,dc=com??sub?(ou=admins)";)

Steps to Reproduce Issue

First run :

          ID: ldap_aci
    Function: ldap.managed
      Result: True
     Comment: Successfully updated LDAP entries
     Started: 10:35:51.097713
    Duration: 14.805 ms
     Changes:
              ----------
              ou=test_ou,dc=customers,dc=contoso,dc=com:
                  ----------
                  new:
                      ----------
                      aci:
                          - (target="ldap:///ou=test_ou,dc=customers,dc=contoso,dc=com")(targetattr=*)(version 3.0; acl "Test ACI"; allow (all) userdn="ldap:///dc=customers,dc=contoso,dc=com??sub?(ou=admins)";)
                  old:
                      ----------

Second run, test=True

          ID: ldap_aci
    Function: ldap.managed
      Result: None
     Comment: Would change LDAP entries
     Started: 10:36:45.861559
    Duration: 7.419 ms
     Changes:
              ----------
              ou=test_ou,dc=customers,dc=contoso,dc=com:
                  ----------
                  new:
                      ----------
                      aci:
                          - (target="ldap:///ou=test_ou,dc=customers,dc=contoso,dc=com")(targetattr=*)(version 3.0; acl "Test ACI"; allow (all) userdn="ldap:///dc=customers,dc=contoso,dc=com??sub?(ou=admins)";)
                  old:
                      ----------

Second run, test=False

    Function: ldap.managed
      Result: False
     Comment: failed to modify entry ou=test_ou,dc=customers,dc=contoso,dc=com(exception in ldap backend: TYPE_OR_VALUE_EXISTS({'desc': 'Type or value exists'},))
     Started: 10:36:01.201478
    Duration: 22.851 ms
     Changes:

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version:
           Salt: 2018.3.4

Dependency Versions:
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: 1.5
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Nov  1 2018, 03:12:47)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.3.1
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 3.2.5

System Versions:
           dist: oracle 7.6
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-862.11.6.el7.x86_64
         system: Linux
        version: Oracle Linux Server 7.6

@fpicot
Copy link
Author

fpicot commented Jun 4, 2019

This should be fairly easy to fix by conditionally passing "attrlist=[b'+']" to ldap3.search.
The condition would a new state parameter "operational_attrs", defaulting to false.
I'll submit a PR later today

@cmcmarrow cmcmarrow added this to the Approved milestone Jun 4, 2019
@cmcmarrow cmcmarrow added Feature new functionality including changes to functionality and code refactors, etc. Bug broken, incorrect, or confusing behavior and removed Feature new functionality including changes to functionality and code refactors, etc. labels Jun 4, 2019
@stale
Copy link

stale bot commented Jan 8, 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 8, 2020
@waynew waynew added the Confirmed Salt engineer has confirmed bug/feature - often including a MCVE label Jan 8, 2020
@stale
Copy link

stale bot commented Jan 8, 2020

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

@stale stale bot removed the stale label Jan 8, 2020
@sagetherage sagetherage added Phosphorus v3005.0 Release code name and version severity-high 2nd top severity, seen by most users, causes major problems labels Jun 15, 2021
@sagetherage sagetherage modified the milestones: Approved, Phosphorus Jun 15, 2021
@Ch3LL Ch3LL removed the Phosphorus v3005.0 Release code name and version label Mar 30, 2022
@anilsil anilsil removed this from the Chlorine v3007.0 milestone May 11, 2023
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 Confirmed Salt engineer has confirmed bug/feature - often including a MCVE severity-high 2nd top severity, seen by most users, causes major problems
Projects
None yet
Development

No branches or pull requests

6 participants