Install openldap servers and clients:
yum install openldap-servers openldap-clients
Edit your ldap.conf file and enter the IP address or domain name of your server:
vi /etc/openldap/ldap.conf
URI ldap://192.168.1.222
BASE dc=shan,dc=com
Copy the sample files from /usr/share/openldap to /etc/openldap and var/lib/ldap:
cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
Setup a new root password:
slappasswd
New password:
Re-enter new password:
{SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Copy the password as you need to enter the password in slapd.conf:
vi /etc/openldap/slapd.conf
:%s/dc=my-domain/dc=shan/g #This regex will replace all the instances of
my-domain with your domain name.
rootpw {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Create a root.ldif file and enter the entries below:
vi /root/root.ldif
#root
dn: dc=shan,dc=com
dc: shan
objectClass: dcObject
objectClass: organizationalUnit
ou: shan.com
#staff
dn: ou=staff,dc=shan,dc=com
ou: staff
objectClass: organizationalUnit
Remove everything in slapd.d dir and tell the slapd for root.ldif file:
rm -rf /etc/openldap/slapd.d/*
slapadd -n 2 -l /root/root.ldif
slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
Set the appropriate permissions:
chown -R ldap:ldap /var/lib/ldap
chown -R ldap:ldap /etc/openldap/slapd.d
Make sure the service is on on the runlevel 3:
chkconfig --level 235 slapd on
service slapd start
rm -rf /etc/openldap/slapd.d/*
slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
chown -R ldap:ldap /etc/openldap/slapd.d
service slapd restart
Create an SSL certificate:
cd /etc/pki/tls/certs
rm slapd.pem
make slapd.pem
chmod 640 slapd.pem
chown :ldap slapd.pem
ln -s /etc/pki/tls/certs/slapd.pem /etc/openldap/cacerts/slapd.pem
vi /etc/sysconfig/ldap
SLAPD_LDAPS=yes
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
vi /etc/openldap/ldap.conf
TLS_CACERTDIR /etc/openldap/cacerts
TLS_REQCERT never
Test if everything is up and working fine:
rm -rf /etc/openldap/slapd.d/*
slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
chown -R ldap:ldap /etc/openldap/slapd.d
service
slapd restart
ldapsearch -x -ZZ -h localhost (TLS)
ldapsearch -x -H ldaps://localhost (SSL)
Note: Some additional steps
Open /etc/nsswitch.conf and edit the entry 'hosts' and add the ldap first so clients can authenticate from ldap:
vi /etc/nsswitch.conf
hosts: ldap files
Add the
rule in firewall for port 636
iptables -I INPUT -m state --state NEW -p tcp -s 192.168.1.222/24 --dport 636 -j ACCEPT
Comments
great topic. I needs to spend some time learning more or understanding more.
Thanks for excellent information I was looking for this information for my mission.
My blog - tienda erótica para mujeres: http://lolatoys.com
level does not permit the flow of gravity to irrigate the soil.
Drip irrigation brings the whole idea of garden watering firmly up to date.
To prevent formation of sinus cysts, it is necessary to treat the underlying conditions and
manage the symptoms. Sinusitis occurs when the nasal cilia move too
slowly, thereby allowing bacteria to multiply in the sinuses.
The main purpose of sprinkler systems is irrigation.
Feel free to visit my website ... finegardenequip ment.com (http://mw1.wikinect.hucompute.org/index.php/Benutzer:SantosGoldberg: http://mw1.wikinect.hucompute.org/index.php/Benutzer:SantosGoldberg)
http://directory.apache.org/apacheds/basic-ug/3.3-enabling-ssl.html
Quoting Scott:
One question though, how to get Apache Directory Studio to connect via SSL? I get an error when trying to authenticate using SSL. Do I need to transfer certificates?
Thanks!
hi pankaj,
just type ldapsearch -x -ZZ -h localhost without (TLS) or ldapsearch -x -H ldaps://localho st without (SSL)
It will solve your problem cheers
I am facing the same problem.
Check your file again or try to type it by yourself instead of copy pasting. There must be a typing mistake or something that is why it is not able to add. I hope that helps.
Thanks
Quoting Rae:
Im pretty new to ldap and kinda encountering this problem when adding the root.ldif (slapadd -n 2 -l /root/root.ldif)
/etc/openldap/slapd.conf: line 21: unknown directive outside backend info and database definitions.
slapadd: bad configuration file!
i hope someone can help me here thanks in advance!
itmanx.com/kb/centos63-openldap-phpldapadmin
ldapsearch -x -H ldaps://localho st , nothing
Feb 14 16:56:00 ldap slapd[3920]: conn=1000 fd=15 ACCEPT from IP=[::1]:41790 (IP=[::]:636)
Feb 14 16:56:17 ldap slapd[3920]: conn=1001 fd=18 ACCEPT from IP=[::1]:60232 (IP=[::]:389)
Feb 14 16:56:17 ldap slapd[3920]: conn=1001 op=0 EXT oid=1.3.6.1.4.1.1466.20037
Feb 14 16:56:17 ldap slapd[3920]: conn=1001 op=0 STARTTLS
Feb 14 16:56:17 ldap slapd[3920]: conn=1001 op=0 RESULT oid= err=0 text=
-ZZ switch means TLS search should be performed in LDAP. You need to omit SSL in the second example as ldaps tell it for perform SSL.
I hope it helps. Cheers
Quoting Steve Frazier:
[[email protected] certs]# ldapsearch -x -ZZ -h localhost (TLS)
-bash: syntax error near unexpected token `('
[[email protected] certs]#
[[email protected] certs]# ldapsearch -x -H ldaps://localho st (SSL)
-bash: syntax error near unexpected token `('
[[email protected] certs]#
Could you advise if I ran this correctly or not.
No body can help you if you will not post the error here. If the error is regarding to values already exist either delete the db or use ldap modify.
please help
I have followed your tutorial and It worked perfect for me on CentOS 6.3.
Keep up the good work! Bye
hangs and nothing happens.
Nov 26 13:23:44 auth slapd[1761]: conn=1003 fd=19 ACCEPT from IP=[::1]:34195 (IP=[::]:389)
Nov 26 13:23:44 auth slapd[1761]: conn=1003 op=0 EXT oid=1.3.6.1.4.1.1466.20037
Nov 26 13:23:44 auth slapd[1761]: conn=1003 op=0 STARTTLS
Nov 26 13:23:44 auth slapd[1761]: conn=1003 op=0 RESULT oid= err=0 text=
any hints? testing of conf-files showed no errors.
Please configure the log by adding this into your /etc/rsyslog.co nf file:
local4.* /var/log/ldap.l og
Exaimne the long what it comes up with:
tail -f /var/log/ldap.l og while performing search
or tail /var/log/ldap.l og to see what is the error message.
Quoting Kenny:
Same here Any fixes?
You can configure the log by adding this into your /etc/rsyslog.co nf file:
local4.* /var/log/ldap.l og
RSS feed for comments to this post