Ivan, I like your code snippet. AFAIK, choosing SSL way is simpler for those who want to work with Active Directory. The patch [1] worked for me.
[1] http://openmeetings.googlecode.com/issues/attachment?aid=-1165718617088437398&name=enable_rtmps_8443.patch On Fri, Jul 17, 2009 at 2:05 PM, bidab <ivan.bol...@gmail.com> wrote: > > Hi, > > I know some people would have encrypted ldap password so I search an > issue but I am not a progamming student. > > I use wireshark to scan packets and ldap password are send in plaint > text between openmeetings and AD server so I suggest to use SSL and > keystore. I am lost with keystore, I downloaded keytool and could > create a keystore file but doesn't function... > > > Presently, I try with this code : > > import java.util.*; > import javax.naming.*; > import javax.naming.directory.Attribute; > import javax.naming.directory.Attributes; > import javax.naming.directory.DirContext; > import javax.naming.directory.InitialDirContext; > > > public class MakeRoot { > final static String ldapServerName = "serverName"; > final static String rootdn = > "CN=user,OU=...,OU=...,DC=...,DC=..."; > final static String rootpass = "password"; > final static String rootContext = "OU=...,OU=...,DC=...,DC=..."; > public static void main( String[] args ) {// set up environment > to access the server > Properties env = new Properties(); > > System.setProperty("javax.net.ssl.trustStore", "C:/ > Program Files/Java/jdk1.6.0_13/jre/lib/cacerts"); > > //System.setProperty("javax.net.debug", "all"); > > env.put > ( Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory" ); > env.put(Context.PROVIDER_URL, "ldap://" + > ldapServerName + "/" ); > env.put( Context.SECURITY_PRINCIPAL, rootdn ); > env.put( Context.SECURITY_CREDENTIALS, rootpass ); > env.put(Context.SECURITY_PROTOCOL, "ssl"); > > > > try {// obtain initial directory context using the > environment > DirContext ctx = new InitialDirContext( env ); > // now, create the root context, which is just a > subcontext > // of this initial directory context. > //ctx.createSubcontext( rootContext ); > Attributes attributs = ctx.getAttributes(rootdn); > Attribute attribut = (Attribute) attributs.get > ("description") ; > System.out.println("Description : " + attribut.get > ()); > > } catch ( NameAlreadyBoundException nabe ) { > System.err.println( rootContext + " has already > been bound!" ); > } catch ( Exception e ) { > System.err.println( e ); > } > } > > } > > > To help you, some links : > > http://java.sun.com/products/jndi/tutorial/ldap/security/ssl.html > http://blog.hbis.fr/2009/07/04/java_keytoo/ > > http://www.developpez.net/forums/d37734/java/developpement-web-java/ssl-keytool-vs-openssl/ > http://www.devx.com/tips/Tip/39936 > http://forums.sun.com/thread.jspa?threadID=473645&messageID=3347607 > > Bidab > > > -- With best regards / с наилучшими пожеланиями, Alexei Fedotov / Алексей Федотов, http://www.telecom-express.ru/ http://harmony.apache.org/ http://code.google.com/p/openmeetings/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OpenMeetings User" group. To post to this group, send email to openmeetings-user@googlegroups.com To unsubscribe from this group, send email to openmeetings-user+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/openmeetings-user?hl=en -~----------~----~----~----~------~----~------~--~---