Enable LDAPS On Windows IIS
Enable LDAPS On Windows IIS
This guide is assuming that PHP and IIS / Apache has been installed and
setup.
will need to generate a stand alone CA (you will need permission to do this by
the enterprise admin) generate keys and change:
Properties
Select any CSP but strong certificate and the key length to 1024
Click next and add the name of the computer to the server info i.e. ActiveDIR
Select the output path to c:/
Click next to finish
Go to run
Type mmc
Open the snap-in Certificates and select computer account.
Local account for computer and click on:
Personal > Certificates
There will be a certificate in there under ActiveDIR
Right click on the folder Certificates > all tasks and request new certificate.
Run thought the wizard to create new certificate.
You can double click on the certificate (do both to see the difference)
The new one will say in general proves your identity to a remote computer
This is the certificate that we need.
Right click on the new certificate and export.
Export as Base 64.
Give it a file name (anything you want but without spaces, for this example
SSL)
And save to the c:
Open up c:/ you will have 2 certificates one called ActiveDIR.domain and the
other call other openssl.cer
openssl x509 in drag the export1 file from the desktop out drag the export1 file from
the desktop and rename openssl.pem
(Note When copying the certificate around insure that it is safe as the Domain
Controller will assume that anything that comes from the certificate is trusted)
C:\OpenLDAP\sysconf\
With text pad (or word pad) create a file called ldap.conf
TLS_REQCERT never
C:\OpenLDAP\sysconf\open.ssl.conf
Your new pem certificate will need to go into the same place.
(remember to delete any cases of the pem file if copying the file around)
copy the libeay32.dll file (from the PHP installed location i.e. c:\php)
Use
<?php
phpinfo()
?>
<?php
$ad = ldaps://domain
//i.e. ldaps://dc1.server.com or ldaps://asl.org
$au = username@domain
//i.e. username of a domain admin (it would be worth creating a limited admin
//for this)
$pass = password //Password of the above username
$Connect = ldap_connect($ad)
or die(Could not connect);
ldap_set_option($Connect, LDAP_OPT_PROTOCOL_VERSION, 3)
or die (Could not set ldap protocol);
?>
If you do have problems please check that you can connect to the remote
server with LDAP.