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

rdn=uid err="no such RDN in DN #670

Open
azdfzshffg opened this issue Oct 22, 2024 · 2 comments
Open

rdn=uid err="no such RDN in DN #670

azdfzshffg opened this issue Oct 22, 2024 · 2 comments

Comments

@azdfzshffg
Copy link

azdfzshffg commented Oct 22, 2024

Bonjour,

Je rencontre un problème à l'utilisation de ldap2pg
Celui-ci ne fonctionne pas dès lors que l'on utilise le rdn '{uid}', pourtant l'attribut est standard dans notre openldap.
voici l'erreur:

15:06:00 INFO   Starting ldap2pg                                 version=6.2 runtime=go1.23.1 commit=c0d1af5b pid=2752501
15:06:00 INFO   Using YAML configuration file.                   path=/etc/ldap2pg.yml
15:06:00 WARN   Dry run. Postgres instance will be untouched.
15:06:00 INFO   Running as superuser.                            user=postgres super=true server="PostgreSQL 14.13" cluster=test_ldap2pg database=postgres
15:06:00 INFO   Connected to LDAP directory.                     uri=ldap://xxxxx.xxxx
15:06:00 INFO   Setup static roles and grants.
15:06:00 WARN   Failed to read value from DN.                    dn="cn=ATECNA-DEV\\2C ATECNA-DEV,ou=Personne,o=clients-test,dc=test,dc=fr" rdn=uid err="no such RDN in DN"
15:06:00 INFO   All roles synchronized.
15:06:00 INFO   All privileges configured.                       database=postgres
15:06:00 INFO   All default privileges configured.               database=postgres
15:06:00 INFO   All privileges configured.                       database=test_ldap2pg
15:06:00 INFO   All default privileges configured.               database=test_ldap2pg
15:06:00 INFO   All privileges configured.                       database=template1
15:06:00 INFO   All default privileges configured.               database=template1
15:06:00 INFO   Nothing to do.                                   searches=1 roles=2 queries=0 grants=28
15:06:00 INFO   Done.                                            elapsed=82.079468ms mempeak=1.2MiB ldap=2.408749ms inspect=15.858509ms sync=0s

Voici le user ldap:

dn: cn=ATECNA-DEV\2C ATECNA-DEV,ou=Personne,o=clients-test,dc=test,dc=fr
cn: ATECNA-DEV, ATECNA-DEV
displayName: ATECNA-DEV, ATECNA-DEV
employeeNumber: 0699
employeeType: statutaire
givenName: ATECNA-DEV
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: inetUser
objectClass: person
objectClass: top
objectClass: pwmUser
sn: ATECNA-DEV
title: M
uid: atecna-dev
structuralObjectClass: inetOrgPerson
mail: [email protected]
userPassword:
entryDN: cn=ATECNA-DEV\2C ATECNA-DEV,ou=Personne,o=clients-test,dc=test,dc=fr
subschemaSubentry: cn=Subschema
hasSubordinates: FALSE
authTimestamp: 20240513134744Z
o: PRESTA-SAS

version: 6

postgres:
  roles_blacklist_query: [postgres, nrpe , pg_*, postgres_exporter, prepro_* ,postgres_export]
  database_query: [postgres,test_ldap2pg]

privileges:
  ro:
  - __connect__
  - __select_on_tables__
  - __select_on_sequences__
  - __usage_on_schemas__
  - __usage_on_types__

rules:
- description: "Setup static roles and grants."
  roles:
  - names: readers
    options: NOLOGIN

  grant:
  - privilege: ro
    role: readers

- ldapsearch:
    base: "ou=Personne,o=clients-test,dc=test,dc=fr"
    filter: "(uid=atecna-dev)"
  role:
    name: "{uid}"
    options:
      LOGIN: yes
    parent: "readers"
    after_create: alter role "{uid}"  set search_path to test;

Expectations

  • What you expected from ldap2pg ?
    -Je m'attendais à avoir une création du user en question "atecna-dev"

  • What ldap2pg did wrong ?
    Il retourne une erreur rdn=uid err="no such RDN in DN"

@bersace
Copy link
Member

bersace commented Nov 4, 2024

Bonjour,

Effectivement, le DN utilise CN= et non UID=. Il faudrait que ldap2pg accède à l'attribut uid: ... plutôt qu'au RDN uid=....

C'est une évolution de ldap2pg à étudier et implémenter.

Note, je trouve très très étrange d'avoir une virgule dans le CN. Comment en êtes vous arrivé là ?

@azdfzshffg
Copy link
Author

azdfzshffg commented Nov 4, 2024

C'est un logiciel qui créé le DN en se basant sur "NOM, Prénom" du compte.
Malheureusement, ceci est historique et non standard mais c'est bien normal d'en trouver..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants