中间件安全加固之Jboss
JBoss 的安全设置
1) jmx-console
A、jmx-console登录的用户名和密码设置
默认情况访问 http://localhost:8080/jmx-console 就可以浏览jboss的部署管理的一些信息,不需要输入用户名和密码,使用起来有点安全隐患。下面我们针对此问题对jboss进行配置,使得访问jmx-console也必须要知道用户名和密码才可进去访问。步骤如下:
1、打开%Jboss_HOME%\server\default\deploy\jmx-console.war\WEB-INF\jboss-web.xml,去掉<security-domain>java:/jaas/jmx-console</security-domain>的注释。修改后的该文件内容为:
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.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/jmx-console</security-domain>
</jboss-web>
2、修改与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>
在此处可以看出,为登录配置了角色JBossAdmin。
3、在%Jboss_HOME%\server\default\conf\props\jmx-console-users.properties,该文件定义的格式为:用户名=密码,在该文件中,默认定义了一个用户名为admin,密码也为admin的用户,建议设置强口令密码。
# A sample users.properties file for use with the UsersRolesLoginModule
admin=admin PS:注意修改admin密码
在同目录下jmx-console-roles.properties的内容如下:
# A sample roles.properties file for use with the UsersRolesLoginModule
admin=JBossAdmin,HttpInvoker
该文件定义的格式为:用户名=角色,多个角色以“,”隔开,该文件默认为admin用户定义了JBossAdmin和HttpInvoker这两个角色。
配置完成,需要重启 JBoss,通过访问: http://localhost:8080/jmx-console/ ,输入jmx-console-roles.properties文件中定义的用户名和密码,访问jmx-console的页面。
B、删除jmx-console
如无需jmx-console服务,可以删除相关文件。如:jboss 6.0 之前的版本 JMX 控制台的配置文件位置为:server/$config/deploy/jmx-console.war/WEB-INF/,jboss 6.0 及以上、7.0 以前的版本,JMX 控制台的配置文件位置为:common/deploy/jmx-console.war/WEB-INF/
2) web-console
打开%Jboss_HOME%\server\default\deploy\management\console-mgr.sar\web-console.war\WEB-INF\jboss-web.xml,去掉<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、修改与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、打开%Jboss_HOME%\server\default\deploy\management\console-mgr.sar\web-console.war\WEB-INF\classes\web-console-users.properties,设置用户名、密码。
# A sample users.properties file for use with the UsersRolesLoginModule
admin=admin
要分配一个用户到JBossAdmin组里,在同目录下的web-console-roles.properties.properties文件里添加"username=JBossAdmin"
# A sample roles.properties file for use with the UsersRolesLoginModule
admin=JBossAdmin
可以看到这两个文件默认是admin/admin的用户,为了安全起见,建议更换一个强口令密码。
配置完成后,需要重启 JBoss,访问: http://localhost:8080//web-console/就需要输入用户口令来验证。
如无需web-console服务,可以删除相关文件,jboss 5 路径:\server\default\deploy\management\console-mgr.sar\web-console.war\WEB-INF
开启日志:
Jboss 5日志配置:
1、打开%JBOSS_HOME%\server\default\deployers\jbossweb.deployer\server.xml文件,在<HOST>标签中增加记录日志功能 ,将Access logger以下内容的注释标记取消,取消后的内容如下:
<Host name="localhost"
autoDeploy="false" deployOnStartup="false" deployXML="false"
configClass="org.jboss.web.tomcat.security.config.JBossContextConfig"
> <!-- Uncomment to enable request dumper. This Valve "logs interesting
contents from the specified Request (before processing) and the
corresponding Response (after processing). It is especially useful
in debugging problems related to headers and cookies."
-->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve" />
--> <!-- Access logger --> <Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="localhost_access_log." suffix=".log"
pattern="common" directory="${jboss.server.home.dir}/log"
resolveHosts="false" />
2、重启Jboss服务,网站访问日志生成在JBOSS_HOME%\server\default\log目录下。
Jboss7日志配置:
1、在默认的情况下,JBoss7是没有开启access_log的,如果要开启这项功能,就需要修改$JBOSS_HOME\standalone\configuration\standalone.xml这个文件,备份配置文件,相关的修改内容如下所示:
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
<access-log pattern="%t %a %m %U %s %D" prefix="access_log." rotate="true">
<directory path="." relative-to="jboss.server.log.dir"/>
</access-log>
</virtual-server>
重启即可看到${jbossHome}\standalone\log\目录下生成access_log。
最后
欢迎关注个人微信公众号:Bypass--,每周原创一篇技术干货。

