禁用 JVM 上的本地 JMX 连接
我们正在编写一个在内存中保存密码的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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将最大连接计数设置为零会关闭 JMX
如果您仍然需要统计信息,只需读取相应的 hsperfdata_* 文件
编辑:
我在 github 上发布了我的 hsperf munin 插件。
Setting the max connection count to zero shuts down JMX
If you still need stats, simple read the corresponding hsperfdata_* file
Edit:
I published my hsperf munin plugin on github.
最后,我找到了禁用 jconsole 连接的解决方案。 它还阻止 jmap 创建转储文件。 我在此处找到了解决方案。 我这里也引用一下这个答案:
,很明显内存段可以在本地访问。 但是,有谁知道有一种工具可以通过直接访问内存来进行标准内存转储吗?
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:
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?