JBOSS安全配置
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
相关文章
- 已禁用对分布式事务管理器(MSDTC)的网络访问。请使用组件服务管理工具启用 DTC 以便在 MSDTC 安全配置中进行网络访问。
- 绿化版Java11的环境配置与Python调用Java
- 优化树莓派上的网站:配置安全的SSL证书 4/4
- 如何为自己搭建的网站配置HTTPS证书 2-4
- Wing IDE配置空格取代tab缩进+护眼背景色
- web安全day33:人人都要懂的LNMP--nginx的配置和文件理解
- Caffe初试(一)win7_64bit+VS2013+Opencv2.4.10+CUDA6.5配置Caffe环境
- (转)Docker守护进程安全配置介绍
- 如何配置使用 HTTP 严格传输安全(HSTS)
- RHCE 系列(九):如何使用无客户端配置 Postfix 邮件服务器(SMTP)
- activeMQ安全配置及常见问题解决
- snmp v3的安全配置 snmp认证与加密配置(53)
- docker for windows--Windows 10 家庭中文版安装apache zeppelin 0.10.1版本及安全配置
- Tomcat配置SSL安全协议
- vue-cli3.0多环境配置和本地跨域
- Log4cpp配置文件格式说明
- linux在配置菜单中添加选项
- 《Cacti实战》——2.4 安装与配置过程中的排错宝典
- VSCode Python 开发环境配置
- [MAC] MAC上的ssh工具Shuttle 安装与配置简介
- ApacheTomcat 8 9 安全配置与高并发优化
- woff字体MIME类型配置
- CRMEB 环境搭建 Linux 安全配置
- 【Qt5】Windows下配置程序的产品、公司、版权、版本号等详细信息