First step toward OpenLDAP

After getting some revelation from the Big Bro, I finally able to create my own entry 😀

Here’s a few things to do :

  1. Do some config here and there
    Here we have to edit ldap.conf and slapd.conf in /etc/openldap.
    In ldap.conf, we modify URI to point to our LDAP server and Base to point to the root of our LDAP structure. Usually the base is like this

    Base dc=Example, dc=com

    In slapd.conf, we modify the database (we use bdb), suffix (same with the base in ldap), rootdn (in the example they use cn=manager, so the entry would be like this

    rootdn "cn=manager,  dc=Example, dc=com"

    rootpw is the password for the rootdn, mind the password-hash. Read man slapd.conf to know more about the password-hash

  2. Create an .ldif file (Mine looks like this, except I only used one dc. Forgive me if this one is inaccurate)

    dn: o=Example Indonesia, dc=Example, dc=com
    objectClass: top
    objectClass: organization
    o: Example Indonesia
    dc: Example

    dn: ou=Vendor, o=Example Indonesia, dc=Example, dc=com
    objectClass: top
    objectClass: organizationalUnit
    ou: Vendor
    description: project vendor

    dn: uid=baca, ou=Vendor, o=Example Indonesia, dc=Example, dc=com
    objectClass: top
    objectClass: person
    objectClass: organizationalPerson
    objectClass: inetOrgPerson
    cn: Suka Mbaca
    sn: Mbaca
    givenName: Suka
    ou: Vendor
    uid: baca
    mail: sampah@email.com

    this will create user baca under unit Vendor in organization Example Indonesia. We follow basic schema built in openldap. Custom schema can be added by creating .schema files.

  3. run ldapadd -x -D "cn=manager,dc=example,dc=com" -W -f example.ldif
    Example.ldif is the .ldif file we created earlier. The command will add those entries in the file to the ldap.
Advertisements

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: