中间件安全加固之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进行安全加 ...
随机推荐
- Genymotion 解决虚拟镜像下载速度特别慢的问题[转]
Genymotion下载地址(需注册账号):https://www.genymotion.com/download/ Genymotion号称Android模拟器中运行最快的,但是服务器在国外,And ...
- Html5學習重點清單
SVG webSQL 數據庫 SSE 服務推送 MathML 基於xml語法 Web 存储 webSockets通信 canvas 畫布操作 音頻和視頻 地理位置 Geolocation API We ...
- 关于go语言的环境配置 SDK+path+工作目录
第一步: 安装Golang的SDK http://golang.org,下载最新的安装包,之后双击安装即可. 安装完成之后,打开终端,输入go.或者go version(查看安装版本)出现如下信息即表 ...
- Android WiFi 日志记录(ASSOC_REJECT)
记录Android N关联拒绝之后的相关的log. 10-26 20:35:35.844 2215 2215 D wpa_supplicant: * bssid_hint=44:48:c1:d6:57 ...
- e807. 设置进程监听对话框的延迟弹出
By default, the progress monitor delays for a short period before it is displayed. There are two pro ...
- 图形界面至少要有一个顶级Swing容器
图形界面至少要有一个顶级Swing容器 顶级Swing容器为其它Swing组件在屏幕上的绘制和处理事件提供支持 常用的顶级容器: JFrame(框架):表示主程序窗口 JDialog(对话框):每个J ...
- unity-------Light的各个参数使用
网上看到一篇关于灯光的文章,描述的很详细,如下: Lights will bring personality and flavor to your game. You use lights to il ...
- (转) 解密H264、AAC硬件解码的关键扩展数据处理
出自:http://blog.itpub.net/30168498/viewspace-1576794/ 通过上一篇文章,我们用ffmpeg分离出一个多媒体容器中的音视频数据,但是很可能这 ...
- (转)Ubuntu12.04上NFS Server安装使用过程
原文链接:Ubuntu12.04上NFS Server安装使用过程 实现步骤: 1.服务器端:sudo apt-get install portmap2.服务器端:sudo apt-get insta ...
- Python——errno
该模块实现标准的 errno 系统符号,每一个对应于一个整数,名称和描述借鉴了 linux/include/errno.h. errno.errorcode 包含从 errno 到底层系统中错误名称 ...