gpt4 book ai didi

java - 我如何在 JBoss 中禁用 RMI?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:01:02 24 4
gpt4 key购买 nike

由于存在各种 RMI 漏洞,而且事实上我根本不使用它,我想至少在外部禁用我的 JBoss 服务器上的 RMI,但我不确定如何在不破坏东西的情况下做到这一点.

我试过禁用 JRMP 调用程序,这似乎有效,但问题是我无法启动和停止我的服务器,因为命令:

sudo -u $JBOSS_USER $JBOSS_HOME/bin/shutdown.sh -S

返回错误:

Exception in thread "main" javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: invoker not bound]
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1215)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:758)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jboss.Shutdown.main(Shutdown.java:214)
Caused by: javax.naming.NameNotFoundException: invoker not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
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:592)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:613)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1209)
... 4 more

我没有看到/path/to/jboss/server/default/conf/jboss-service.xml 中其他任何地方引用了调用程序,所以我不确定我需要删除哪些其他引用。

关于我做错了什么或者我只是要求相互排斥的功能有什么想法吗?

最佳答案

在 JBoss 4 中,有几个对 RMI 调用程序的引用:

conf/standardjboss.xml

JBoss 中的很多功能都使用了 RMI,即使您的应用程序没有。最简单的解决方案是将 JBoss 绑定(bind)到远程无法访问的地址:

-b 127.0.0.1

更新

如果您只想在本地绑定(bind) RMI,请编辑 jboss-service.xml 文件中的 BindAddress 和 RmiBindAddress 属性:

<mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming">
<attribute name="Port">1099</attribute>
<attribute name="BindAddress">127.0.0.1</attribute>
<attribute name="RmiPort">1098</attribute>
<attribute name="RmiBindAddress">127.0.0.1</attribute>
</mbean>

关于java - 我如何在 JBoss 中禁用 RMI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6766520/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com