您的位置:首页 > 理论基础 > 计算机网络

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、重启






内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: