簡體   English   中英

Spring Boot 2 應用程序無法覆蓋 RMIRegistry 默認端口 1099 以確保 JMX 連接安全

[英]Spring Boot 2 application cannot overwrite RMIRegistry default port 1099 to make JMX connections safe

不幸的是,我們的Spring Boot 2 應用程序公開了RMI 注冊表默認端口1099 ,我們的安全團隊對此有所抱怨。 我們希望JMX應該以安全的方式專門通過端口 8999 使用。 目前,您可以通過兩種方式進行連接 - 通過端口 1099 不安全和通過端口 8999 安全。到目前為止我們不了解這一點,因為我們實際上已經設置了正確的系統屬性來防止這種情況:

-Dcom.sun.management.jmxremote=true 
-Dcom.sun.management.jmxremote.port=8999
-Dcom.sun.management.jmxremote.rmi.port=8999
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=true 
-Dcom.sun.management.jmxremote.password.file=/opt/our_app/jmxremote.password 
-Dcom.sun.management.jmxremote.access.file=/opt/our_app/jmxremote.access

為什么端口 1099 仍然打開? 我不得不提到Spring Actuator也在使用中,但我找不到任何配置來控制端口,所以這似乎不是問題。

感謝 Ravi Sharam 在上面的評論中給出了解決方案。

我們的項目中有以下依賴項:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-activemq</artifactId>
</dependency>

通過使用系統屬性額外啟動應用程序

-Dorg.apache.activemq.broker.jmx.createConnector=false

開放的默認端口 1099 已刪除。 讓我們用netstat 來檢查一下:

root@protect01:/opt/our_app# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      29956/rpcbind
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      19282/systemd-resol
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1421/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      25126/master
tcp        0      0 0.0.0.0:8001            0.0.0.0:*               LISTEN      988/java
tcp6       0      0 :::8999                 :::*                    LISTEN      988/java
tcp6       0      0 :::111                  :::*                    LISTEN      29956/rpcbind
tcp6       0      0 :::80                   :::*                    LISTEN      3986/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      1421/sshd
tcp6       0      0 127.0.0.1:8089          :::*                    LISTEN      988/java
tcp6       0      0 ::1:25                  :::*                    LISTEN      25126/master
tcp6       0      0 :::34139                :::*                    LISTEN      988/java
tcp6       0      0 :::11099                :::*                    LISTEN      988/java
tcp6       0      0 :::443                  :::*                    LISTEN      3986/apache2
tcp6       0      0 :::45093                :::*                    LISTEN      988/java

沒有開放端口 1099 了,只有預期的 8999。 Yippiiii!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM