我正在使用JConsole来访问正在运行的MBean。
MBean使用定制的Jaas登录模块,并使用以下命令运行:
java -classpath UserLGUGroupHandlingApplication.jar;MBeanSecure.jar
-com.sun.management.jmxremote.login.config=management.properties
-Djava.security.auth.login.config=./sample_jaas.config
com.test.running.RunningImplementation
使用management.properties文件,如下所示:
com.sun.management.jmxremote.access.file=jmxremote.access
com.sun.management.jmxremote=true
com.sun.management.jmxremote.authenticate=true
com.sun.management.jmxremote.port=1234
com.sun.management.jmxremote.login.config=Sample
com.sun.management.jmxremote.ssl=false
com.sun.management.jmxremote.ssl.need.client.auth=false
和sample_jaas.config:
Sample {
test.module.AETTLoginModule required debug=true;
};
然后用户将通过从命令行通过JConsole登录来访问此正在运行的进程。
jconsole -debug //or just jconsole
用户使用RemoteProcess'localhost:1234'选择'远程连接'
loginmodule根据当前登录到Windows的用户来处理用户验证和主体设置,该模块用于查询单独的授权逻辑以确定访问级别。
我想发生的事情:
问题:
要在jconsole窗口中访问jmx进程,我必须输入虚拟的用户名和密码,例如U:a,P:a,否则会出现以下错误:
java.lang.SecurityException: Authentication failed! Credentials required
at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticationFailure(JMXPluggableAuthenticator.java:193)
at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticate(JMXPluggableAuthenticator.java:145)
at sun.management.jmxremote.ConnectorBootstrap$AccessFileCheckerAuthenticator.authenticate(ConnectorBootstrap.java:201)
at javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:213)
at javax.management.remote.rmi.RMIServerImpl.newClient(RMIServerImpl.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:303)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2327)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:277)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:225)
at sun.tools.jconsole.ProxyClient.tryConnect(ProxyClient.java:334)
at sun.tools.jconsole.ProxyClient.connect(ProxyClient.java:296)
at sun.tools.jconsole.VMPanel$2.run(VMPanel.java:280)
题
为了运行Jaas登录模块,我需要以下设置:
-Dcom.sun.management.jmxremote.authenticate=true
但是,这还会在JConsole中创建一个条件,其中必须在该字段中打开用户名和passowrd字段。
如果将其设置为false,则永远不会调用loginmodule。
是否可以为特定实例扩展Jconsole功能,应用配置设置或启用jaas登录模块而无需进行设置:
-Dcom.sun.management.jmxremote.authenticate=true
为了避免在以下突出显示的以下字段中输入用户名和密码:
我正在寻找与此处演示的解决方案相似的解决方案。但无需用户输入用户名或密码字段。
编辑:此外,为了澄清,这需要在不修改客户端JCONSOLE的情况下完成,因此仅使用服务器端的更改和设置即可。
通过此链接。尤其是第3种情况,可能会对您有所帮助。
*****在询问了更多问题后,进行了更多更新*****************
基本上,您要实现的目的是为特定客户端连接绕过(提供的JAAS)安全性在您的情况下是JCONSOLE。...我建议:-1)有两个用于JMX服务器的端口:安全和不安全...对JCONSOLE使用非安全端口,或者
2)如果您正在编写自己的端口自定义的JAAS模块,请尝试在login()方法中编写代码以跳过特定客户端的连接-我不确定这是否可行,因为您将如何知道请求客户端的上下文...
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句