[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Crear archivos schema a ldiff



El 04/08/11 09:04, Federico Alberto Sayd escribió:
El 04/08/11 08:48, unoaudio@enet.cu escribió:
lista como es posible crear archivos schema a ldiff, me han dicho que hay una herramienta y se llama slapcat pero no se como usarla


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Los archivos schema y los ldiff son muy diferentes, un archivo schema describe un objeto que puede ser creado dentro de un directorio ldap, mientras que un archivo ldiff es un archivo de texto en el que se puede exportar el contenido de un directorio. Slapcat lo que hace un dumpeo de toda la información contenida en la base de datos interna de ldap y su salida es en modo ldiff.

En las últimas versiones de openldap las definiciones de objetos o schema se guardan tambén en el árbol ldap, en ese caso necesitarás una herramienta que migre la información contenida en los archivo de schema (que también son archivos de texto pero con otra sintaxis) a tu árbol ldap.

Saludos.


Extraído del siguiente enlace:
http://www.linuxquestions.org/questions/linux-server-73/how-to-add-a-new-schema-to-openldap-2-4-11-a-700452/

Adding additional schemas to slapd requires the schema to be converted to LDIF format. Fortunately, the slapd program can be used to automate the conversion. The following example will add the misc.schema:

1. First, create a conversion schema_convert.conf file containing the following lines:

include /etc/ldap/schema/core.schema
include /etc/ldap/schema/collective.schema
include /etc/ldap/schema/corba.schema
include /etc/ldap/schema/cosine.schema
include /etc/ldap/schema/duaconf.schema
include /etc/ldap/schema/dyngroup.schema
include /etc/ldap/schema/inetorgperson.schema
include /etc/ldap/schema/java.schema
include /etc/ldap/schema/misc.schema
include /etc/ldap/schema/nis.schema
include /etc/ldap/schema/openldap.schema
include /etc/ldap/schema/ppolicy.schema

2. Next, create a temporary directory to hold the output:

mkdir /tmp/ldif_output

3. Now using slaptest convert the schema files to LDIF:

slaptest -f schema_convert.conf -F /tmp/ldif_output

Adjust the configuration file name and temporary directory names if yours are different. Also, it may be worthwhile to keep the ldif_output directory around in case you want to add additional schemas in the future.

4. Edit the /tmp/ldif_output/cn=config/cn=schema/cn={8}misc.ldif file, changing the following attributes:

dn: cn=misc,cn=schema,cn=config
...
cn: misc

And remove the following lines from the bottom of the file:

structuralObjectClass: olcSchemaConfig
entryUUID: 10dae0ea-0760-102d-80d3-f9366b7f7757
creatorsName: cn=config
createTimestamp: 20080826021140Z
entryCSN: 20080826021140.791425Z#000000#000#000000
modifiersName: cn=config
modifyTimestamp: 20080826021140Z

[Note]

The attribute values will vary, just be sure the attributes are removed.

5. Finally, using the ldapadd utility, add the new schema to the directory:

ldapadd -x -D cn=admin,cn=config -f /tmp/ldif_output/cn\=config/cn\=schema/cn\=\{8\}misc.ldif

There should now be a dn: cn={4}misc,cn=schema,cn=config entry in the cn=config tree.

-------------------------------------------

Básicamente se trata de crear un archivo de configuración que apunte a todos los archivos de schema que tenemos

Luego correr el comando slaptest y como argumento el archivo creado anteriormente y un directorio donde se creará el ldiff con las definiciones de los schema en modo ldiff

Luego con ldapadd se agrega la info de los objetos contenida en el ldiff anterior al árbol ldap

Por último habla de borrar un objeto dn: cn=misc,cn=schema,cn=config, pero hasta ahí llego.

Haz las pruebas y fijate que pasa. En ningún caso se habla de usar slapcat que como ya se te comentó es para obtener datos del árbol ldap, *no* para agregar datos al directorio.

Saludos


Reply to: