| Previous |
Home | Next |
| Version: | - openldap-servers 2.3.19 |
| - phpLDAPadmin 1.0.1 |
| Man Pages: | ||
| ldap | slapd | slapcat |
| ldap.conf | slapd.conf | slapadd |
| ldapadd | slapd.access | slappasswd |
| ldapsearch | slaptest | ldif |
| Description |
String
Value (DN) |
| Base
Domain |
dc=example,dc=com |
| Admin
User |
cn=Manager,dc=example,dc=com |
| Authorised
users located here |
ou=users,dc=example,dc=com |
| Authorised
user account (example) |
uid=alice,ou=users,dc=example,dc=com |
| Address
book entries located here Also used by client as "Search Base" |
ou=addressbook,dc=example,dc=com |
| Address
book entry (example) |
cn=Tom Thumb,ou=addressbook,dc=example,dc=com |
| String |
Attribute
Type |
| dn |
Distinguished Name |
| cn |
Common
Name |
| o |
Organisational Name |
| ou |
Organisational Unit Name |
| dc |
Domain
Component |
| uid |
User
Identification |
![]() |
Do not confuse the X.500 naming scheme used in LDAP with the
email addresses of your contacts, they are totally separate details.
This
will become clear further on. |
| Example
Domain Names |
String
Value |
| home.lan |
dc=home,dc=lan |
| example.com | dc=example,dc=com |
| example.org | dc=example,dc=org |
| domain.org.au |
dc=domain,dc=org,dc=au |
| sub.domain.org.au | dc=sub,dc=domain,dc=org,dc=au |
| more.sub.domain.org.au | dc=more,dc=sub,dc=domain,dc=org,dc=au |
![]() |
If
the LDAP server is simply being configured as a shared address book and
not for any real networking requirement, then it is acceptable to use a
simple domain similar to "home.lan" |
| [bash]# cp
/etc/openldap/ldap.conf /etc/openldap/ldap.conf.original [bash]# vi /etc/openldap/ldap.conf |
| URI
ldap://galaxy.example.com:389 BASE dc=example,dc=com TLS_REQCERT allow |
| [bash]# slappasswd |
| {SSHA}RZmBkCh3WwEMNhdANh/l3OynzHSifPzF |
| [bash]# cp
/etc/openldap/slapd.conf /etc/openldap/slapd.conf.original [bash]# vi /etc/openldap/slapd.conf |
| include
/etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema #include /etc/openldap/schema/nis.schema pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args ############################################################# database bdb suffix "dc=example,dc=com" rootdn "cn=Manager,dc=example,dc=com" rootpw {SSHA}RZmBkCh3WwEMNhdANh/l3OynzHSifPzF <-- insert generated root password here directory /var/lib/ldap index objectClass eq,pres #index ou,cn,mail,surname,givenname eq,pres,sub #index uidNumber,gidNumber,loginShell eq,pres #index uid,memberUid eq,pres,sub #index nisMapName,nisMapEntry eq,pres,sub # DB_CONFIG Settings - For SleepyCat Berkeley DB dbconfig set_cachesize 0 10485760 0 dbconfig set_lg_regionmax 262144 dbconfig set_lg_bsize 2097152 |
![]() |
It is possible to run multiple databases using the one OpenLDAP server, however we are only concerned with one for the time being. Consult the documentation for further details if needed. |
| [bash]# /etc/init.d/ldap configtest |
| [bash]# chkconfig
--level 345 ldap on [bash]# chkconfig --list ldap |
| [bash]# /etc/init.d/ldap
restart |
| [bash]# ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts |
| # extended LDIF # # LDAPv3 # base <> with scope base # filter: (objectclass=*) # requesting: namingContexts dn: namingContexts: dc=example,dc=com # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1 |
| [bash]# vi
/etc/openldap/addressbook.ldif |
| dn: dc=example,dc=com objectclass: dcObject objectclass: organization o: Home LDAP Server dc: example dn: cn=Manager,dc=example,dc=com objectclass: organizationalRole cn: Manager dn: ou=users,dc=example,dc=com ou: users objectClass: top objectClass: organizationalUnit dn: ou=addressbook,dc=example,dc=com ou: addressbook objectClass: top objectClass: organizationalUnit |
| [bash]# ldapadd -x -D 'cn=Manager,dc=example,dc=com' -W -f /etc/openldap/addressbook.ldif |
| Enter LDAP Password: adding new entry "dc=example,dc=com" adding new entry "cn=Manager,dc=example,dc=com" adding new entry "ou=users,dc=example,dc=com" adding new entry "ou=addressbook,dc=example,dc=com" |
| [bash]# ldapsearch
-x -b 'dc=example,dc=com'
'(objectclass=*)' |
| # example.com dn: dc=example,dc=com objectClass: top objectClass: dcObject objectClass: organization o: Home LDAP Network dc: example # Manager, example.com dn: cn=Manager,dc=example,dc=com objectClass: organizationalRole cn: Manager # users, example.com dn: ou=users,dc=example,dc=com ou: users objectClass: top objectClass: organizationalUnit # addressbook, example.com dn: ou=addressbook,dc=example,dc=com ou: addressbook objectClass: top objectClass: organizationalUnit |
| [bash]# vi
newcontact.ldif |
dn:cn=Tom Thumb,ou=addressbook,dc=example,dc=comcn: Tom Thumbgn: Tom sn: Thumb o: Home l: Brisbane street: 12 Banana Ave st: QLDpostalCode: 4100pager: 5555 1111homePhone: 5555 1234telephoneNumber: 5555 1235 facsimileTelephoneNumber: 5555 1236mobile: 0400 123 123 mail: tom.thumb@somedomain.com objectClass: top objectClass: inetOrgPerson |
| [bash]# ldapadd -x -D 'cn=Manager,dc=example,dc=com' -W -f newcontact.ldif |
| Enter LDAP Password: adding new entry "cn=Tom Thumb,ou=addressbook,dc=example,dc=com" |
| [bash]# vi
/etc/openldap/slapd.conf |
| TLSCACertificateFile /etc/pki/tls/certs/ca-bundle.crt TLSCertificateFile /etc/pki/tls/certs/slapd.pem TLSCertificateKeyFile /etc/pki/tls/certs/slapd.pem security ssf=1 update_ssf=112 simple_bind=64 disallow bind_anon access to * by self write by anonymous auth by users read access to dn.subtree="ou=addressbook,dc=example,dc=com" by users write |
![]() |
The term "users" defines those people that have successfully
authenticated with the server. |
| [bash]# cd /etc/pki/tls/certs [bash]# make slapd.pem |
| Country Name (2 letter code) [GB]:AU State or Province Name (full name) [Berkshire]:QLD Locality Name (eg, city) [Newbury]:Brisbane Organization Name (eg, company) [My Company Ltd]:Miles Brennan Organizational Unit Name (eg, section) []:Home Linux Server Common Name (eg, your name or your server's hostname) []:galaxy.example.com Email Address []:sysadmin@example.com |
| [bash]# chown root.ldap /etc/pki/tls/certs/slapd.pem [bash]# chmod 640 /etc/pki/tls/certs/slapd.pem |
| [bash]# vi /etc/openldap/ldap.conf |
| URI
ldaps://www.example.com:636 BASE dc=example,dc=com TLS_REQCERT demand <-- see warning below, may need to be "allow" TLS_CACERTDIR /etc/pki/tls/certs/ TLS_CACERT /etc/pki/tls/certs/ca-bundle.crt TLS_CRLCHECK peer |
![]() |
Refer to "man ldap.conf" and "man slapd.conf"
for the exact meanings of the TLS options. Incorrect settings when
working with a "self signed" PEM certificate may prevent your LDAP
client from successfully connecting to your SLAPD server. |
| [bash]# /etc/init.d/ldap configtest |
| [bash]# /etc/init.d/ldap restart |
| [bash]# slappasswd |
| {SSHA}RZmBkCh3WwEMNhdANh/l3OynzHSifPzF |
| [bash]# slappasswd -h {MD5} |
| {MD5}poocSzW4TMBN3fOtmVOQHg== |
| [bash]# vi useraccount.ldif |
| dn:uid=alice,ou=users,dc=example,dc=com uid: alice userPassword: {MD5}poocSzW4TMBN3fOtmVOQHg== objectClass: top objectClass: account objectClass: simpleSecurityObject |
| [bash]# ldapadd -x -D 'cn=Manager,dc=example,dc=com' -W -f useraccount.ldif |
| Enter LDAP Password: adding new entry "uid=alice,ou=users,dc=example,dc=com" |
![]() |
For Alice to authenticate to the server, she needs to pass "uid=alice,ou=users,dc=example,dc=com" as her username along with the the plain text value of her password, the hashed value is only for storage purposes. |
| [bash]# /etc/init.d/ldap stop |
![]() |
The LDAP server should be stopped before executing the "slapcat" or "slapadd" commands. This
prevents the possibility of data corruption and ensures database
integrity is maintained. |
| [bash]# slapcat -vl /etc/openldap/backup_slapd.ldif |
| [bash]# slapadd -vl
/etc/openldap/backup_slapd.ldif |
| [bash]# chown ldap.ldap /var/lib/ldap/* |
| [bash]# /etc/init.d/ldap
restart |
| [bash]# tar -xzvf
phpldapadmin-?.?.?.tar.gz
-C /var/www/ [bash]# chown -R root.root /var/www/phpldapadmin-?.?.?/ |
| [bash]# cp /var/www/phpldapadmin-?.?.?/config/config.php.example /var/www/phpldapadmin-?.?.?/config/config.php |
| [bash]# vi /var/www/phpldapadmin-?.?.?/config.php |
| <?php //$config->custom->debug['level'] = 255; //$config->custom->debug['file'] = '/tmp/pla_debug.log'; /*********************************************/ /* Define your LDAP servers in this section */ /*********************************************/ $i=0; $ldapservers = new LDAPServers; $ldapservers->SetValue($i,'server','name','My LDAP Server'); $ldapservers->SetValue($i,'server','host','127.0.0.1'); $ldapservers->SetValue($i,'server','port','389'); $ldapservers->SetValue($i,'server','base',array('dc=example,dc=com')); $ldapservers->SetValue($i,'server','auth_type','config'); $ldapservers->SetValue($i,'login','dn','cn=Manager,dc=example,dc=com'); $ldapservers->SetValue($i,'login','pass','password'); <-- set your Manager password here $ldapservers->SetValue($i,'server','tls',true); <-- set to false if not using SSL certs ?> |
| [bash]# vi
/etc/httpd/conf.d/phpLDAPadmin.conf |
| Alias /ldap
"/var/www/phpldapadmin-?.?.?" <Location "/ldap"> AuthType Basic AuthName "Private Area - LDAP Administrator" AuthUserFile /etc/httpd/conf/authusers AuthGroupFile /etc/httpd/conf/authgroups Require group ldapusers Require valid-user </Location> |
| [bash]# vi /etc/httpd/conf.d/mod-rewrite.conf |
| RewriteRule ^/ldap/(.*) https://%{SERVER_NAME}/ldap/$1 [R,L] |
| [bash]# /etc/init.d/httpd
restart |
| LDAP
Server: |
galaxy.example.com:389 |
| Search Base: |
ou=addressbook,dc=example,dc=com |
| Login
Method: |
use
distinguished name (if listed) |
| Username: |
uid=alice,ou=users,dc=example,dc=com |
| Password: |
As entered in
useraccount.ldif file (plain text version) |
| Secure
Connection: |
Never (unless encryption has been configured) |
|
[bash]# cd /usr/share/squirrelmail/config [bash]# ./conf.pl |
| Previous |
Home | Next |