Ldap_add: Invalid syntax (21)

Résolu
olikamm Messages postés 18 Statut Membre -  
foobar47 Messages postés 13654 Statut Contributeur -
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 :

adding new entry "o=tg"
ldap_add: Invalid syntax (21)
        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

dn: o=tg
objectclass: organization 
o: tg Edit the LDIF file according to the DIT. 

dn:ou=people,o=tg
objectclass:organizationalUnit
ou:people
description:People's branch

dn:ou=UnixAccounts,ou=people,o=tg
objectclass:organizationalUnit
ou:UnixAccounts
description:Unix Accounts

dn:ou=FtpAccounts,ou=people,o=tg
objectclass:organizationalUnit
ou:FtpAccounts
description:pureftpd accounts

dn:ou=Hosts,o=tg
objectclass:organizationalUnit
ou:Hosts
description:The computers


Mon fichier slapd.conf

# $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.8.8.6 2001/04/20 23:32:43 kurt Exp $
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
#

include /usr/share/openldap/schema/core.schema
include /usr/share/openldap/schema/cosine.schema
include /usr/share/openldap/schema/corba.schema
include /usr/share/openldap/schema/inetorgperson.schema
include /usr/share/openldap/schema/java.schema
include /usr/share/openldap/schema/krb5-kdc.schema
include /usr/share/openldap/schema/kerberosobject.schema
include /usr/share/openldap/schema/openldap.schema
include /usr/share/openldap/schema/autofs.schema
include /usr/share/openldap/schema/samba.schema

include /etc/openldap/schema/local.schema

pidfile         /var/run/ldap/slapd.pid
argsfile        /var/run/ldap/slapd.args

modulepath      /usr/lib/openldap

# To allow TLS-enabled connections, create /etc/ssl/openldap/ldap.pem
# and uncomment the following lines.
#TLSRandFile            /dev/random
#TLSCipherSuite         HIGH:MEDIUM:+SSLv2
TLSCertificateFile      /etc/ssl/openldap/ldap.pem
TLSCertificateKeyFile   /etc/ssl/openldap/ldap.pem
#TLSCACertificatePath   /etc/ssl/openldap/
#TLSCACertificateFile    /etc/ssl/cacert.pem
TLSCACertificateFile    /etc/ssl/openldap/ldap.pem
#TLSVerifyClient never # ([never]|allow|try|demand)

#######################################################################
# database definitions
#######################################################################

database        bdb
suffix          "o=tg"
rootdn          "cn=admin,o=tg"
rootpw          {SSHA}dIlg1am4K2cvQTiKpuR6gzuVEaEf/7UZ

# Cleartext passwords, especially for the rootdn, should
# be avoided.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
# rootpw                secret
# rootpw                {crypt}ijFYNcSNctBYg

# The database directory MUST exist prior to running slapd AND
# should only be accessable by the slapd/tools. Mode 700 recommended.
directory       /var/lib/ldap

access to attr=userPassword
        by self write
        by anonymous auth
        by dn="cn=admin,o=tg" write
        by * none

access to *
        by self write
        by dn="cn=admin,o=tg" write
        by * read


Et mon fichier ldap.conf

# $OpenLDAP: pkg/ldap/libraries/libldap/ldap.conf,v 1.9 2000/09/04 19:57:01 kurt Exp $
#
# LDAP Defaults
#

# See ldap.conf(5) for details
# This file should be world readable but not world writable.

BASE    "o=tg"
HOST    127.0.0.1
URI     ldap://127.0.0.1

#SIZELIMIT      12
#TIMELIMIT      15
#DEREF          never

# SSL/TSL configuration. With CA-signed certs, TLS_REQCERT should be
# "demand", with the CA certificate accessible
#TLS_CACERT      /etc/ssl/cacert.pem
#TLS_CACERTDIR  /etc/ssl/openldap
#TLS_REQCERT    ([demand],never,allow,try)
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
Configuration: Mandriva Linux release 2009.1 (Official) for i586
OpenLDAP 2.4.16

10 réponses

  1. olikamm Messages postés 18 Statut Membre 6
     
    Bonjour,

    Merci pour ton aide, j'ai trouvé la solution grâce à un cat :
    (cat -vte /etc/openldap/LDIF_init.ldif )

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

    Original

    dn: o=tg
    objectclass: organization
    o: tg

    Modifié

    dn: o=tg
    objectclass: organization
    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.

    Cela ne pose donc pas de problème d'utilisé des "o" et non des "dc" ;)

    Bonne journée
    6
  2. foobar47 Messages postés 13654 Statut Contributeur 534
     
    Justement, c'est quoi le domaine ?

    par exemple : dc=domaine,dc=com
    1
  3. foobar47 Messages postés 13654 Statut Contributeur 534
     
    J'ai rarement vu un LDAP qui s'appuie uniquement sur un o
    Je peux me tromper, mais tu devrais créer une base dc=mondomaine
    1
  4. foobar47 Messages postés 13654 Statut Contributeur 534
     
    Bonjour,

    Tu n'as pas de base dc ?
    0
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. olikamm Messages postés 18 Statut Membre 6
     
    Salut,

    Mon serveur fait aussi Domain Controleur, J'ai installé un Samba dessus, et des ordinateurs arrivent à se connecter au domaine...
    0
  7. olikamm Messages postés 18 Statut Membre 6
     
    Voila :

    netbios name = MYSAMBA
    workgroup = SAMBA
    server string = Serveur Samba %v

    Merci
    0
  8. foobar47 Messages postés 13654 Statut Contributeur 534
     
    Un LDAP s'appuie sur une base, quelle est cette base ?
    0
  9. olikamm Messages postés 18 Statut Membre 6
     
    Dans mon fichier slapd.conf j'ai définis comme ceci ;

    database bdb
    suffix "o=tg"
    rootdn "cn=admin,o=tg"

    Puis j'ai créé mon fichier LDIF et enfin j'ai fais ma commande "ldapadd".

    Et il me semblait qu'il créait la base à ce moment là ? Non ?
    0
  10. olikamm Messages postés 18 Statut Membre 6
     
    Ok je te remercie, je vais modifier cela demain matin et tester. Je reposterai afin de te tenir au courant !

    Olivier
    0
  11. foobar47 Messages postés 13654 Statut Contributeur 534
     
    ok, bonne journée alors...
    0