Jboss Jmx-Console和 Jboss web-console安全設置


1、介紹

      如果你暴露你的JBoss服務器通過網絡(如通過啟動服務器使用選項B 0.0.0.0或者通過改變jboss.bind.address首次出現0.0.0.0在.../jboss/server/default/deploy/web-deployer/server.xml)你自動也暴露了Jboss web控制台(http://localhost:8080/jmx-console)因為管理員工具沒有任何用戶和密碼。

 

注意:在下面的設置例子中,為默認的jboss服務器配置被使用。

2、jmx-console安全設置

2.1、在../jboss/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml 取消如下注釋:

  1. <security-domain>java:/jaas/jmx-console</security-domain>  
<security-domain>java:/jaas/jmx-console</security-domain>

2.2、在../jboss/server/default/deploy/jmx-console.war/WEB-INF/web.xml 取消如下注釋:

  1. <security-constraint>  
  2.    <web-resource-collection>  
  3.      <web-resource-name>HtmlAdaptor</web-resource-name>  
  4.      <description>An example security config that only allows users with the  
  5.        role JBossAdmin to access the HTML JMX console web application  
  6.      </description>  
  7.      <url-pattern>/*</url-pattern>  
  8.      <http-method>GET</http-method>  
  9.      <http-method>POST</http-method>  
  10.    </web-resource-collection>  
  11.    <auth-constraint>  
  12.      <role-name>JBossAdmin</role-name>  
  13.    </auth-constraint>  
  14.  </security-constraint>  
  <security-constraint>
     <web-resource-collection>
       <web-resource-name>HtmlAdaptor</web-resource-name>
       <description>An example security config that only allows users with the
         role JBossAdmin to access the HTML JMX console web application
       </description>
       <url-pattern>/*</url-pattern>
       <http-method>GET</http-method>
       <http-method>POST</http-method>
     </web-resource-collection>
     <auth-constraint>
       <role-name>JBossAdmin</role-name>
     </auth-constraint>
   </security-constraint>

2.3、在..../jboss/server/default/conf/props/jmx-console-users.properties 添加或者編輯 admin=a_password_you_like

指定一個不同的用戶對jbossadmin組添加“用戶名= jbossadmin”到jmx-console-roles.properties.properties文件(同一目錄)。

現有的jmx-console-users.properties文件與密碼admin管理用戶。為了安全,刪除用戶或更改密碼更強的人。

 

3、web-console安全設置

3.1、在.../jboss/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/jboss-web.xml 取消如下注釋:

  1. <security-domain>java:/jaas/web-console</security-domain>  
<security-domain>java:/jaas/web-console</security-domain>

3.2、在../jboss/server/defualt/deploy/management/console-mgr.sar/web-console.war/WEB-INF/web.xml取消如下注釋:

  1. <security-constraint>  
  2.    <web-resource-collection>  
  3.    <web-resource-name>HtmlAdaptor</web-resource-name>  
  4.    <description>An example security config that only allows users with the  
  5.    role JBossAdmin to access the HTML JMX console web application  
  6.    </description>  
  7.    <url-pattern>/*</url-pattern>  
  8.    <http-method>GET</http-method>  
  9.    <http-method>POST</http-method>  
  10.    </web-resource-collection>  
  11.    <auth-constraint>  
  12.    <role-name>JBossAdmin</role-name>  
  13.    </auth-constraint>  
  14.    </security-constraint>  
<security-constraint>
   <web-resource-collection>
   <web-resource-name>HtmlAdaptor</web-resource-name>
   <description>An example security config that only allows users with the
   role JBossAdmin to access the HTML JMX console web application
   </description>
   <url-pattern>/*</url-pattern>
   <http-method>GET</http-method>
   <http-method>POST</http-method>
   </web-resource-collection>
   <auth-constraint>
   <role-name>JBossAdmin</role-name>
   </auth-constraint>
   </security-constraint>


3.3、在.../jboss/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/classes/web-console-users.properties 添加或者編輯行admin=a_password_you_like

指定一個不同的用戶對jbossadmin組添加“用戶名= jbossadmin”到web-console-roles.properties.properties文件(同一目錄)。

現有的web-console-users.properties文件與密碼admin管理用戶。為了安全,刪除用戶或更改密碼更強的人。

4、實例

4.1、jmx-console安全配置

第一步:打開jboss/server/default/deploy/jmx-console.war/WEB-INF目錄下jboss-web.xml文件,添加security-domain,如下圖-1所示:

圖-1

第二步:同級目錄打開web.xml,添加如下代碼,如下圖-2所示:

圖-2

同時查看對應的角色是否存在,如下圖-3所示:

圖-3

第三步:打開jboss/server/default/conf目錄下login-config.xml文件,如下下圖-4所示:

圖-4

在按照上圖中路徑找到如下文件,如下圖-5所示:

圖-5

打開users相關文檔,更改admin的密碼為etim123$%^,如下圖-6所示:

圖-6

4.2、web-console的安全設置

第一步:打開如下圖所示目錄下的jboss-web.xml。

 

打開jboss-web.xml添加如下內容:

打開同級目錄下的web.xml,添加如下內容:

如下圖所示路徑,修改文件名稱為roles.properties和users.properties

打開修改過后的users.properties配置文件,如下圖所示:

 

打開如下路徑的login-config.xml,修改為users.properties

更改為如下圖所示

保存成功后,啟動服務器輸入:http://localhost:8080/jmx-consolehttp://localhost:8080/web-console測試安全機制,是否和自己修改后的賬號信息一致。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM