JMX本地监控的访问控制

发布于 2024-10-08 03:11:00 字数 196 浏览 0 评论 0原文

我想编写一个非特权(非 root 访问)JMX 客户端程序,用于监视启用了 JMX 本地访问的特权(以 root 身份运行)应用程序 -Dcom.sun.management.jmxremote 。

至少在 MacOSX 上,当我以自己的身份运行时,jconsole(和 jps)看不到根进程。

这只是这里的生活事实吗,还是有某种方法可以配置它?

I want to write an unprivileged (non-root-access) JMX client program that monitors a privileged (running as root) application that has JMX local access enabled -Dcom.sun.management.jmxremote .

At least on MacOSX, jconsole (and jps) don't see root processes when I run as myself.

Is this just the fact of life here, or is there some way to configure this?

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

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

发布评论

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

评论(2

眼眸 2024-10-15 03:11:00

如果不允许您的客户端查看根进程,则您无法通过 PID 附加。您需要的是让根应用程序加载一个 JMXServer,它将侦听 [>1024] 端口,然后您可以通过该端口而不是通过 PID 进行连接。最简单的方法是指定更多的系统属性,这些属性将触发 JVM 自动加载 JMX 服务器。例如(这些都是最不安全的):

  • -Dcom.sun.management.jmxremote.authenticate=false
  • -Dcom.sun.management.jmxremote.ssl=false
  • -Dcom.sun.management.jmxremote.port=7777

请参阅JMX 管理和监视属性

要以编程方式创建 JMXServer,请参阅 JavaDoc 的 javax.management.remote。关于这个主题有一个非常好的指南/教程 这里< /a>.

If your client is not permitted to see the root process, then you cannot attach by PID. What you need is to have the root application load a JMXServer that will listen on a [>1024] port and then you can connect through the port rather than by PID. The easiest way to do this would be to specify a couple of more system properties which will trigger the JVM to load a JMX server automatically. For example (these are all the most insecure):

  • -Dcom.sun.management.jmxremote.authenticate=false
  • -Dcom.sun.management.jmxremote.ssl=false
  • -Dcom.sun.management.jmxremote.port=7777

See JMX Management and Monitoring Properties.

To create a JMXServer programmatically, see the JavaDoc for javax.management.remote. There is a really good guide/tutorial on this topic here.

舞袖。长 2024-10-15 03:11:00

JMX 使用一个简单的 TCP 端口,您可以使用一些命令行选项来定义该端口。如果端口开放,任何人(包括非特权用户)都应该能够看到它。

至于进程本身,jps看不到其他用户的进程,但你可以用“ps aux”看到。

JMX uses a simple TCP port that you can define with some command-line options. If the port is open, anyone (included non-priviledged users) should be able to see it.

As for the process itself, jps cannot see other user's process, but you can see then with "ps aux".

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