Step by Step Guide to Setup LDAPS on Windows Server (2024)

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.

Step by Step Guide to Setup LDAPS on Windows Server (1)

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

Step by Step Guide to Setup LDAPS on Windows Server (2)

Select ldapstest server from the server pool. Click Next.

Step by Step Guide to Setup LDAPS on Windows Server (3)

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

Step by Step Guide to Setup LDAPS on Windows Server (4)

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

Step by Step Guide to Setup LDAPS on Windows Server (5)

Click Next.

Step by Step Guide to Setup LDAPS on Windows Server (6)

Click Install to start installation.

Step by Step Guide to Setup LDAPS on Windows Server (7)

Once installation is complete, click Close.

Step by Step Guide to Setup LDAPS on Windows Server (8)

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.

Step by Step Guide to Setup LDAPS on Windows Server (9)

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

Step by Step Guide to Setup LDAPS on Windows Server (10)

Type “CONTOSO” in Instance Name and click Next.

Step by Step Guide to Setup LDAPS on Windows Server (11)

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

Step by Step Guide to Setup LDAPS on Windows Server (12)

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

Step by Step Guide to Setup LDAPS on Windows Server (13)

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

Step by Step Guide to Setup LDAPS on Windows Server (14)

Choosing Network Service Account for running the AD LDS Service.

Step by Step Guide to Setup LDAPS on Windows Server (15)

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

Step by Step Guide to Setup LDAPS on Windows Server (16)

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

Step by Step Guide to Setup LDAPS on Windows Server (17)

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

Step by Step Guide to Setup LDAPS on Windows Server (18)

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

Step by Step Guide to Setup LDAPS on Windows Server (19)

Once the instance is setup successfully, click Finish.

Step by Step Guide to Setup LDAPS on Windows Server (20)

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.

Step by Step Guide to Setup LDAPS on Windows Server (21)

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

Step by Step Guide to Setup LDAPS on Windows Server (22)

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.

Step by Step Guide to Setup LDAPS on Windows Server (23)

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

Step by Step Guide to Setup LDAPS on Windows Server (24)

Select ldapstest server from the server pool. Click Next.

Step by Step Guide to Setup LDAPS on Windows Server (25)

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

Step by Step Guide to Setup LDAPS on Windows Server (26)

Choose nothing from the list of features and click Next.

Step by Step Guide to Setup LDAPS on Windows Server (27)

Click Next.

Step by Step Guide to Setup LDAPS on Windows Server (28)

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

Step by Step Guide to Setup LDAPS on Windows Server (29)

Click Install to confirm installation.

Step by Step Guide to Setup LDAPS on Windows Server (30)

Once installation is complete, Click Close.

Step by Step Guide to Setup LDAPS on Windows Server (31)

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.

Step by Step Guide to Setup LDAPS on Windows Server (32)

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

Step by Step Guide to Setup LDAPS on Windows Server (33)

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

Step by Step Guide to Setup LDAPS on Windows Server (34)

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

Step by Step Guide to Setup LDAPS on Windows Server (35)

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

Step by Step Guide to Setup LDAPS on Windows Server (36)

Choosing SHA1 as the Hash algorithm. Click Next.

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

Step by Step Guide to Setup LDAPS on Windows Server (37)

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

Step by Step Guide to Setup LDAPS on Windows Server (38)

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

Step by Step Guide to Setup LDAPS on Windows Server (39)

Choosing default database locations, click Next.

Step by Step Guide to Setup LDAPS on Windows Server (40)

Click Configure to confirm.

Step by Step Guide to Setup LDAPS on Windows Server (41)

Once the configuration is successful/complete. Click Close.

Step by Step Guide to Setup LDAPS on Windows Server (42)

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:

Step by Step Guide to Setup LDAPS on Windows Server (43)

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

Step by Step Guide to Setup LDAPS on Windows Server (44)

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.

Step by Step Guide to Setup LDAPS on Windows Server (45)

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”.

Step by Step Guide to Setup LDAPS on Windows Server (46)

This opens the Certificate Export Wizard. Click Next.

Step by Step Guide to Setup LDAPS on Windows Server (47)

Do not export the private key. Click Next.

Step by Step Guide to Setup LDAPS on Windows Server (48)

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

Step by Step Guide to Setup LDAPS on Windows Server (49)

Exporting the .CER to Desktop. Click Next.

Step by Step Guide to Setup LDAPS on Windows Server (50)

Click Finish to complete the certificate export.

Step by Step Guide to Setup LDAPS on Windows Server (51)

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"

Step by Step Guide to Setup LDAPS on Windows Server (52)

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:

Step by Step Guide to Setup LDAPS on Windows Server (53)

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

Step by Step Guide to Setup LDAPS on Windows Server (54)

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

Step by Step Guide to Setup LDAPS on Windows Server (55)

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

Step by Step Guide to Setup LDAPS on Windows Server (56)

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

Step by Step Guide to Setup LDAPS on Windows Server (2024)
Top Articles
Dillon, MT Single Family Homes for Sale | realtor.com®
John 14 15 21 Niv
Spasa Parish
Rentals for rent in Maastricht
159R Bus Schedule Pdf
Sallisaw Bin Store
Black Adam Showtimes Near Maya Cinemas Delano
Espn Transfer Portal Basketball
Pollen Levels Richmond
11 Best Sites Like The Chive For Funny Pictures and Memes
Things to do in Wichita Falls on weekends 12-15 September
Craigslist Pets Huntsville Alabama
Paulette Goddard | American Actress, Modern Times, Charlie Chaplin
Red Dead Redemption 2 Legendary Fish Locations Guide (“A Fisher of Fish”)
What's the Difference Between Halal and Haram Meat & Food?
R/Skinwalker
Rugged Gentleman Barber Shop Martinsburg Wv
Jennifer Lenzini Leaving Ktiv
Justified - Streams, Episodenguide und News zur Serie
Epay. Medstarhealth.org
Olde Kegg Bar & Grill Portage Menu
Cubilabras
Half Inning In Which The Home Team Bats Crossword
Amazing Lash Bay Colony
Juego Friv Poki
Dirt Devil Ud70181 Parts Diagram
Truist Bank Open Saturday
Water Leaks in Your Car When It Rains? Common Causes & Fixes
What’s Closing at Disney World? A Complete Guide
New from Simply So Good - Cherry Apricot Slab Pie
Drys Pharmacy
Ohio State Football Wiki
Find Words Containing Specific Letters | WordFinder®
FirstLight Power to Acquire Leading Canadian Renewable Operator and Developer Hydromega Services Inc. - FirstLight
Joanna Gaines Reveals Who Bought the 'Fixer Upper' Lake House and Her Favorite Features of the Milestone Project
Tri-State Dog Racing Results
Navy Qrs Supervisor Answers
Trade Chart Dave Richard
Lincoln Financial Field Section 110
Free Stuff Craigslist Roanoke Va
Wi Dept Of Regulation & Licensing
Pick N Pull Near Me [Locator Map + Guide + FAQ]
Crystal Westbrooks Nipple
Ice Hockey Dboard
Über 60 Prozent Rabatt auf E-Bikes: Aldi reduziert sämtliche Pedelecs stark im Preis - nur noch für kurze Zeit
Wie blocke ich einen Bot aus Boardman/USA - sellerforum.de
Infinity Pool Showtimes Near Maya Cinemas Bakersfield
Dermpathdiagnostics Com Pay Invoice
How To Use Price Chopper Points At Quiktrip
Maria Butina Bikini
Busted Newspaper Zapata Tx
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 6002

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.