Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use LDAP server via Proxy?

 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a LDAP server which needs to be accessed by a proxy. How can I access it via a proxy? If it were Http server then I can use System.setProperty("http.proxyHost","1.1.1.1") sort of settings for host and port but I don't know if my LDAP server requires proxy then how do I do it?
Do we have anything like- ldap.proxyHost or something?
I tried with socksProxyHost, socksProxyPort but I don't know what to give in as socksProxyHost? I know my http/ftp/ssl proxy server's IP address and the socksProxyPort should be 1080 though.
Any help would be great.
Regards
Maulin
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I'm not understanding the problem... if the proxy server is operating correctly, then it shouldn't matter how you access the LDAP server. The proxy should be transparent to your LDAP client.
Have you tried using JNDI (javax.naming.ldap package) instead of using the lower level socks approach?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Phillip
Thanks for your response.
Well, I am using JNDI and the ldap package you mentioned. I will try to re-explain my concern,
1. I have a ldap server X
2. I have a development server Y
3. Y is internal machine to my network which is not allowed to make connection to X directly
4. I have a proxy P that is used to access other servers. e.g. to do telnet, to access html page on those servers via setting browser proxy etc
Now, I know that to do a telnet to some external machine which is not allowing direct telnet to my internal machine, I have to first login to the proxy server (via ssh or telnet) and then do telnet to the external machine. Similarly, if I want to make URLConnection from a code residing on my internal machine to the external server then I use,
System.setProperty("http.proxy","myproxy");
System.setProperty("http.port","myproxyport");
But what if I have to make LDAP connection via JNDI to the external ldap machine which doesn't allow my internal machine to connect to itself directly? I guess, setting above same properties doesn't help me because they are for HTTP proxy , right?
I hope I am able to explain my problem.
Regards
Maulin
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand the issue now. I think that the proxy server must be set up to work with the port/protocol that you want to use. I doubt there is a way around that.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Philip
Well, its not really a big issue for me. It was just that I was curious to know if there is a way. Its not hard-and-fast requirement but I have a GUI that can list schema of a given LDAP server and that GUI is on my PC and the LDAP is outside the reach of my PC as I mentioned, so I am little stuck.
Anyways, I also thought that there has to be some support for the protocol via which proxy can work for LDAP connections like http and ftp. May be this could be a start point of some open source development
Regards
Maulin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic