JBOSS SSL及端口配置

时间:2024.4.20

第1章 JBOSS SSL配置

1.1 启用jboss ssl

1.1.1 生成keystore

在unix环境下,使用keytool命令去生成keystore文件: -bash-3.00$ keytool -genkey -alias jbosskey -keyalg RSA

Re-enter new password:

What is your first and last name?

[Unknown]: test

What is the name of your organizational unit?

[Unknown]: ailk

What is the name of your organization?

[Unknown]: ailk

What is the name of your City or Locality? [Unknown]: gz

What is the name of your State or Province?

[Unknown]: gd

What is the two-letter country code for this unit? [Unknown]: CN

Is CN=test, OU=ailk, O=ailk, L=gz, ST=gd, C=CN correct?

[no]: y

Enter key password for <jey>

(RETURN if same as keystore password):

aidm@suse9t90:~>

在输入命令中,“jbosskey”是自定义名称,密码必须记住,在后面配置中会使用,如(dm_jboss);完成后,在$HOME目录能找到生成的.keystore文件:

aidm@suse9t90:~> cd $HOME

aidm@suse9t90:~> ls -a .key*

.keystore

把该文件mv到${JBOSS}/server/default/conf/目录下:

mv .keystore guanql/jboss/jboss-5.1.0.GA/server/default/conf/jboss90.keystore 其中jboss90.keystore这个文件名可自定义,在2.1.2章节中会使用。

1.1.2 启用ssl端口

进入${JBOSS}/server/default/deploy/ jbossweb.sar/ 目录,打开server.xml文件,找到以下关于ssl的配置段: <!-- SSL/TLS Connector configuration using the admin devl guide keystore <Connector protocol="HTTP/1.1" SSLEnabled="true"

port="8443" address="${jboss.bind.address}"

scheme="https" secure="true" clientAuth="false"

keystoreFile="${jboss.server.home.dir}/conf/chap8.keystore" keystorePass="rmi+ssl" sslProtocol = "TLS" />

-->

去除该段的注释,并把keystoreFile修改成正确文件名,把keystorePass改成生成密钥时配置的密码dm_jboss,修改如下:

<!-- SSL/TLS Connector configuration using the admin devl guide keystore --> <Connector protocol="HTTP/1.1" SSLEnabled="true"

port="8443" address="${jboss.bind.address}"

scheme="https" secure="true" clientAuth="false"

keystoreFile="${jboss.server.home.dir}/conf/jboss.keystore" keystorePass="dm_jboss" sslProtocol = "TLS" />

至此,JBOSS的SSL端口8443已开启,启动JBOSS后,在IE中输入 https://127.0.0.1:8443/ 即可看到SSL页面。

注意:如果JBOSS原来已设置了端口offset,则SSL端口8443也会随着偏移值变更。

1.2 控制台的SSL配置

1.2.1 隐藏ROOT页面

ROOT页面是指在仅仅输入 即可看到的JBOSS基本页面,该页面仅作显示及跳转之用,可以通过移除 ${JBOSS}/server/default/depoly/ROOT.war 应用包进行隐藏。隐藏该页面后,JBOSS的其它控制台还是可以通过输入完整路径登录,如 http://127.0.0.1:8080/admin-console 可以登入admin-console页面。下面继续配置这些控制台的ssl登录控制。

1.2.2 配置admin-console的ssl登录

进入 ${JBOSS}/ server/default/deploy/admin-console.war/WEB-INF 目录,修改 web.xml 文件,找到以下配置段: <!--<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 embedded 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>--> 把该注释段全部解除注释,并修改成如下内容,注意保留的注释及添加的部分:

<security-constraint>

<web-resource-collection>

<web-resource-name>HtmlAdaptor</web-resource-name>

<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> -->

<user-data-constraint>

<transport-guarantee>CONFIDENTIAL</transport-guarantee>

</user-data-constraint>

</security-constraint>

配置完毕,在输入 http://127.0.0.1:8080/admin-console 时,就会自动跳转到 ,并要求输入登录用户名及密码。

1.2.3 配置jmx-console 的ssl 登录

进入${JBOSS}/ server/default/deploy/jmx-console.war/WEB-INF/ 目录,修改 web.xml 和 jboss-web.xml 两个文件。

1.2.3.1 修改 web.xml 文件

打开文件,找到以下配置内容: <!-- 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>

-->

解除注释并添加红色部份内容:

<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>

<role-name>ssiadmin</role-name>

</auth-constraint>

<user-data-constraint>

