惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - oisiv

java线程池ThreadPoolTaskExecutor执行顺序 css一些特别效果设定 SQL模擬死結產生 使用jquery模拟键盘事件,但window系统并不会真的响应事件,只是浏览器当前页面会响应而已 base64编码的图片字节流存入html页面中的显示 设置span 宽度的完美解决方案 Mercurial hg web server的配置 DIV撑开 java.net.URLEncode编码 与 URLDecode解码问题 java在CMD环境下执行需注意字符集设定 把MSSQL的表数据查询成 insert into格式的函数 html中DIv并排显示问题 鲁迅《兩地書》 java采用Apache FileUpload组件实现上传 js中对象复制以及apply方法的使用 可执行jar包的处理,以及could not find the main class win7/xp 双击执行jar包出现:could not find the main class的问题处理 MSSql性能优化 CSS拼装图片时,确保严丝合缝 在 SQL Server 2008 中新建用户登录并指定该用户的数据库
配置jboss4.2.3GA启用SSL
oisiv · 2013-12-27 · via 博客园 - oisiv

转帖保存

配置jbossHTTP请求走SSL(HTTPS协议)

l         生成keystore 文件

keytool生成server.keystore文件:

进入命令行

C:\Documents and Settings\new>

keytool -genkey -alias tc-ssl -keyalg RSA -keystore c:\server.keystore -validity 3650

会提示要求输入私钥信息。

Jboss配置HTTPS - 茫然的小鸟 - 茫然的小鸟

生成完后放入\jboss安装目录\server\default\conf

l         修改D:\jboss-4.2.2.GA\server\default\deploy\jboss-web.deployer\server.xml文件

    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"

               maxThreads="150" scheme="https" secure="true"

               clientAuth="false" sslProtocol="TLS"

               keystoreFile="conf/server.keystore" keystorePass="123456"

               keystoreType="jks"

     />

去掉该段注释,添加代码(红色标注部分)

keystoreFile后面的内容是server.keystore文件的相对路径。

keystorePass后面的内容是生成文件是的密码。

l         修改完成后启动JBOSS,访问

https://127.0.0.1:8443/teamnet/project/login.jsp

Jboss配置HTTPS - 茫然的小鸟 - 茫然的小鸟

点击查看证书

Jboss配置HTTPS - 茫然的小鸟 - 茫然的小鸟

是否继续选择是。

Jboss配置HTTPS - 茫然的小鸟 - 茫然的小鸟

成功访问,注意端口号为配置文件中的8443,可以根据需要修改。

问题:访问原来的http://127.0.0.1:8080/teamnet/project/login.jsp也同样可以访问页面

l         修改web.xml文件,配置一个HtmlAdaptor添加代码:

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

        <user-data-constraint>

            <description>Protection should be CONFIDENTIAL</description>

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

        </user-data-constraint>

    </security-constraint>

再次启动JBOSS服务器,访问http://127.0.0.1:8080/teamnet/project/login.jsp

Jboss配置HTTPS - 茫然的小鸟 - 茫然的小鸟

可以看到访问http已经被自动的转到https协议进行访问。

Jboss配置HTTPS - 茫然的小鸟 - 茫然的小鸟

另外如果jboss有启用APR,那么启动时会报错(No Certificate file specified or invalid file format  ).

此时需要将传统配置中

<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"  
。。。

的protocol修改为

<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
。。。

最后: 

用合法证书替换自签名证书

依据上面文章的操作,在浏览器上打开https时,会提示证书错误。这个时候就需要去申请一个合法证书,收费的或是免费的都行。免费的证书将不会在

地址栏显示公司名称。

1.类似上文第一步,产生keystore文件

keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore keystore.jks -storepass password

输入名称时,要与域名相同,例如immtest.immerp.com

2.生成证书请求文件(CSR)

Keytool -certreq -alias server -sigalg SHA1withRSA -file certreq.csr -keystore keystore.jks -keypass password -storepass password

3.在证书申请网站,提交csr文件。审核通过后发将证书通过邮件发送回来。这里可以采用www.comodo.com提供的免费证书,90天有效,不限制续用。

4.邮件中一般包含一个或多个的CA证书和服务器域名证书。先分别导入CA证书,最后导入域名证书。

  CA证书的别名可以随意,域名证书的别名与生成keystore时的要相同.(下面用comodo颁发的证书为例)

keytool -import -trustcacerts -alias AddTrustExternalCARoot -file AddTrustExternalCARoot.crt -keystore keystore.jks

keytool -import -trustcacerts -alias intermediate1 -file ComodoUTNSGCCA.crt -keystore keystore.jks

keytool -import -trustcacerts -alias intermediate2 -file UTNAddTrustSGCCA.crt -keystore keystore.jks

keytool -import -trustcacerts -alias intermediate3 -file EssentialSSLCA_2.crt -keystore keystore.jks

keytool -import -trustcacerts -alias server -file immtest_immerp_com.crt -keystore keystore.jks

5.将文件keystore.jks放到替换原来的keystore文件,重启jboss。