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

来源:互联网 发布:网络用语肝是什么意思 编辑:程序博客网 时间:2024/05/13 08:21

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 取消如下注释:

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

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

  <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 取消如下注释:

<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取消如下注释:

<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-console和http://localhost:8080/web-console测试安全机制,是否和自己修改后的账号信息一致。
0 0
原创粉丝点击