Se connecter avec
S'enregistrer | Connectez-vous

OpenLdap : LDAP add

Dernière réponse : dans Le monde de Linux

Bonjour,

Plutot début dans le domaine je souhaite mettre sur pied un server LDAP.

J'ai créé un fichier LDIF (LDIF_init.ldif), et lorsque je veux l'intégrer à LDAP via la commande :

ldapadd -x -D 'cn=Admin,o=tg' -W -f /etc/openldap/LDIF_init.ldif

J'ai l'erreur suivante :

  1. adding new entry "o=tg"
  2. ldap_add: Invalid syntax (21)
  3. additional info: objectclass: value #0 invalid per syntax


J'ai : Mandriva Linux release 2009.1 (Official) for i586
et : OpenLDAP 2.4.16

J'ai déjà cherché dans des doc/forum hier toute la journée mais je n'arrive pas à trouver mon erreur.

Voici mon fichier LDIF_init.ldif

  1. dn: o=tg
  2. objectclass: organization
  3. o: tg Edit the LDIF file according to the DIT.
  4.  
  5. dn:ou=people,o=tg
  6. objectclass:organizationalUnit
  7. ou:people
  8. description:People's branch
  9.  
  10. dn:ou=UnixAccounts,ou=people,o=tg
  11. objectclass:organizationalUnit
  12. ou:UnixAccounts
  13. description:Unix Accounts
  14.  
  15. dn:ou=FtpAccounts,ou=people,o=tg
  16. objectclass:organizationalUnit
  17. ou:FtpAccounts
  18. description:pureftpd accounts
  19.  
  20. dn:ou=Hosts,o=tg
  21. objectclass:organizationalUnit
  22. ou:Hosts
  23. description:The computers


Mon fichier slapd.conf

  1. # $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.8.8.6 2001/04/20 23:32:43 kurt Exp $
  2. #
  3. # See slapd.conf(5) for details on configuration options.
  4. # This file should NOT be world readable.
  5. #
  6. #
  7.  
  8. include /usr/share/openldap/schema/core.schema
  9. include /usr/share/openldap/schema/cosine.schema
  10. include /usr/share/openldap/schema/corba.schema
  11. include /usr/share/openldap/schema/inetorgperson.schema
  12. include /usr/share/openldap/schema/java.schema
  13. include /usr/share/openldap/schema/krb5-kdc.schema
  14. include /usr/share/openldap/schema/kerberosobject.schema
  15. include /usr/share/openldap/schema/openldap.schema
  16. include /usr/share/openldap/schema/autofs.schema
  17. include /usr/share/openldap/schema/samba.schema
  18.  
  19. include /etc/openldap/schema/local.schema
  20.  
  21. pidfile /var/run/ldap/slapd.pid
  22. argsfile /var/run/ldap/slapd.args
  23.  
  24. modulepath /usr/lib/openldap
  25.  
  26. # To allow TLS-enabled connections, create /etc/ssl/openldap/ldap.pem
  27. # and uncomment the following lines.
  28. #TLSRandFile /dev/random
  29. #TLSCipherSuite HIGH:MEDIUM:+SSLv2
  30. TLSCertificateFile /etc/ssl/openldap/ldap.pem
  31. TLSCertificateKeyFile /etc/ssl/openldap/ldap.pem
  32. #TLSCACertificatePath /etc/ssl/openldap/
  33. #TLSCACertificateFile /etc/ssl/cacert.pem
  34. TLSCACertificateFile /etc/ssl/openldap/ldap.pem
  35. #TLSVerifyClient never # ([never]|allow|try|demand)
  36.  
  37. #######################################################################
  38. # database definitions
  39. #######################################################################
  40.  
  41. database bdb
  42. suffix "o=tg"
  43. rootdn "cn=admin,o=tg"
  44. rootpw {SSHA}dIlg1am4K2cvQTiKpuR6gzuVEaEf/7UZ
  45.  
  46. # Cleartext passwords, especially for the rootdn, should
  47. # be avoided. See slappasswd(8) and slapd.conf(5) for details.
  48. # Use of strong authentication encouraged.
  49. # rootpw secret
  50. # rootpw {crypt}ijFYNcSNctBYg
  51.  
  52. # The database directory MUST exist prior to running slapd AND
  53. # should only be accessable by the slapd/tools. Mode 700 recommended.
  54. directory /var/lib/ldap
  55.  
  56. access to attr=userPassword
  57. by self write
  58. by anonymous auth
  59. by dn="cn=admin,o=tg" write
  60. by * none
  61.  
  62. access to *
  63. by self write
  64. by dn="cn=admin,o=tg" write
  65. by * read


Et mon fichier ldap.conf

  1. # $OpenLDAP: pkg/ldap/libraries/libldap/ldap.conf,v 1.9 2000/09/04 19:57:01 kurt Exp $
  2. #
  3. # LDAP Defaults
  4. #
  5.  
  6. # See ldap.conf(5) for details
  7. # This file should be world readable but not world writable.
  8.  
  9. BASE "o=tg"
  10. HOST 127.0.0.1
  11. URI ldap://127.0.0.1
  12.  
  13. #SIZELIMIT 12
  14. #TIMELIMIT 15
  15. #DEREF never
  16.  
  17. # SSL/TSL configuration. With CA-signed certs, TLS_REQCERT should be
  18. # "demand", with the CA certificate accessible
  19. #TLS_CACERT /etc/ssl/cacert.pem
  20. #TLS_CACERTDIR /etc/ssl/openldap
  21. #TLS_REQCERT ([demand],never,allow,try)
  22. TLS_REQCERT allow



Si quelqu"un à une idée pour me mettre sur la voie ça m'aidrai énormément car je sèche.

Merci

Olivier

Autres pages sur : openldap ldap add

Lassé par la pub ? Créez un compte

Exacte, mais si le problème venait de là j'aurais l'erreur suivante :

  1. ldap_bind: Invalid credentials (49)


J'ai néanmoins essayé avec :

ldapadd -x -D 'cn=admin,o=tg' -W -f /etc/openldap/LDIF_init.ldif

Mais toujours la même erreur...

Merci quand même.

Bonjour,

Merci pour ton aide (je ne connaissais pas le cat, mais c'est très utile !)

Le problème venait bien du mon fichier LDIF. Voici les modifications que j'ai du faire pour que cela fonctionne :

Original

  1. dn: o=tg
  2. objectclass: organization
  3. o: tg


Modifié

  1. dn: o=tg
  2. objectclass: organization
  3. o: tg


J'avais des espaces après "organization" et "tg" .... Je n'avais pas pensé à vérifier ...
J'étais allé chercher partout sauf ici ;) 

Bonne journée
Lassé par la pub ? Créez un compte