Step by Step Guide to Setup LDAPS on Windows Server

Published Mar 23 2019 04:11 PM 228K Views
Microsoft
First published on MSDN on Apr 10, 2017
Step-by-step guide for setting up LDAPS (LDAP over SSL)

The guide is split into 3 sections :

  1. Create a Windows Server VM in Azure

  2. Setup LDAP using AD LDS (Active Directory Lightweight Directory Services)

  3. Setup LDAPS (LDAP over SSL)


NOTE : The following steps are similar for Windows Server 2008, 2012, 2012 R2 , 2016. In this article, we will use Windows Server 2012 R2.

Create a Windows Server VM in Azure


Create a VM named “ldapstest” Windows Server 2012 R2 Datacenter Standard DS12 using the instructions here: Create a Windows virtual machine with the Azure portal
Connect to the VM ldapstest using Remote Desktop Connection.

Setup LDAP using AD LDS


Now let us add AD LDS in our VM ldapstest
Click on Start --> Server Manager --> Add Roles and Features. Click Next.



Choose Role-based or feature-based installation. Click Next.



Select ldapstest server from the server pool. Click Next.



Mark Active Directory Lightweight Directory Services from the list of roles and click Next.



From the list of features, choose nothing – just click Next.



Click Next.



Click Install to start installation.



Once installation is complete, click Close.



Now we have successfully set up AD LDS Role. Let us create a new AD LDS Instance “CONTOSO” using the wizard. Click the “Run the Active Directory Lightweight Directory Services Setup Wizard” in the above screen. And then Click Close.



Choose Unique Instance since we are setting it up for the first time.



Type “CONTOSO” in Instance Name and click Next.







By Default, LDAP Port is 389 and LDAPS port is 636, let us choose the default values - click Next.



Create a new Application Directory Partition named “CN=MRS,DC=CONTOSO,DC=COM”. Click Next.



Using the default values for storage location of ADLDS files- Click Next.



Choosing Network Service Account for running the AD LDS Service.



You will receive a prompt warning about data replication. Since we are using a single LDAP Server, we can click Yes.



Choosing the currently logged on user as an administrator for the AD LDS Instance. Click Next.



Mark all the required LDIF files to import (Here we are marking all files). Click Next.



Verify that all the selections are right and then Click Next to confirm Installation.



Once the instance is setup successfully, click Finish.



Now let us try to connect to the AD LDS Instance CONTOSO using ADSI Edit.
Click on Start --> Search “ADSI Edit” and open it.
Right Click on ADSI Edit Folder (on the left pane) and choose Connect To.. . Fill the following values and Click OK.





If the connection is successful, we will be able to browse the Directory CN=MRS,DC=CONTOSO,DC=COM :




Setup LDAPS (LDAP over SSL)


The Certificate to be used for LDAPS must satisfy the following 3 requirements:
• Certificate must be valid for the purpose of Server Authentication. This means that it must also contains the Server Authentication object identifier (OID): 1.3.6.1.5.5.7.3.1
• The Subject name or the first name in the Subject Alternative Name (SAN) must match the Fully Qualified Domain Name (FQDN) of the host machine, such as Subject:CN=contosoldaps. For more information, see How to add a Subject Alternative Name to a secure LDAP certificate .
• The host machine account must have access to the private key.

Now, let’s use Active Directory Certificate Services to create a certificate to be used for LDAPS. If you already have a certificate satisfying the above requirements, you can skip this step.

Click on Start --> Server Manager --> Add Roles and Features. Click Next.



Choose Role-based or feature-based installation. Click Next.



Select ldapstest server from the server pool. Click Next.



Choose Active Directory Certificate Services from the list of roles and click Next.



Choose nothing from the list of features and click Next.



Click Next.



Mark “Certificate Authority” from the list of roles and click Next.



Click Install to confirm installation.



Once installation is complete, Click Close.



