Search code examples
ldapschemaopenldapldif

openldap - cannot create ldif file from schema file


I'm trying to add my own schema to OpenLDAP, but when I convert .schema -> .ldif using slaptest, there's nothing in the destination directory except for some default schemas. Mine is not being created. I added the path to slapd.conf. I'm creating the .schema file via Apache Directory Studio:

attributetype ( 2.0.0.0.1 
    NAME 'objectName'
    DESC ''
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
attributetype ( 2.0.0.0.2 
    NAME 'editableObject'
    DESC ''
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    USAGE userApplications )
attributetype ( 2.0.0.0.3 
    NAME 'mailDesc'
    DESC ''
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    USAGE userApplications )
attributetype ( 2.0.0.0.4 
    NAME 'visibleObject'
    DESC ''
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    USAGE userApplications )
attributetype ( 2.0.0.0.5 
    NAME 'objectDesc'
    DESC ''
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
    USAGE userApplications )
objectclass ( 2.0.0.1.1 
    NAME 'myObject'
    DESC ''
    SUP top
    AUXILIARY
    MAY ( objectName $ objectDesc ) )
objectclass ( 2.0.0.1.2 
    NAME 'myRole'
    DESC ''
    AUXILIARY
    MAY ( editableObject $ visibleObject ) )
objectclass ( 2.0.0.1.3 
    NAME 'myUser'
    DESC ''
    AUXILIARY
    MAY ( editableObject $ visibleObject $ mailDesc ) )

Do you have any ideas why there is no .ldif file?


Solution

  • I'm trying to add my own schema to OpenLDAP, but when I convert .schema -> .ldif using slaptest, there's nothing in the destination directory except for some default schemas.

    slaptest did exactly what you described : convert schema to ldif. You never added the ldif to the directory. (In any way slaptest can add the ldif to the directory, as hinted by the command name, it is to make tests, not to modify the directory)

    Mine is not being created.

    The LDIF has been created, it is just not added to the directory

    I added the path to slapd.conf

    There is no slapd.conf to use for OpenLDAP configuration since years. You have to use the cn=config branch to do so

    I'm creating the .schema file via Apache Directory Studio

    As stated above, .schema files were used by the old OpenLDAP configuration system. Now you have to use the cn=config branch

    For more informations :

    • The schemas are stored inside the cn=config branch at : cn=schema,cn=config
    • To add you schema you have to add an entry like : cn={x}myschema,cn=schema,cn=config which contains an ldif like for example :
        dn: cn={4}myschema,cn=schema,cn=config
        objectClass: olcSchemaConfig
        cn: {4}myschema
        olcAttributeTypes: {0}( 0.0.0.0.0.1.1 NAME 'code' DESC 'Some code identificati
         on' SUP description )
        olcAttributeTypes: {1}( 0.0.0.0.0.1.2 NAME ( 'latitude' 'lat' ) DESC 'Latitude
         ' SUP description )
        olcObjectClasses: {5}( 0.0.0.0.0.2.6 NAME 'groupCustom' DESC 'A group of nam
         es (DNs) with optionnal member attribute' SUP top STRUCTURAL MUST ( cn ) MAY 
         ( member $ seeAlso $ owner $ description ) )
        olcObjectClasses: {6}( 0.0.0.0.0.2.7 NAME 'groupDynamic' DESC 'A DYNAMIC g
         roup of names (DNs) with optionnal member attribute' SUP top STRUCTURAL MUST 
         ( cn $ dynListURL ) MAY ( member $ seeAlso $ owner $ description  ) )
    

    Note : This example is the result of a slapcat and in no way the LDIF describing the ldapadd operation to perform to add the schema to the directory. But you still can import it with Apache Directory Studio if you do not want to write the LDIF to use with the ldapadd operation

    For more information, consider reading http://www.zytrax.com/books/ldap/ch6/slapd-config.html#use-schemas