自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Windows下JBoss配置詳解

開(kāi)發(fā) 后端
本文向您介紹了在Windows下JBoss配置,并詳細(xì)描述了JBoss配置時(shí)用到的代碼。

JBoss配置

1.jmx-console 登錄的用戶名和密碼設(shè)置

默認(rèn)情況訪問(wèn) http://localhost:8080/jmx-console 就可以瀏覽jboss的部署管理的一些信息,不需要輸入用戶名和密碼,使用起來(lái)有點(diǎn)安全隱患。下面我們針對(duì)此問(wèn)題對(duì)jboss進(jìn)行配置,使得訪問(wèn)jmx-console也必須要知道用戶名和密碼才可進(jìn)去訪問(wèn)。JBoss配置步驟如下:

1)找到JBoss安裝目錄/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml文件,去掉<security-domain>java:/jaas/jmx-console</security-domain>的注釋。修改后的該文件內(nèi)容為:

 

  1. <jboss-web> 
  2.    <!-- Uncomment the security-domain to enable security. You will  
  3.       need to edit the htmladaptor login configuration to setup the  
  4.       login modules used to authentication users.--> 
  5.       <security-domain>java:/jaas/jmx-console</security-domain> 
  6. </jboss-web> 

2)修改與i)中的jboss-web.xml同級(jí)目錄下的web.xml文件,查找到<security-constraint/>節(jié)點(diǎn),去掉它的注釋,修改后該部分內(nèi)容為:

 

  1. <!-- A security constraint that restricts access to the HTML JMX console  
  2.    to users with the role JBossAdmin. Edit the roles to what you want and  
  3.    uncomment the WEB-INF/jboss-web.xml/security-domain element to enable  
  4.    secured access to the HTML JMX console.--> 
  5.    <security-constraint> 
  6.      <web-resource-collection> 
  7.        <web-resource-name>HtmlAdaptor</web-resource-name> 
  8.        <description>An example security config that only allows users with the  
  9.          role JBossAdmin to access the HTML JMX console web application  
  10.        </description> 
  11.        <url-pattern>/*</url-pattern> 
  12.        <http-method>GET</http-method> 
  13.        <http-method>POST</http-method> 
  14.      </web-resource-collection> 
  15.      <auth-constraint> 
  16.        <role-name>JBossAdmin</role-name> 
  17.      </auth-constraint> 
  18.    </security-constraint> 

3) 在第一步中的jmx-console安全域和第二步中的運(yùn)行角色JBossAdmin都是在login-config.xml中配置,我們?cè)贘Boss安裝目錄/server/default/config下找到它,并進(jìn)行JBoss配置。查找名字為:jmx-console的application-policy:

 

  1. <application-policy name = "jmx-console"> 
  2.        <authentication> 
  3.           <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" 
  4.              flag = "required"> 
  5.            <module-option name="usersProperties">props/jmx-console-users.properties</module-option> 
  6.            <module-option name="rolesProperties">props/jmx-console-roles.properties</module-option> 
  7.           </login-module> 
  8.        </authentication> 
  9.     </application-policy> 


在此處可以看出,登錄的角色、用戶等的信息分別在props目錄下的jmx-console-roles.properties和jmx-console-users.properties文件中設(shè)置,分別打開(kāi)這兩個(gè)文件。

其中jmx-console-users.properties文件的內(nèi)容如下:

# A sample users.properties file for use with the UsersRolesLoginModule

admin=admin

該文件定義的格式為:用戶名=密碼,在該文件中,默認(rèn)定義了一個(gè)用戶名為admin,密碼也為admin的用戶,讀者可將其改成所需的用戶名和密碼。

jmx-console-roles.properties的內(nèi)容如下:

# A sample roles.properties file for use with the UsersRolesLoginModule

admin=JBossAdmin, HttpInvoker

該文件定義的格式為:用戶名=角色,多個(gè)角色以“,”隔開(kāi),該文件默認(rèn)為admin用戶定義了JBossAdmin和HttpInvoker這兩個(gè)角色。

配置完成后讀者可以通過(guò)訪問(wèn): http://localhost:8088/jmx-console/ ,輸入jmx-console-roles.properties文件中定義的用戶名和密碼,訪問(wèn)jmx-console的頁(yè)面。

2.web-console 登錄的用戶名和密碼設(shè)置

默認(rèn)情況下,用戶訪問(wèn)JBoss的web-console時(shí),不需要輸入用戶名和密碼,為了安全起見(jiàn),我們通過(guò)修改配置來(lái)為其加上用戶名和密碼。步驟如下:

1)找到JBoss安裝目錄"server"default"deploy"management"console-mgr.sar"web-console.war"WEB-INF"jboss-web.xml文件,去掉<security-domain>java:/jaas/web-console</security-domain>的注釋,修改后的文件內(nèi)容為:

 

  1. <?xml version='1.0' encoding='UTF-8' ?> 
  2. <!DOCTYPE jboss-web  
  3.     PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"  
  4.     "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"> 
  5. <jboss-web> 
  6.    <!-- Uncomment the security-domain to enable security. You will  
  7.    need to edit the htmladaptor login configuration to setup the  
  8.    login modules used to authentication users.--> 
  9.    <security-domain>java:/jaas/web-console</security-domain> 
  10.    <!-- The war depends on the --> 
  11.    <depends>jboss.admin:service=PluginManager</depends> 
  12. </jboss-web> 

2)打開(kāi)1)中jboss-web.xml同目錄下的web.xml文件,去掉<security-constraint>部分的注釋,修改后的該部分內(nèi)容為:

 

  1. <!-- A security constraint that restricts access to the HTML JMX console  
  2.    to users with the role JBossAdmin. Edit the roles to what you want and  
  3.    uncomment the WEB-INF/jboss-web.xml/security-domain element to enable  
  4.    secured access to the HTML JMX console.--> 
  5.    <security-constraint> 
  6.    <web-resource-collection> 
  7.    <web-resource-name>HtmlAdaptor</web-resource-name> 
  8.    <description>An example security config that only allows users with the  
  9.    role JBossAdmin to access the HTML JMX console web application  
  10.    </description> 
  11.    <url-pattern>/*</url-pattern> 
  12.    <http-method>GET</http-method> 
  13.    <http-method>POST</http-method> 
  14.    </web-resource-collection> 
  15.    <auth-constraint> 
  16.    <role-name>JBossAdmin</role-name> 
  17.    </auth-constraint> 
  18.    </security-constraint> 

3)打開(kāi)JBoss安裝目錄"server"default"conf下的login-config.xml文件,搜索web-console,可找到如下內(nèi)容:

 

  1. <application-policy name = "web-console"> 
  2.        <authentication> 
  3.           <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" 
  4.              flag = "required"> 
  5.              <module-option name="usersProperties">web-console-users.properties</module-option> 
  6.              <module-option name="rolesProperties">web-console-roles.properties</module-option> 
  7.           </login-module> 
  8.        </authentication> 
  9.     </application-policy> 

以上代碼就可以完成JBoss配置了。

【編輯推薦】

  1. 如何解決JBoss和log4j沖突
  2. JBoss集群配置代碼實(shí)例
  3. JBoss集群配置前言與集群知識(shí)
  4. MyEclipse+JBoss配置
  5. JBoss簡(jiǎn)介告訴我們JBoss是什么
責(zé)任編輯:佚名 來(lái)源: JavaEye
相關(guān)推薦

2010-05-04 10:56:18

jboss負(fù)載均衡

2010-05-24 19:42:54

SVN權(quán)限配置

2017-01-05 22:28:16

WindowsNano Server部署

2010-05-31 15:55:42

2009-06-03 16:33:53

安裝jdk tomcaeclipse配置

2009-06-18 15:15:35

JBoss的配置

2009-06-15 12:59:09

JBoss配置

2009-06-12 14:12:18

JBoss配置MyEclipse

2010-05-24 16:21:55

SVNServer安裝

2010-05-24 16:21:55

SVNServer安裝

2009-06-15 09:01:19

安裝Jboss

2009-06-15 13:56:02

linux下安裝JBo

2009-11-30 09:56:16

2009-06-26 17:37:37

JBOSS配置

2009-06-12 15:54:07

JBoss集群配置

2009-06-15 13:24:46

JBoss數(shù)據(jù)源

2011-06-24 17:05:07

QT QT 4.7.3 windows

2010-05-25 12:41:19

Subversion

2010-06-07 09:47:34

php sendmai

2011-03-02 13:23:42

Vsftpd配置
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)