<transport-guarantee>CONFIDENTIAL</transport-guarantee>

</user-data-constraint>

</security-constraint>

1.2.3.2 修改 jboss-web.xml 文件

打开文件,如下: <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>

去除<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>

至此,完成 jmx-console 的ssl配置,登录方式同上。

1.2.4 配置web-console 的ssl登录

进入 ${JBOSS}/ server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/ 目录,修改web.xml 和 jboss-web.xml 两个文件。

1.2.4.1 修改 web.xml 文件

同 jmx-console 修改方式一致,请参考上文内容。

1.2.4.2 修改 jboss-web.xml 文件

同jmx-console 修改方式一致,注意把文件中的修改java:/jaas/web-console为java:/jaas/jmx-console: <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>

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

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

</jboss-web>

至此,web-console的ssl登录控制配置完毕,登录方式同上。

1.3 修改jboss控制台登录密码 在上述SSL登录中,用户名和密码均为admin/admin,为系统默认配置。进行修改时,进入 ${JBOSS}/server/default/conf/props/ 目录,打开 jmx-console-users.properties 文件:

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

其中配置格式为 “username=password”,用户名或密码均可修改成用户自定义值。

更多相关推荐:
如何修改SQLserver 端口号

如何修改SQLserver端口号开始程序Mcirosoftserver配置管理器点击TCPIP右键点击属性即可修改TCP端口号重启服务即可

sqlserver20xx修改默认端口号图解

sqlserver20xx修改默认端口号图解很多新手在用sqlserver20xx与jdbc连接时都会出现MicrosoftSQLServer20xxDriverforJDBCErrorestablishing...

如何打开sql server 20xx 的1433端口

如何打开sqlserver20xx的1433端口1433端口是SQLServer默认的端口SQLServer服务使用两个端口TCP1433UDP1434其中1433用于供SQLServer对外提供服务1434用...

如何开启sql数据库1433端口

对于sql数据库1433端口如果网络没开启客户端无法访问服务器那么如何检测服务器1433端口是否开启针对于sql20xxsql20xxsql20xx我们如何来开始1433的数据库端口我的电脑右击管理服务sql本...

Sql Server 20xx的1433端口打开和进行远程连接

SqlServer20xx的1433端口打开和进行远程连接最近公司网站服务器升级买了一个云主机win20xxnetmssql20xx第一次尝试独立服务器所以出现了不少新问题以前用的是虚拟主机当然用过虚拟主机的人...

如何打开sql server 20xx 的1433端口

如何打开sqlserver20xx的1433端口配置工具gtSqlServerConfigurationManagergtMSSQLSERVER的协议看看TCPIP协议是否启动如果启动右键菜单点quot属性qu...

如何打开sql server 20xx 的1433端口

如何打开sqlserver20xx的1433端口配置工具gtSqlServerConfigurationManagergtMSSQLSERVER的协议看看TCPIP协议是否启动如果启动右键菜单点quot属性qu...

一则sql server 20xx不能监听1433端口问题的解决

一则sqlserver20xx不能监听1433端口问题的解决建立到远程sqlserver数据库连接时失败提示SQLServer不存在或访问被拒绝出现这种状况极有可能的原因是sqlserver20xx未开启默认的...

sql_server_20xx无法打开1433端口的解决办法

1如果你是win20xx那么一定要安装sql的补丁sp3a检查你的SQL有没有打补丁没有的话要打上补丁检查的方法是在查询分析器中运行selectversion如果出来的版本号是800760以下则表明你未安装sp...

远程连接sql server 20xx无法打开1433端口的解决办法

如果你的sqlserver20xx远程连接时无法打开1433端口请按照以下顺序进行检查和修正1如果你是win20xx那么一定要安装sql的补丁sp3a检查你的SQL有没有打补丁没有的话要打上补丁检查的方法是在查...

使用myeclipse连接sqlserver 20xx并且使用Hibernate操作数据库

使用myeclipse连接sqlserver20xx并且使用Hibernate操作数据库1使用myeclipse连接sqlserver20xx得到自己的sqlserver20xx实例的监听端口号1打开SQLSe...

当重装系统后 如何恢复数据库的账号 登录名_用户名 孤立用户 缩小ldf日志文件 修改sqlserver20xx端口

当重装数系统数据库之后如何恢复数据库的账号登录名用户名孤立用户缩小ldf日志文件修改sqlserver20xx端口当我们重装系统或者是重装数据库之后当附加数据库之后发现数据库里面有用户名但是在sqlserver...

sql 端口号(8篇)