中间件安全加固之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进行安全加 ...
随机推荐
- webpack9--删除冗余的CSS
我们在写代码的时候可能有些CSS并没有用到,我们如何利用webpack将冗余的CSS清除掉呢? 可以使用 purifycss-webpack 达到该目的. 1.安装 purifycss-webpack ...
- 在天河二号上对比Julia,Python和R语言
Julia是一款高级高效为技术计算(technical computing)而设计的编程语言,其语法与其他计算环境类似.其为分布式计算和并行所设计,最知名的地方在于其接近C语言的高效率. 按开发者的话 ...
- List<Map<String, Object>>是什么意思
List集合中的对象是一个Map对象,而这个Map对象的键是String类型,值是Object类型 List以Map接口对象为列表对象. Map以String为键,以Object为值. List里只能 ...
- 第三百七十二节,Python分布式爬虫打造搜索引擎Scrapy精讲—scrapyd部署scrapy项目
第三百七十二节,Python分布式爬虫打造搜索引擎Scrapy精讲—scrapyd部署scrapy项目 scrapyd模块是专门用于部署scrapy项目的,可以部署和管理scrapy项目 下载地址:h ...
- e790. 设置JSpinner的边框
// Create a number spinner JSpinner spinner = new JSpinner(); // Get the text field JFormattedTextFi ...
- e739. 创建一个标签组件
// The text is left-justified and vertically centered JLabel label = new JLabel("Text Label&quo ...
- Linux 限制用户远程SSH登录
通过/etc/hosts.allow和/etc/hosts.deny两个配置文件远程限制某个IP和某段IP地址允许或拒绝访问Linux服务器 SSH.FTP.telnet等服务,其中/etc/host ...
- com.panie 项目开发随笔_数据字典(2017.2.24)
(一) 做一个网站,第一步需要考虑的是从哪个地方开始下手.首先,每一个功能肯定有最基本的增删改查功能,而此功能一般都分为两个页面. 1) 列表显示页面.用列表来展示数据库中的数据,多用于分页显示.该页 ...
- 管道符和作业控制 shell变量 环境变量配置文件
8.6 管道符和作业控制 8.7/8.8 shell变量 8.9 环境变量配置文件 管道符和作业控制 管道符:表示把一个文件的输出内容传送到后面的命令 grep 用来过滤指定关键词的命令 “|” 为 ...
- 关于Struts2的多文件上传
之前写过一篇文章,关于Struts2文件上传:http://www.cnblogs.com/lichenwei/p/3927964.html 现在来说下多文件上传,其实就把上传文件当成是一个数组去处理 ...