serviceMix https搭建
2015-09-06 10:56
585 查看
1、ca的准备
1、建立某个ca根目录,用来进行ca证书的管理(例如:/opt/CA)。
2、在ca根目录下建立如下文件夹: newcerts、private,其中newcerts用于存放新生成的证书(openssl 自动管理),private用于存放自己的ca根证书的私钥。
3、将openssl目录中的openssl.cnf文件复制到该目录下,并将[ CA_default ]下的dir修改为第1步中的ca根目录/opt/CA,还要修改 [policy-match] ,将DName的匹配策略都改成optional。
4、在ca根目录下建立文件:空白文件index.txt、带有内容为01的文件serial
5、制作CA根证书(dname="CN=ca, OU=aa, O=bb, L=GZ, ST=Canton, C=CN")
openssl req -new -x509 -days 18900 -sha1 -newkey rsa:1024 -keyout /opt/CA/private/ca.key -out /opt/CA/ca.crt
2、自签名证书的生成
keytool -genkey -validity 13650 -keyalg RSA -keysize 1024 -keystore ./jetty.jks -alias jetty -dname "CN=ca, OU=aa, O=bb, L=GZ, ST=Canton, C=CN"
2、导出签名请求证书
keytool -certreq -sigalg MD5withRSA -file ./jettyReq.csr -keystore ./jetty.jks -alias jetty
3、生成自签名证书
openssl ca -in ./jettyReq.csr -out ./signedjetty.crt -notext -cert /opt/CA/ca.crt -keyfile /opt/CA/private/ca.key -config /opt/CA/openssl.cnf
4、将CA根证书的公钥导入服务端证书
keytool -import -v -trustcacerts -alias root -file /opt/CA/ca.crt -keystore ./jetty.jks
5、将自签名证书导入服务端证书
keytool -import -v -file ./signedjetty.crt -keystore ./jetty.jks
3、serverMix配置
1、在serviceMIX 安装目录下找到etc/org.ops4j.pax.web.cfg.empty.stub 文件
2、把该文件下的以下信息注解删除,并修改相应的信息
org.osgi.service.http.secure.enabled=true
org.ops4j.pax.web.ssl.keystore=E:/ca/jetty.jks
org.ops4j.pax.web.ssl.password=123456
org.ops4j.pax.web.ssl.keypassword=123456
org.osgi.service.http.port.secure=8443
3、把这文件重命名为
org.ops4j.pax.web.cfg
4、jetty.xml 加以下代码:
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="AcceptQueueSize">100</Set>
<Set name="Keystore">E:\ca\jetty.jks</Set>
<Set name="Password">123456</Set>
<Set name="KeyPassword">123456</Set>
<Set name="truststore">E:\ca\jetty.jks</Set>
<Set name="trustPassword">123456</Set>
</New>
</Arg>
</Call>
5、重启
1、建立某个ca根目录,用来进行ca证书的管理(例如:/opt/CA)。
2、在ca根目录下建立如下文件夹: newcerts、private,其中newcerts用于存放新生成的证书(openssl 自动管理),private用于存放自己的ca根证书的私钥。
3、将openssl目录中的openssl.cnf文件复制到该目录下,并将[ CA_default ]下的dir修改为第1步中的ca根目录/opt/CA,还要修改 [policy-match] ,将DName的匹配策略都改成optional。
4、在ca根目录下建立文件:空白文件index.txt、带有内容为01的文件serial
5、制作CA根证书(dname="CN=ca, OU=aa, O=bb, L=GZ, ST=Canton, C=CN")
openssl req -new -x509 -days 18900 -sha1 -newkey rsa:1024 -keyout /opt/CA/private/ca.key -out /opt/CA/ca.crt
2、自签名证书的生成
keytool -genkey -validity 13650 -keyalg RSA -keysize 1024 -keystore ./jetty.jks -alias jetty -dname "CN=ca, OU=aa, O=bb, L=GZ, ST=Canton, C=CN"
2、导出签名请求证书
keytool -certreq -sigalg MD5withRSA -file ./jettyReq.csr -keystore ./jetty.jks -alias jetty
3、生成自签名证书
openssl ca -in ./jettyReq.csr -out ./signedjetty.crt -notext -cert /opt/CA/ca.crt -keyfile /opt/CA/private/ca.key -config /opt/CA/openssl.cnf
4、将CA根证书的公钥导入服务端证书
keytool -import -v -trustcacerts -alias root -file /opt/CA/ca.crt -keystore ./jetty.jks
5、将自签名证书导入服务端证书
keytool -import -v -file ./signedjetty.crt -keystore ./jetty.jks
3、serverMix配置
1、在serviceMIX 安装目录下找到etc/org.ops4j.pax.web.cfg.empty.stub 文件
2、把该文件下的以下信息注解删除,并修改相应的信息
org.osgi.service.http.secure.enabled=true
org.ops4j.pax.web.ssl.keystore=E:/ca/jetty.jks
org.ops4j.pax.web.ssl.password=123456
org.ops4j.pax.web.ssl.keypassword=123456
org.osgi.service.http.port.secure=8443
3、把这文件重命名为
org.ops4j.pax.web.cfg
4、jetty.xml 加以下代码:
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="AcceptQueueSize">100</Set>
<Set name="Keystore">E:\ca\jetty.jks</Set>
<Set name="Password">123456</Set>
<Set name="KeyPassword">123456</Set>
<Set name="truststore">E:\ca\jetty.jks</Set>
<Set name="trustPassword">123456</Set>
</New>
</Arg>
</Call>
5、重启
相关文章推荐
- 常见HTTP状态码
- file_operation(文件操作) file(文件) inode(节点) http://blog.itpub.net/14805538/viewspace-445624/
- TCP/IP(3)IP
- 大端法、小端法、网络字节序
- Linux学习记录(9)Linux基本网络命令
- tcp连接 三次握手+四次挥手
- android中判断网络是否可用
- Windows 7/XP 局域网络共享文件详细设置教程
- 深入浅出HTTP协议
- C语言中socket相关网络编程函数小结
- 网络流增广路入门很好的文章
- http协议content-encoding & transfer-encoding
- Linux 中open系统调用实现原理 2012-11-29 23:03:48 http://blog.chinaunix.net/uid-25968088-id-3426026.html
- 用WINSOCK API实现同步非阻塞方式的网络通讯
- 用Msxml2.XMLHTTP 与 Msxml2.ServerXMLHTTP 发生网页请求
- hdu 4279 Number 2012天津网络赛 数论 分析
- qml---------------显示网络图片
- tcpdump移动端抓包
- 3.3.3 进程1在根设备上加载根文件系统(5) http://book.51cto.com/art/201306/398752.htm
- hdu 4278 Faulty Odometer 2012 天津网络赛 数位dp