Obtaining an IntialContext from Weblogic without u

2019-07-05 05:58发布

I can obtain the Weblogic InitialContext from a JNDI Client using the following properties as the Environment parameters for InitialContext

Hashtable jndiProps = new Hashtable();
jndiProps.put("java.naming.factory.initial", "t3://localhost:7001");
jndiProps.put("java.naming.provider.url", "weblogic.jndi.WLInitialContextFactory");
jndiProps.put("java.naming.security.principal", "weblogic");
jndiProps.put("java.naming.security.credentials", "weblogic");

InitialContext ctx = new InitialContext(jndiProps);

The question is, is there a way to obtain the InitialContext without specifying the security.credentials as cleartext but maybe as a hashed value?

2条回答
我只想做你的唯一
2楼-- · 2019-07-05 06:20

You could use symmetric encryption, encrypt the password value and store this in the properties file. Then before creating the initial context read the property value, decrypt it and update the property before passing the jndiProps object to the InitialContext constructor.

The encryption key would still be on the client but it's going to stop someone casually reading the property file to find out the password.

Using SSL is also a good idea for protecting the password as it is transmitted between the client and the server.

查看更多
等我变得足够好
3楼-- · 2019-07-05 06:24

Simply hashing the password has no real added security value. Since your password resides on the client anyway.

The bigest gains are to be had by using SSL encryption on your channel first with t3s and secondly a user with the least amount of privilges instead of the admin users "weblogic".

查看更多
登录 后发表回答