Now let’s create a certificate using AD CS Configuration Wizard. To open the wizard, click on “Configure Active Directory Certificate Services on the destination server” in the above screen. And then click Close. We can use the currently logged on user azureuser to configure role services since it belongs to the local Administrators group. Click Next.



Choose Certification Authority from the list of roles. Click Next.



Since this is a local box setup without a domain, we are going to choose a Standalone CA. Click Next.



Choosing Root CA as the type of CA, click Next.



Since we do not possess a private key – let’s create a new one. Click Next.



Choosing SHA1 as the Hash algorithm. Click Next.

UPDATE : Recommended to select the most recent hashing algorithm since SHA-1 deprecation countdown



The name of the CA must match the Hostname (requirement number 2). Enter “LDAPSTEST” and Click Next.



Specifying validity period of the certificate. Choosing Default 5 years. Click Next.



Choosing default database locations, click Next.



Click Configure to confirm.



Once the configuration is successful/complete. Click Close.



Now let us view the generated certificate.

Click on Start à Search “Manage Computer Certificates” and open it.

Click on Personal Certificates and verify that the certificate “LDAPSTEST” is present:



Now to fulfill the third requirement, let us ensure host machine account has access to the private key. Using the Certutil utility, find the Unique Container Name. Open Command Prompt in Administrator mode and run the following command: certutil -verifystore MY



The private key will be present in the following location C:\ProgramData\Microsoft\Crypto\Keys\<UniqueContainerName>

Right Click C:\ProgramData\Microsoft\Crypto\Keys\874cb49a696726e9f435c1888b69f317_d3e61130-4cd8-4288-a344-7784647ff8c4 and click properties --> Security and add read permissions for NETWORK SERVICE.



We need to import this certificate into JRE key store since our certificate “CN=LDAPSTEST” is not signed by any by any trusted Certification Authority(CA) which is configured in you JRE keystore e.g Verisign, Thwate, goDaddy or entrust etc. In order to import this certificate using the keytool utility, let us first export this cert as a .CER from the machine certificate store:

Click Start --> Search “Manage Computer Certificates” and open it. Open personal, right click LDAPSTEST cert and click “Export”.



This opens the Certificate Export Wizard. Click Next.



Do not export the private key. Click Next.



Choose Base-64 encoded X .509 file format. Click Next.



Exporting the .CER to Desktop. Click Next.



Click Finish to complete the certificate export.



Certificate is now successfully exported to “C:\Users\azureuser\Desktop\ldapstest.cer”.

Now we shall import it to JRE Keystore using the keytool command present in this location:

C:\Program Files\Java\jre1.8.0_92\bin\keytool.exe.

Open Command Prompt in administrator mode. Navigate to “C:\Program Files\Java\jre1.8.0_92\bin\” and run the following command:
keytool -importcert -alias "ldapstest" -keystore "C:\Program Files\Java\jre1.8.0_92\lib\security\cacerts" -storepass changeit -file "C:\Users\azureuser\Desktop\ldapstest.cer"




Type “yes” in the Trust this certificate prompt.

Once certificate is successfully added to the JRE keystore, we can connect to the LDAP server over SSL.

Now let us try to connect to LDAP Server (with and without SSL) using the ldp.exe tool.

Connection strings for

LDAP:\\ldapstest:389

LDAPS:\\ldapstest:636

Click on Start --> Search ldp.exe --> Connection and fill in the following parameters and click OK to connect:



If Connection is successful, you will see the following message in the ldp.exe tool:





To Connect to LDAPS (LDAP over SSL), use port 636 and mark SSL. Click OK to connect.



If connection is successful, you will see the following message in the ldp.exe tool:


REFERENCES


