[jboss-dev-forums] [JMX Development] - Connecting to secured JMX MBeans

Amit P do-not-reply at jboss.com
Fri Mar 26 01:00:47 EDT 2010


Amit P [http://community.jboss.org/people/apinke] created the discussion

"Connecting to secured JMX MBeans"

To view the discussion, visit: http://community.jboss.org/message/534104#534104

--------------------------------------------------------------
Hi ,

I have to access certain MBeans that secured by basic auth on jmx-console. I can access them using a standalone client as decribed
here :  http://www.len.ro/2006/12/jmx-invocation-with-secured-console/ http://www.len.ro/2006/12/jmx-invocation-with-secured-console/

Here is how it has worked for me till now :
I have a standalone java client  that I start up with a -Djava.security.auth.login.config=<path_to_auth_conf>
The auth.conf has no new entires and its the default one that is present in the default/conf
I create the CallBackHandler with the user and pwd and set the LoginContext

LoginContext lc = *new LoginContext("jmx-console", handler); //have tried "other" also .*
lc.login();









Hashtable env =
*new* Hashtable();String factory = "

org.jnp.interfaces.NamingContextFactory";env.put(Context.

+INITIAL_CONTEXT_FACTORY+, factory);env.put(Context.

+PROVIDER_URL+, jndiUrl);env.put(Context.

+SECURITY_CREDENTIALS+, pw);env.put(Context.

+SECURITY_PRINCIPAL+, userId);


Context ctx =
*new* InitialContext(env);



mbeanServer = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");

Using the above I am able to connect.

When I try the *same* code from within a servlet  it doesnt work. 
I get a principal=null for the domain error , which I think indicates that the user credentials are not getting passed.

Is there any other setting that i have to do in order to connect to a secured JMX server from *within* another JBOSS server ?
Any changes in user.properties , role.properties ? , any change in the auth-conf ? 
I dont know what changes to make to my local JBoss instance so that the servlet deployed in it can talk to remote JMX MBeans,

Any guidance and hints are highly appreciated !!

thanks
Pat







--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/534104#534104]

Start a new discussion in JMX Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2105]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20100326/ac9ff8b1/attachment.html 


More information about the jboss-dev-forums mailing list