Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 984379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:00:24+00:00 2026-05-16T05:00:24+00:00

I am new to LDAP and JNDI. I have setup a LDAP server with

  • 0

I am new to LDAP and JNDI. I have setup a LDAP server with SSL using OpenDS and a client which uses JNDI to access LDAP.

What can I do to ensure that I am really communicating via SSL to the LDAP server? This is because I don’t really see any difference from the client side when I am trying to accessing LDAP via SSL and without.

EDITED

I have setup the LDAP server using OpenDS. The directory only consist of 1 user. It’s DN is uid=defaultuser,ou=User,o=IT,dc=QuizPortal. The LDAP port = 1389 and SSL port = 1636. The default port 389 & 636 is currently being used by some other programs. I have also selected an option of generate self-sign certification.

The below is the code from the Client side. It basically do a simple query of the user’s attributes.

public static void main(String[] args)
{
    String INITCTX = "com.sun.jndi.ldap.LdapCtxFactory";
    String MY_HOST = "ldap://KhooGP-Comp3:1389";
    String MGR_DN = "cn=Directory Manager";
    String MGR_PW = "password";
    String MY_SEARCHBASE = "ou=User,o=IT,dc=QuizPortal";
    String MY_FILTER = "uid=defaultuser";
    String MY_ATTRS[] = {"cn", "telephoneNumber", "userPassword"};

    //Identify service provider to use
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, INITCTX);
    env.put(Context.PROVIDER_URL, MY_HOST);

    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL, MGR_DN);
    env.put(Context.SECURITY_CREDENTIALS, MGR_PW);

    try
    {
        // Create the initial directory context
        InitialDirContext initialContext = new InitialDirContext(env);
        DirContext ctx = (DirContext)initialContext;

        System.out.println("Context Sucessfully Initialized");

        SearchControls constraints = new SearchControls();
        constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);

        NamingEnumeration results = ctx.search(MY_SEARCHBASE, MY_FILTER, constraints);

        while(results != null && results.hasMore())
        {
            SearchResult sr = (SearchResult) results.next();
            String dn = sr.getName() + "," + MY_SEARCHBASE;
            System.out.println("Distinguished Name is " + dn);

            Attributes ar = ctx.getAttributes(dn, MY_ATTRS);

            if(ar == null)
            {
                System.out.println("Entry " + dn);
                System.out.println(" has none of the specified attributes\n");
            }
            else
            {
                for(int i=0; i<MY_ATTRS.length; i++)
                {
                    Attribute attr = ar.get(MY_ATTRS[i]);
                    System.out.println(MY_ATTRS[i] + ":");

                    for(Enumeration vals=attr.getAll(); vals.hasMoreElements();)
                    {
                        System.out.println("\t" + vals.nextElement());
                    }
                }
            }
        }
    }
    catch(Exception e)
    {
        System.err.println(e);
    }
}

I have also did netstat as per adviced and there is a communication on port 1636. So does that means I am really communicating on SSL already?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:00:24+00:00Added an answer on May 16, 2026 at 5:00 am

    On the server end you could require authenticated binds, then if you were NOT doing SSL then your app would fail.

    You could packet trace it to see if the data is clear text or encrypted.

    If you are using LDAP over SSL you are using port 636 in all likelyhood. So you could netstat to see what port you have connected on.

    If you are using TLS it is harder, since you use 389, but with StartTLS it starts clear text, then converts to using encryption.

    Do it in code? Dunno.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a new Base DN (dc=test,dc=dom) in OpenDS using JNDI,
I have a .Net client WPF application using System.DirectoryServices and LDAP for authentication. On
I am very new to NTLM/LDAP and trying to authenticate using NTML running on
I can get the OU object like.... DirectoryEntry de = new DirectoryEntry( LDAP://domain.com, DOMAIN\\Administrator,
I'm using this query by C# in Active Directory: DirectoryEntry de = new DirectoryEntry(LDAP://
I have implemented a pool for LDAP connections using Apache commons-pool. I cannot use
I am new to using ldap and slapd and I am having some trouble
I have the following code: $bind = new COM(LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local); When I execute it from
DirectoryEntry oDE = new DirectoryEntry(LDAP://DC=Test1,DC=Test2,DC=gov,DC=lk); using (DirectorySearcher ds = new DirectorySearcher(oDE)) { ds.PropertiesToLoad.Add(name); ds.PropertiesToLoad.Add(userPrincipalName);
I'm really new to LDAP and just got a connection between my php server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.