https://technet.microsoft.com/en-us/library/cc770639(v=ws.10)
https://technet.microsoft.com/en-us/library/cc725767(v=ws.10).aspx
http://social.technet.microsoft.com/wiki/contents/articles/2980.ldap-over-ssl-ldaps-certificate....
https://blogs.technet.microsoft.com/askds/2008/03/13/troubleshooting-ldap-over-ssl/
http://javarevisited.blogspot.com/2011/11/ldap-authentication-active-directory.html
6 Comments
%3CLINGO-SUB%20id%3D%22lingo-sub-1352132%22%20slang%3D%22es-ES%22%3ERe%3A%20Step%20by%20Step%20Guide%20to%20Setup%20LDAPS%20on%20Windows%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1352132%22%20slang%3D%22es-ES%22%3E%3CP%3EGreat%20tutorial!%20Thanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1523009%22%20slang%3D%22en-US%22%3ERe%3A%20Step%20by%20Step%20Guide%20to%20Setup%20LDAPS%20on%20Windows%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1523009%22%20slang%3D%22en-US%22%3E%3CP%3EI%20can't%20understand%20why%20it%20imports%20the%20certificate%20to%20java%20truststore.%20The%20ldp.exe%20tool%20use%20java%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1619777%22%20slang%3D%22en-US%22%3ERe%3A%20Step%20by%20Step%20Guide%20to%20Setup%20LDAPS%20on%20Windows%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1619777%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F729140%22%20target%3D%22_blank%22%3E%40zhongyi_yang%3C%2FA%3E%26nbsp%3BI%20would%20also%20like%20to%20know%20that.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1624087%22%20slang%3D%22en-US%22%3ERe%3A%20Step%20by%20Step%20Guide%20to%20Setup%20LDAPS%20on%20Windows%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1624087%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20java%20truststore%20is%20a%20bit%20odd%2C%20considering%20well%2C%20Java.%20Is%20there%20any%20other%20method%20to%20import%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2114807%22%20slang%3D%22en-US%22%3ERe%3A%20Step%20by%20Step%20Guide%20to%20Setup%20LDAPS%20on%20Windows%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2114807%22%20slang%3D%22en-US%22%3E%3CP%3ESo%20ldp%20will%20connect%20if%20I%20use%20the%20computer%20name%2C%20but%20not%20the%20IP.%20Any%20ideas%20on%20what%20I%20need%20to%20do%20to%20get%20that%20to%20work%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2519343%22%20slang%3D%22en-US%22%3ERe%3A%20Step%20by%20Step%20Guide%20to%20Setup%20LDAPS%20on%20Windows%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2519343%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F955849%22%20target%3D%22_blank%22%3E%40BryanHarper%3C%2FA%3E%26nbsp%3Byou%20might%20try%20to%20create%20the%20certificate%20by%20providing%20also%20the%20IP%20as%20SAN%20in%20the%20certificate%20request%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-385362%22%20slang%3D%22en-US%22%3EStep%20by%20Step%20Guide%20to%20Setup%20LDAPS%20on%20Windows%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-385362%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Apr%2010%2C%202017%20%3CBR%20%2F%3EStep-by-step%20guide%20for%20setting%20up%20%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F2980.ldap-over-ssl-ldaps-certificate.aspx%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3ELDAPS%20%3C%2FA%3E(LDAP%20over%20SSL)%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20guide%20is%20split%20into%203%20sections%20%3A%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Create%20a%20Windows%20Server%20VM%20in%20Azure%3CBR%20%2F%3E%20Setup%20LDAP%20using%20AD%20LDS%20(Active%20Directory%20Lightweight%20Directory%20Services)%3CBR%20%2F%3E%20Setup%20LDAPS%20(LDAP%20over%20SSL)%3CBR%20%2F%3E%3CBR%20%2F%3ENOTE%20%3A%20The%20following%20steps%20are%20similar%20for%20Windows%20Server%202008%2C%202012%2C%202012%20R2%20%2C%202016.%20In%20this%20article%2C%20we%20will%20use%20Windows%20Server%202012%20R2.%3CBR%20%2F%3E%20Create%20a%20Windows%20Server%20VM%20in%20Azure%3CBR%20%2F%3ECreate%20a%20VM%20named%20%E2%80%9Cldapstest%E2%80%9D%20Windows%20Server%202012%20R2%20Datacenter%20Standard%20DS12%20using%20the%20instructions%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fquick-create-portal%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3ECreate%20a%20Windows%20virtual%20machine%20with%20the%20Azure%20portal%20%3C%2FA%3E%3CBR%20%2F%3EConnect%20to%20the%20VM%20ldapstest%20using%20Remote%20Desktop%20Connection.%3CBR%20%2F%3E%20Setup%20LDAP%20using%20AD%20LDS%3CBR%20%2F%3ENow%20let%20us%20add%20AD%20LDS%20in%20our%20VM%20ldapstest%3CBR%20%2F%3EClick%20on%20Start%20--%26gt%3B%20Server%20Manager%20--%26gt%3B%20Add%20Roles%20and%20Features.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoose%20Role-based%20or%20feature-based%20installation.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ESelect%20ldapstest%20server%20from%20the%20server%20pool.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EMark%20Active%20Directory%20Lightweight%20Directory%20Services%20from%20the%20list%20of%20roles%20and%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EFrom%20the%20list%20of%20features%2C%20choose%20nothing%20%E2%80%93%20just%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20Install%20to%20start%20installation.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EOnce%20installation%20is%20complete%2C%20click%20Close.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20we%20have%20successfully%20set%20up%20AD%20LDS%20Role.%20Let%20us%20create%20a%20new%20AD%20LDS%20Instance%20%E2%80%9CCONTOSO%E2%80%9D%20using%20the%20wizard.%20Click%20the%20%E2%80%9CRun%20the%20Active%20Directory%20Lightweight%20Directory%20Services%20Setup%20Wizard%E2%80%9D%20in%20the%20above%20screen.%20And%20then%20Click%20Close.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoose%20Unique%20Instance%20since%20we%20are%20setting%20it%20up%20for%20the%20first%20time.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EType%20%E2%80%9CCONTOSO%E2%80%9D%20in%20Instance%20Name%20and%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBy%20Default%2C%20LDAP%20Port%20is%20389%20and%20LDAPS%20port%20is%20636%2C%20let%20us%20choose%20the%20default%20values%20-%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ECreate%20a%20new%20Application%20Directory%20Partition%20named%20%E2%80%9CCN%3DMRS%2CDC%3DCONTOSO%2CDC%3DCOM%E2%80%9D.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EUsing%20the%20default%20values%20for%20storage%20location%20of%20ADLDS%20files-%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoosing%20Network%20Service%20Account%20for%20running%20the%20AD%20LDS%20Service.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20will%20receive%20a%20prompt%20warning%20about%20data%20replication.%20Since%20we%20are%20using%20a%20single%20LDAP%20Server%2C%20we%20can%20click%20Yes.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoosing%20the%20currently%20logged%20on%20user%20as%20an%20administrator%20for%20the%20AD%20LDS%20Instance.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EMark%20all%20the%20required%20LDIF%20files%20to%20import%20(Here%20we%20are%20marking%20all%20files).%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EVerify%20that%20all%20the%20selections%20are%20right%20and%20then%20Click%20Next%20to%20confirm%20Installation.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EOnce%20the%20instance%20is%20setup%20successfully%2C%20click%20Finish.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20let%20us%20try%20to%20connect%20to%20the%20AD%20LDS%20Instance%20CONTOSO%20using%20ADSI%20Edit.%3CBR%20%2F%3EClick%20on%20Start%20--%26gt%3B%20Search%20%E2%80%9CADSI%20Edit%E2%80%9D%20and%20open%20it.%3CBR%20%2F%3ERight%20Click%20on%20ADSI%20Edit%20Folder%20(on%20the%20left%20pane)%20and%20choose%20Connect%20To..%20.%20Fill%20the%20following%20values%20and%20Click%20OK.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20the%20connection%20is%20successful%2C%20we%20will%20be%20able%20to%20browse%20the%20Directory%20CN%3DMRS%2CDC%3DCONTOSO%2CDC%3DCOM%20%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20Setup%20LDAPS%20(LDAP%20over%20SSL)%3CBR%20%2F%3EThe%20Certificate%20to%20be%20used%20for%20LDAPS%20must%20satisfy%20the%20following%203%20requirements%3A%3CBR%20%2F%3E%E2%80%A2%20Certificate%20must%20be%20valid%20for%20the%20purpose%20of%20Server%20Authentication.%20This%20means%20that%20it%20must%20also%20contains%20the%20Server%20Authentication%20object%20identifier%20(OID)%3A%201.3.6.1.5.5.7.3.1%3CBR%20%2F%3E%E2%80%A2%20The%20Subject%20name%20or%20the%20first%20name%20in%20the%20Subject%20Alternative%20Name%20(SAN)%20must%20match%20the%20Fully%20Qualified%20Domain%20Name%20(FQDN)%20of%20the%20host%20machine%2C%20such%20as%20Subject%3ACN%3Dcontosoldaps.%20For%20more%20information%2C%20see%20How%20to%20add%20a%20Subject%20Alternative%20Name%20to%20a%20secure%20LDAP%20certificate%20.%3CBR%20%2F%3E%E2%80%A2%20The%20host%20machine%20account%20must%20have%20access%20to%20the%20private%20key.%3CBR%20%2F%3E%3CBR%20%2F%3ENow%2C%20let%E2%80%99s%20use%20Active%20Directory%20Certificate%20Services%20to%20create%20a%20certificate%20to%20be%20used%20for%20LDAPS.%20If%20you%20already%20have%20a%20certificate%20satisfying%20the%20above%20requirements%2C%20you%20can%20skip%20this%20step.%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20on%20Start%20--%26gt%3B%20Server%20Manager%20--%26gt%3B%20Add%20Roles%20and%20Features.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoose%20Role-based%20or%20feature-based%20installation.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ESelect%20ldapstest%20server%20from%20the%20server%20pool.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoose%20Active%20Directory%20Certificate%20Services%20from%20the%20list%20of%20roles%20and%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoose%20nothing%20from%20the%20list%20of%20features%20and%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EMark%20%E2%80%9CCertificate%20Authority%E2%80%9D%20from%20the%20list%20of%20roles%20and%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20Install%20to%20confirm%20installation.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EOnce%20installation%20is%20complete%2C%20Click%20Close.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20let%E2%80%99s%20create%20a%20certificate%20using%20AD%20CS%20Configuration%20Wizard.%20To%20open%20the%20wizard%2C%20click%20on%20%E2%80%9CConfigure%20Active%20Directory%20Certificate%20Services%20on%20the%20destination%20server%E2%80%9D%20in%20the%20above%20screen.%20And%20then%20click%20Close.%20We%20can%20use%20the%20currently%20logged%20on%20user%20azureuser%20to%20configure%20role%20services%20since%20it%20belongs%20to%20the%20local%20Administrators%20group.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoose%20Certification%20Authority%20from%20the%20list%20of%20roles.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ESince%20this%20is%20a%20local%20box%20setup%20without%20a%20domain%2C%20we%20are%20going%20to%20choose%20a%20Standalone%20CA.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoosing%20Root%20CA%20as%20the%20type%20of%20CA%2C%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ESince%20we%20do%20not%20possess%20a%20private%20key%20%E2%80%93%20let%E2%80%99s%20create%20a%20new%20one.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoosing%20SHA1%20as%20the%20Hash%20algorithm.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3EUPDATE%20%3A%20Recommended%20to%20select%20the%20most%20recent%20hashing%20algorithm%20since%20%3CA%20href%3D%22https%3A%2F%2Fblogs.windows.com%2Fmsedgedev%2F2016%2F04%2F29%2Fsha1-deprecation-roadmap%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ESHA-1%20deprecation%20countdown%20%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20name%20of%20the%20CA%20must%20match%20the%20Hostname%20(requirement%20number%202).%20Enter%20%E2%80%9CLDAPSTEST%E2%80%9D%20and%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ESpecifying%20validity%20period%20of%20the%20certificate.%20Choosing%20Default%205%20years.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoosing%20default%20database%20locations%2C%20click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20Configure%20to%20confirm.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EOnce%20the%20configuration%20is%20successful%2Fcomplete.%20Click%20Close.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20let%20us%20view%20the%20generated%20certificate.%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20on%20Start%20%C3%A0%20Search%20%E2%80%9CManage%20Computer%20Certificates%E2%80%9D%20and%20open%20it.%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20on%20Personal%20Certificates%20and%20verify%20that%20the%20certificate%20%E2%80%9CLDAPSTEST%E2%80%9D%20is%20present%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20to%20fulfill%20the%20third%20requirement%2C%20let%20us%20ensure%20host%20machine%20account%20has%20access%20to%20the%20private%20key.%20Using%20the%20Certutil%20utility%2C%20find%20the%20Unique%20Container%20Name.%20Open%20Command%20Prompt%20in%20Administrator%20mode%20and%20run%20the%20following%20command%3A%20certutil%20-verifystore%20MY%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20private%20key%20will%20be%20present%20in%20the%20following%20location%20C%3A%5CProgramData%5CMicrosoft%5CCrypto%5CKeys%5C%3CUNIQUECONTAINERNAME%3E%3CBR%20%2F%3E%3CBR%20%2F%3ERight%20Click%20C%3A%5CProgramData%5CMicrosoft%5CCrypto%5CKeys%5C874cb49a696726e9f435c1888b69f317_d3e61130-4cd8-4288-a344-7784647ff8c4%20and%20click%20properties%20--%26gt%3B%20Security%20and%20add%20read%20permissions%20for%20NETWORK%20SERVICE.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EWe%20need%20to%20import%20this%20certificate%20into%20JRE%20key%20store%20since%20our%20certificate%20%E2%80%9CCN%3DLDAPSTEST%E2%80%9D%20is%20not%20signed%20by%20any%20by%20any%20trusted%20Certification%20Authority(CA)%20which%20is%20configured%20in%20you%20JRE%20keystore%20e.g%20Verisign%2C%20Thwate%2C%20goDaddy%20or%20entrust%20etc.%20In%20order%20to%20import%20this%20certificate%20using%20the%20keytool%20utility%2C%20let%20us%20first%20export%20this%20cert%20as%20a%20.CER%20from%20the%20machine%20certificate%20store%3A%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20Start%20--%26gt%3B%20Search%20%E2%80%9CManage%20Computer%20Certificates%E2%80%9D%20and%20open%20it.%20Open%20personal%2C%20right%20click%20LDAPSTEST%20cert%20and%20click%20%E2%80%9CExport%E2%80%9D.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20opens%20the%20Certificate%20Export%20Wizard.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EDo%20not%20export%20the%20private%20key.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EChoose%20Base-64%20encoded%20X%20.509%20file%20format.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EExporting%20the%20.CER%20to%20Desktop.%20Click%20Next.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20Finish%20to%20complete%20the%20certificate%20export.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ECertificate%20is%20now%20successfully%20exported%20to%20%E2%80%9CC%3A%5CUsers%5Cazureuser%5CDesktop%5Cldapstest.cer%E2%80%9D.%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20we%20shall%20import%20it%20to%20JRE%20Keystore%20using%20the%20keytool%20command%20present%20in%20this%20location%3A%3CBR%20%2F%3E%3CBR%20%2F%3EC%3A%5CProgram%20Files%5CJava%5Cjre1.8.0_92%5Cbin%5Ckeytool.exe.%3CBR%20%2F%3E%3CBR%20%2F%3EOpen%20Command%20Prompt%20in%20administrator%20mode.%20Navigate%20to%20%E2%80%9CC%3A%5CProgram%20Files%5CJava%5Cjre1.8.0_92%5Cbin%5C%E2%80%9D%20and%20run%20the%20following%20command%3A%3CBR%20%2F%3Ekeytool%20-importcert%20-alias%20%22ldapstest%22%20-keystore%20%22C%3A%5CProgram%20Files%5CJava%5Cjre1.8.0_92%5Clib%5Csecurity%5Ccacerts%22%20-storepass%20changeit%20-file%20%22C%3A%5CUsers%5Cazureuser%5CDesktop%5Cldapstest.cer%22%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EType%20%E2%80%9Cyes%E2%80%9D%20in%20the%20Trust%20this%20certificate%20prompt.%3CBR%20%2F%3E%3CBR%20%2F%3EOnce%20certificate%20is%20successfully%20added%20to%20the%20JRE%20keystore%2C%20we%20can%20connect%20to%20the%20LDAP%20server%20over%20SSL.%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20let%20us%20try%20to%20connect%20to%20LDAP%20Server%20(with%20and%20without%20SSL)%20using%20the%20ldp.exe%20tool.%3CBR%20%2F%3E%3CBR%20%2F%3EConnection%20strings%20for%3CBR%20%2F%3E%3CBR%20%2F%3ELDAP%3A%5C%5Cldapstest%3A389%3CBR%20%2F%3E%3CBR%20%2F%3ELDAPS%3A%5C%5Cldapstest%3A636%3CBR%20%2F%3E%3CBR%20%2F%3EClick%20on%20Start%20--%26gt%3B%20Search%20ldp.exe%20--%26gt%3B%20Connection%20and%20fill%20in%20the%20following%20parameters%20and%20click%20OK%20to%20connect%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20Connection%20is%20successful%2C%20you%20will%20see%20the%20following%20message%20in%20the%20ldp.exe%20tool%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20Connect%20to%20LDAPS%20(LDAP%20over%20SSL)%2C%20use%20port%20636%20and%20mark%20SSL.%20Click%20OK%20to%20connect.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20connection%20is%20successful%2C%20you%20will%20see%20the%20following%20message%20in%20the%20ldp.exe%20tool%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20REFERENCES%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc770639(v%3Dws.10)%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc770639(v%3Dws.10)%20%3C%2FA%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc725767(v%3Dws.10).aspx%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fcc725767(v%3Dws.10).aspx%20%3C%2FA%3E%3CBR%20%2F%3E%3CA%20href%3D%22http%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F2980.ldap-over-ssl-ldaps-certificate.aspx%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttp%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F2980.ldap-over-ssl-ldaps-certificate.aspx%20%3C%2FA%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fblogs.technet.microsoft.com%2Faskds%2F2008%2F03%2F13%2Ftroubleshooting-ldap-over-ssl%2F%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fblogs.technet.microsoft.com%2Faskds%2F2008%2F03%2F13%2Ftroubleshooting-ldap-over-ssl%2F%20%3C%2FA%3E%3CBR%20%2F%3E%3CA%20href%3D%22http%3A%2F%2Fjavarevisited.blogspot.com%2F2011%2F11%2Fldap-authentication-active-directory.html%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttp%3A%2F%2Fjavarevisited.blogspot.com%2F2011%2F11%2Fldap-authentication-active-directory.html%3C%2FA%3E%3C%2FUNIQUECONTAINERNAME%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-385362%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Apr%2010%2C%202017%20Step-by-step%20guide%20for%20setting%20up%20LDAPS%20(LDAP%20over%20SSL)The%20guide%20is%20split%20into%203%20sections%20%3A%20Create%20a%20Windows%20Server%20VM%20in%20Azure%20Setup%20LDAP%20using%20AD%20LDS%20(Active%20Directory%20Lightweight%20Directory%20Services)%20Setup%20LDAPS%20(LDAP%20over%20SSL)NOTE%20%3A%20The%20following%20steps%20are%20similar%20for%20Windows%20Server%202008%2C%202012%2C%202012%20R2%20%2C%202016.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-385362%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQLServerMachineLearning%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FLINGO-BODY%3E
Version history
Last update:
‎Mar 23 2019 04:11 PM
Updated by: