openldap

OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol.

http://www.openldap.org/

SlackBuild

Package 32 bit: openldap-2.4.35-i486-1_VBo.tgz

Contents of openldap.SlackBuild

   1 #!/bin/sh -e
   2 # Adapted from http://www.slackwiki.com/Writing_A_SlackBuild_Script
   3 # V.B. revision date 2013/06/13
   4 # Set initial variables:
   5 CWD=$(pwd)
   6 if [ "$TMP" = "" ]; then
   7   TMP=/tmp
   8 fi
   9 
  10 VERSION=2.4.35 # The version which appears in the application's filename
  11 PKG_VERSION=2.4.35 # the version which appears in the package name. 
  12 ARCH=${ARCH:-i486} # the architecture on which you want to build your package
  13 BUILD=${BUILD:-1_VBo}
  14 APP=openldap # The application's name
  15 PKG=$TMP/package-$APP # The installation directory of the package
  16 
  17 # set SLACKFLAGS
  18 if [ "$ARCH" = "i486" ]; then
  19   SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  20  elif [ "$ARCH" = "x86_64" ]; then
  21   SLKCFLAGS="-O2 -fPIC"
  22 fi
  23 
  24 ### Extract Sources 
  25 # Delete the leftover directories if they exist (due to a previous build)
  26 # and (re)create the packaging directory
  27 rm -rf $PKG 
  28 mkdir -p $TMP $PKG
  29 rm -rf $TMP/$APP-$VERSION
  30 cd $TMP || exit 1 # Change to the TMP directory
  31 tar -xvzf $CWD/$APP-$VERSION.tgz || exit 1 # Extract the application source in TMP
  32 cd $APP-$VERSION || exit 1 # Change to the application source directory
  33 # Change ownership and permissions if necessary
  34 # This may not be needed in some source tarballs, but it never hurts
  35 chown -R root:root .
  36 chmod -R u+w,go+r-w,a-s .
  37 
  38 ### Configure and Compile Sources
  39 # To check configure available options run ./configure --help                                                                               
  40 # Set configure options                                                                                                                     
  41 # If your app is written in C++, you'll also need to add a line for CXXFLAGS                                                                
  42 CFLAGS="$SLKCFLAGS" \                                                                                                                       
  43   ./configure \                                                                                                                             
  44   --prefix=/usr \                                                                                                                           
  45   --sysconfdir=/etc \                                                                                                                       
  46   --localstatedir=/var \                                                                                                                    
  47   --build=$ARCH-slackware-linux \
  48   --host=$ARCH-slackware-linux 
  49 
  50 # compile the source, but exit if anything goes wrong
  51 make depend || exit #openldap requires make depend
  52 make || exit
  53  
  54 # Install everything into the package directory, but exit if anything goes wrong
  55 make install DESTDIR=$PKG || exit
  56 
  57 ### Install Documentation
  58 # Create a directory for documentation
  59 mkdir -p $PKG/usr/doc/$APP-$VERSION
  60 # Copy documentation to the docs directory and fix permissions
  61 # inside the source folder there are the files CHANGES LICENSE INSTALL README ANNOUNCEMENT COPYRIGHT
  62 cp -a CHANGES LICENSE INSTALL README ANNOUNCEMENT COPYRIGHT $PKG/usr/doc/$APP-$VERSION
  63 find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \;
  64 
  65 ### Final Touches
  66 # Create the ./install directory and copy the slack-desc into it
  67 mkdir -p $PKG/install
  68 cat $CWD/slack-desc > $PKG/install/slack-desc
  69 # Add doinst.sh to package (if it exists)
  70 if [ -e $CWD/doinst.sh.gz ]; then
  71   zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
  72 fi
  73 # Strip some libraries and binaries
  74 ( cd $PKG
  75    find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  76    find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  77 )
  78 # Compress man pages if they exist
  79 if [ -d $PKG/usr/man ]; then
  80   ( cd $PKG/usr/man
  81   find . -type f -exec gzip -9 {} \;
  82   for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
  83   ) 
  84 fi
  85 # Compress info pages if they exist (and remove the dir file)
  86 if [ -d $PKG/usr/info ]; then
  87   gzip -9 $PKG/usr/info/*.info
  88   rm -f $PKG/usr/info/dir
  89 fi
  90 
  91 ### Build the Package
  92 cd $PKG
  93 /sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz

Contents of slack-desc

# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

       |-----handy-ruler------------------------------------------------------|
openldap: OpenLDAP 
openldap:
openldap: Open source implementation of the Lightweight Directory Access 
openldap: Protocol.
openldap:
openldap: The suite includes: 
openldap:  slapd - stand-alone LDAP daemon (server) 
openldap:  libraries implementing the LDAP protocol, and utilities, tools, 
openldap:  and sample clients. 
openldap:
openldap: Homepage: http://www.openldap.org/

Configuration

Add LDIF to LDAP:

Queries:

Contents of /etc/openldap/slapd.conf:

include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema

database bdb
suffix  "dc=example,dc=net"
rootdn  "cn=Manager,dc=example,dc=net"
rootpw secret
directory /var/openldap-data

Contents of organization.ldif:

dn: dc=example,dc=net
objectclass: dcObject
objectclass: organization
o: AcmeCorp 
dc: example

Contents of manager.ldif:

dn: cn=Manager,dc=example,dc=net
objectclass: organizationalRole
cn: Manager

Contents of groups.ldif:

dn: ou=Developers,dc=example,dc=net
objectclass: organizationalUnit
ou: Developers

dn: ou=Operations,dc=example,dc=net
objectclass: organizationalUnit
ou: Operations

Contents of users.ldif:

dn: cn=John Doe,ou=Developers,dc=example,dc=net
objectclass: inetOrgPerson
cn: John Doe
cn: J. Doe
sn: Doe
uid: john.doe
userpassword: pass123456
mail: john.doe@example.net
description: The Doe
ou: Developers

dn: cn=Jane Doe,ou=Operations,dc=example,dc=net
objectclass: inetOrgPerson
cn: Jane Doe    
cn: J. Doe        
sn: Doe  
uid: jane.doe   
userpassword: pass1122
mail: john.doe@example.net
description: Ops Jane  
ou: Operations

http://www.howtoforge.com/install-and-configure-openldap-on-centos-5

http://www.server-world.info/en/note?os=CentOS_6&p=ldap

openldap (last edited 2013-08-21 23:00:03 by 188)