禁用 JVM 上的本地 JMX 连接

发布于 2024-08-01 14:19:51 字数 211 浏览 3 评论 0原文

我们正在编写一个在内存中保存密码的java程序。 不幸的是,用户可以轻松地使用 jconsole 或 jmap 创建堆转储文件并打开它来查找密码。 我认为 jconsole 使用本地套接字连接 jvm。 我想知道,有什么方法可以禁用本地用户的 jmx 吗? 有没有办法完全禁用堆转储? 由于用户可以访问内存段,因此无论如何都可以访问密码。 但是,我想禁用执行此操作的标准方法,以使操作尽可能昂贵。

We are writing a java program which keeps a password in memory. Unfortunately, the user can easily use jconsole or jmap to create a heap dump file and open it to find the password. I think jconsole connects jvm using local sockets. I wanna know, is there any way to disable jmx even for local users? Is there any way to totally disable heap dumps? As the user have access to the memory segment, this is possible to access the password anyway. However, I wanna disable standards ways of doing that to make the action as expensive as possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最终幸福 2024-08-08 14:19:51

将最大连接计数设置为零会关闭 JMX

-Dsun.rmi.transport.tcp.maxConnectionThreads=0

如果您仍然需要统计信息,只需读取相应的 hsperfdata_* 文件

编辑:
我在 github 上发布了我的 hsperf munin 插件

Setting the max connection count to zero shuts down JMX

-Dsun.rmi.transport.tcp.maxConnectionThreads=0

If you still need stats, simple read the corresponding hsperfdata_* file

Edit:
I published my hsperf munin plugin on github.

鹿港小镇 2024-08-08 14:19:51

最后,我找到了禁用 jconsole 连接的解决方案。 它还阻止 jmap 创建转储文件。 我在此处找到了解决方案。 我这里也引用一下这个答案:

您可以阻止诸如
jconsole 和其他人通过连接
与运行
-XX:+DisableAttachMechanism 选项。 注意这个选项不是
记录/支持但应该这样做
你想要什么。 也就是说,即使
没有什么可以阻止你
连接gdb或其他调试/proc
基于程序

,很明显内存段可以在本地访问。 但是,有谁知道有一种工具可以通过直接访问内存来进行标准内存转储吗?

Finally, I found a solution for disabling jconsole connections. It also prevents jmap to create a dump file. I found the solution here. I also quote the answer here:

You can prevent tools such as
jconsole and others from connecting by
running with the
-XX:+DisableAttachMechanism option. Note that this option is not
documented/supported but should do
what you want. That said, even with
this there is nothing to stop you
connect gdb or other debugging/proc
based programs

However, that is obvious the memory segment could be accessed locally. But, does anyone knows a tool to make standard memory dumps with direct access to the memory?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文