参考文章:
jboss安全配置参考
https://blog.csdn.net/qq_29277155/article/details/52810579
中间件安全加固之Jboss的更多相关文章
- JBOSS中间件漏洞总汇复现
JBOSS中间件漏洞总汇复现 JBoss JMXInvokerServlet 反序列化漏洞 漏洞复现 直接使用docker搭建的漏洞环境. 环境搭建完成后,直接使用工具检测即可:工具下载地址https ...
- 小迪安全 Web安全 基础入门 第六天 - 信息打点-Web架构篇&域名&语言&中间件&数据库&系统&源码获取
一 . Web架构 语言.常用的Web开发语言有PHP,Java,Python,JavaScript,.net等.具体可参考w3school的介绍. 中间件. (1)常见的Web服务器中间件:IIS. ...
- DevOps之服务-监控工具
唠叨话 关于德语噢屁事的知识点,仅提供精华汇总,具体知识点细节,参考教程网址,如需帮助,请留言. <DevOps教程> <DevOps之服务-监控工具> 注:关于监控工具的具体 ...
- Red Hat
同义词 REDHAT一般指Red Hat Red Hat(红帽)公司(NYSE:RHT)是一家开源解决方案供应商,也是标准普尔500指数成员.总部位于美国北卡罗来纳州的罗利市,截止2015年3月3日, ...
- LR杂记 - 性能測试指标及经常使用的监控工具
监控指标 性能測试通常须要监控的指标包含: 1.serverLinux(包含CPU.Memory.Load.I/O). 2.数据库:1.Mysql 2.Oracle(缓存命中.索引.单条SQL性能.数 ...
- 网站性能测试PV到TPS的转换以及TPS的波动和淘宝性能测试要点
<淘宝性能测试白皮书V0.3> 性能测试的难点不在于测,在于测出的数据和实际的对照关系,以及测试出来的数据对性能的评估(到底是好,还是不好). 淘宝性能测试白皮书,解决了我的4个问题:1. ...
- 001.OpenShift介绍
一 OpenShift特性 1.1 OpenShift概述 Red Hat OpenShijft Container Platform (OpenShift)是一个容器应用程序平台,它为开发人员和IT ...
- java代码审计的点
java代码审计的点 组件的审计 首先看pom.xml查看第三方组件和第三方组件的版本 常用的第三方组件: 第三方组件 漏洞类型 组件漏洞版本 log4j2 远程代码执行 Apache log4j2 ...
- 【中间件安全】Jboss安全加固规范
1. 适用情况 适用于使用Jboss进行部署的Web网站. 适用版本:5.x版本的Jboss服务器 2. 技能要求 熟悉Jboss安装配置,能够Jboss进行部署,并能针对站点使用Jboss进行安全加 ...
随机推荐
- oracle的启动和停用
1.开始-运行-cmd-确定 2.cmd页面,输入set ORACLE_SID=(你的数据库实例名),回车,执行 3.继续输入‘sqlplus/nolog’,敲击回车键 4.sql输入栏,输入‘con ...
- Python中sorted()方法的用法
Python中sorted()方法的用法 2012-12-24 22:01:14| 分类: Python |字号 订阅 1.先说一下iterable,中文意思是迭代器. Python的帮助文档中对i ...
- Linux_iptables
Linux:网络防火墙 netfilter:Frame iptables: 生成防火墙规则,并附加到netfilter上实现数据报文过滤 NAT mangle等规则生成的工具 TCP有限状态机 LIS ...
- (笔记)Linux下的ioctl()函数详解
我这里说的ioctl函数是指驱动程序里的,因为我不知道还有没有别的场合用到了它,所以就规定了我们讨论的范围.写这篇文章是因为我前一阵子被ioctl给搞混了,这几天才弄明白它,于是在这里清理一下头脑. ...
- 远程桌面连接工具 Remote Desktop Manager 9.1.2.0 Enterprise 多国语言绿色版附注册码 简单使用
1:修改成中文简体 2: 注册破解 (记得一定要先断网) admin admin@admin.com 31GKI-OK1HY-59H35-Y8GPB-8WDY6 3 : 创建连接 搞定
- C# byte[]保存成文件
string path = Server.MapPath(@"\a.pdf"); FileStream fs = new FileStream(path, FileMode.Cre ...
- UITableView:可展开的 UITableView
针对 TableView,有些时候需要在点击 cell 时,展开这行 cell,显现出更多的选项或者全部内容等. 比较容易想到的处理方案就是利用 section,在未选择之前,每一行都是一个 sect ...
- excel做回归分析的应用【风控数据分析】
方法1 统计逻辑:统计一个loginname的所有去重的通讯录数C,统计这个Loginname对应的每个设备对应的通讯录c1,c2,c3…cn; X=(c1/c+c2/c+c3/c+….cn/ ...
- JUC回顾之-ArrayBlockingQueue底层实现和原理
ArrayBlockingQueue的原理和底层实现的数据结构 : ArrayBlockingQueue是数组实现的线程安全的有界的阻塞队列,可以按照 FIFO(先进先出)原则对元素进行排序. 线程安 ...
- 在window的cmd窗口下运行linux命令
之前看很多视频老师都是用Linux命令操作命令框,感觉很方便,自己在cmd窗口试了一下,所有这些命令都提示不是内部或外部命令,后来发现了windows还有一个powershell命令行工具,用起来似乎 ...