1、jmx-console登录的用户名和密码设置

默认情况访问http://localhost:8080/jmx-console就可以浏览jboss的部署管理的一些信息,不需要输入用户名和密码,使用起来有点安全隐患。下面我们针对此问题对jboss进行配置,使得访问jmx-console也必须要知道用户名和密码才可进去访问。步骤如下:

(1)找到JBoss安装目录/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml文件,去掉<security-domain>java:/jaas/jmx-console</security-domain>的注释。修改后的该文件内容为:

<jboss-web>

<!-- Uncomment the security-domain to enable security. You will

need to edit the htmladaptor login configuration to setup the

login modules used to authentication users.

-->

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

</jboss-web>

(2)修改与(1)中的jboss-web.xml同级目录下的web.xml文件,查找到<security-constraint>节点,去掉它的注释,修改后该部分内容为:

<!-- A security constraint that restricts access to the HTML JMX console

to users with the role JBossAdmin. Edit the roles to what you want and

uncomment the WEB-INF/jboss-web.xml/security-domain element to enable

secured access to the HTML JMX console.

-->

<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) 在第一步中的jmx-console安全域和第二步中的运行角色JBossAdmin都是在login-config.xml中配置,我们在JBoss安装目录/server/default/config下找到它。查找名字为:jmx-console的application-policy:

<application-policy name = "jmx-console">

<authentication>

<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"

flag = "required">

<module-option name="usersProperties">props/jmx-console-users.properties</module-option>

<module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>

</login-module>

</authentication>

</application-policy>

在此处可以看出,登录的角色、用户等的信息分别在props目录下的jmx-console-roles.properties和jmx-console-users.properties文件中设置,分别打开这两个文件。

其中jmx-console-users.properties文件的内容如下:

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

admin=admin
该文件定义的格式为:用户名=密码,在该文件中,默认定义了一个用户名为admin,密码为admin的用户,可以自行修改成所需的用户名和密码。

jmx-console-roles.properties的内容如下:

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

admin=JBossAdmin, HttpInvoker

该文件定义的格式为:用户名=角色,多个角色以“,”隔开,该文件默认为admin用户定义了JBossAdmin和HttpInvoker这两个角色。

配置完成后读者可以通过访问:http://localhost:8088/jmx-console/,输入jmx-console-roles.properties文件中定义的用户名和密码,访问jmx-console的页面。

2、web-console登录的用户名和密码设置

默认情况下,用户访问JBoss的web-console时,不需要输入用户名和密码,为了安全起见,我们通过修改配置来为其加上用户名和密码。步骤如下:

(1)找到JBoss安装目录F:\JBoss\server\default\deploy\management\console-mgr.sar\web-console.war\WEB-INF\jboss-web.xml文件,去掉<security-domain>java:/jaas/web-console</security-domain>的注释,修改后的文件内容为:

<?xml version='1.0' encoding='UTF-8' ?>

<!DOCTYPE jboss-web

PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"

"http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">

<jboss-web>

<!-- Uncomment the security-domain to enable security. You will

need to edit the htmladaptor login configuration to setup the

login modules used to authentication users.

-->

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

<!-- The war depends on the -->

<depends>jboss.admin:service=PluginManager</depends>

</jboss-web>

(2)修改与(1)中的jboss-web.xml同级目录下的web.xml文件,去掉<security-constraint>部分的注释,修改后的该部分内容为:

<!-- A security constraint that restricts access to the HTML JMX console

to users with the role JBossAdmin. Edit the roles to what you

JBOSS安全配置的更多相关文章

  1. JBoss/Wildfly 配置SQLserver服务器

    JBoss/Wildfly 配置SQLserver服务器 http://blog.csdn.net/haitaolang/article/details/60467118 wildfly standa ...

  2. jboss jndi配置部分参数详解

    使用的是jboss7.1.1, jndi的配置在$JBOSS_HOME/standalone/configuration/standalone.xml中进行配置.配置jndi时有很多参数,解释下用到的 ...

  3. JBOSS安装配置详细教程

    首先在http://jbossas.jboss.org/downloads/下载相关程序我下载的是 JBoss AS 6.1.0.Final 1.配置jboss环境 1.1用户变量path后面添加 ; ...

  4. Jboss安装配置以及相关的问题

    下载地址:(目前最新版本是jboss-as-7.1.1.Final) http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss- ...

  5. JBOSS 数据源配置并使用JNDI调用

    -- 本文出自sleest (感谢yangjj ^_^) 场景分析: 某天系统的数据库维护方要求进行DG备库容灾演练,要把生产用RAC库模拟宕机并转移至DG备库上,由于是failover而不是swit ...

  6. JBoss 7 配置成windows启动服务

    将Jboss7 server 配置成一个windows启动服务的两个文件,部署步骤如下: 1.    先检查是否配置java_home和jboss_home的环境变量,如没配置上先配置,如我的是JBO ...

  7. Jboss 7配置日志

    1. Jboss7配置日志理论知识介绍 Jboss 7日志能够在XML配置文件和日志管理属性文件内配置.默认日志配置在configuration文件夹的logging.properties文件内. 通 ...

  8. wildfly jboss 优化配置

    参考调优:http://www.mastertheboss.com/jboss-server/jboss-performance/jboss-as-7-performance-tuning?showa ...

  9. 在同一个机器上运行两个jboss修改配置

    http://blog.sina.com.cn/s/blog_8ebe17aa0101mnft.html 解决办法:修改 \jboss-4.0.4.GA\server\default\conf 目录下 ...

随机推荐

  1. PHP IIS SPY

    <?php $ObjService = new COM("IIS://localhost/w3svc"); foreach ($ObjService as $obj3w) { ...

  2. Ubuntu基础命令

    显示历史命令的时间戳 echo 'HISTTIMEFORMAT="%F %T "' >> ~/.bashrc   解压文件/打包文件夹 tar -zxvf folder ...

  3. Angular:手动脏检查/$apply/$digest和监控对象/$watch

    声明:借鉴好多chm资料.视频.PDF总结如下: 一.$apply的引入 View <div ng-app=""> <div ng-controller=&quo ...

  4. 【IOS笔记】Event Delivery: The Responder Chain

    Event Delivery: The Responder Chain  事件分发--响应链 When you design your app, it’s likely that you want t ...

  5. General protection fault Exceptions in Linux/IA32 Systems

    Computer Systems A Programmer's Perspective Second Edition Exception number Description Exception cl ...

  6. ArcGIS Server 缓存服务增加新比例尺缓存

    win10 + Server 10.4 +  ArcMap 10.4  操作简单说明: ①窗口上方Customize栏→Toolbars→ Customize→ 搜索到 manege map serv ...

  7. taocode

    http://code.taobao.org/project/lang/list/Go/1/

  8. 【ZBar】ios错误ignoring file xxx missing required architecture x86_64 in file

    解决方法: 1.在Project target里"Architectures"设置为:Standard (armv7,armv7s)或者  Standard (armv7,arm6 ...

  9. Bluetooth HCI介绍

    目录 1. HCI功能 2. HCI Packet 1. HCI Command 2. HCI Event 3. HCI Data 3. HCI传输层 HCI, 主机控制接口(Host Control ...

  10. C# IO操作,写入文本到txt文件.

    /// <summary> /// 写入日志文件 /// </summary> /// <param name="input"></par ...