公司今天一個(gè)登陸的地方要修改,需要加一個(gè)SSL安全登陸,于是查些資料并總結(jié)如下,希望對有用的著的朋友有幫助
          文件打包地址:http://www.aygfsteel.com/Files/lifenote/tomcat配置ssl.rar
          一下為幫助說明:

          1.1. 安全登錄 SSL
          1.1.1  WebLogic下面SSL配置:
          1.生成 keystoreFile:
           * keystoreFile 文件的生成:
          %Java_Home%\bin\keytool -genkey -alias localhost-weblogic -keyalg RSA -validity 365 -keystore ./testKey.jks

           * csr 文件的生成:
          %Java_Home%\bin\keytool -certreq -alias localhost-weblogic -sigalg MD5withRSA -file ./testServer.csr -keystore ./testKey.jks

           * 注意: http 的默認(rèn)端口是80,https 的默認(rèn)端口是433,ftp 的默認(rèn)端口是21。
          2.部署keystore 文件
          在 <http://hostname:7001/console>  中配置剛才生成的 testKey.jks 文件。

          1.1.2 Tomcat 下面SSL配置


          1.生成 keystoreFile:
           * keystoreFile 文件的生成:
          %Java_Home%\bin\keytool -genkey -alias localhost-weblogic -keyalg RSA -validity 365 -keystore ./testKey.jks

          Example for inner test:
          [root@localhost ~]#
          /home/tomcat/jdk1.5.0_12/bin/keytool -genkey -alias localhost-tomcat -keyalg RSA -validity 365 -keystore /home/tomcat/apache-tomcat-5.5.23/conf/VCMarketKey.jks
          Enter keystore password:  someday2007
          What is your first and last name?
            [Unknown]:  lifenote
          What is the name of your organizational unit?
            [Unknown]:  Java
          What is the name of your organization?
            [Unknown]:  Sunxc
          What is the name of your City or Locality?
            [Unknown]:  Beijing
          What is the name of your State or Province?
            [Unknown]:  Beijing
          What is the two-letter country code for this unit?
            [Unknown]:  ZH
          Is CN=lifenote, OU=Java, O=Sunxc, L=Beijing, ST=Beijing, C=ZH correct?
            [no]:  y

          Enter key password for <localhost-tomcat>
                  (RETURN if same as keystore password):  someday2007
          [root@localhost ~]#

           

           * csr 文件的生成:
          %Java_Home%\bin\keytool -certreq -alias localhost-weblogic -sigalg MD5withRSA -file ./testServer.csr -keystore ./testKey.jks

           * 注意: http 的默認(rèn)端口是80,https 的默認(rèn)端口是433,ftp 的默認(rèn)端口是21。


          2.部署keystore 文件
            打開 server.xml 文件,修改內(nèi)容如下:
           
           * 只需去掉 server.xml 中對SSL定義的注釋,在加上 keystoreFile、keystorePass 這兩個(gè)屬性即可。
            <Service
                name="Catalina">
              <Connector
                  port="8080"
            ...
              </Connector>
             
           <!-- Define a SSL HTTP/1.1 Connector on port 8443 --------------------- 要加入的內(nèi)容在這里 -->
              <Connector port="8443" maxHttpHeaderSize="8192"
                         maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                         enableLookups="false" disableUploadTimeout="true"
                         acceptCount="100" scheme="https" secure="true"
                         clientAuth="false" sslProtocol="TLS"
                keystoreFile="e:/temp_E/ssl/testKey.jks"
                keystorePass="aaaaaa"/>

              <Connector
                  port="8009"
            ...
              </Connector>
           ...
          Example for inner test:
              <Connector port="443" maxHttpHeaderSize="8192"
                         maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                         enableLookups="false" disableUploadTimeout="true"
                         acceptCount="100" scheme="https" secure="true"
                         clientAuth="false" sslProtocol="TLS"
                keystoreFile="/home/tomcat/apache-tomcat-5.5.23/conf/VCMarketKey.jks"
                keystorePass="password"/>


           注意需默認(rèn)要使用 443 而不是 8443,要使用8443要在apache中配置,保證從apache請求tomcat 采用 <https://ip:8443/>... 的格式。


          1.1.3 使用http訪問WebService s的客戶端配置
          Servlet服務(wù)器配置好SSL之后,客戶端可以使用https訪問了。
          對于用戶使用瀏覽器訪問https的方式,瀏覽器會(huì)彈出安裝證書的對話框,確認(rèn)之后可以正常使用https訪問。
           對于WebService 通過https方式訪問,按照一下步驟:
          1. WebService客戶端要先取得keyStore文件;
          2. 虛擬機(jī)系統(tǒng)使用 System.setProperties(…) 設(shè)置keyStore信息;
          3. 使用 url=<https://ip:port/...> 訪問WebService服務(wù)

           

           

          posted on 2008-01-15 12:32 LifeNote 閱讀(3243) 評論(2)  編輯  收藏 所屬分類: JavaHibernate 、Spring 、Tapestry 、JavascriptMysql 、Oracle 、Othersstrutstomcat
          Comments
          • # re: Tomcat,Weblogic 等服務(wù)器 SSL 安全登陸的例子---附證書文件生成器
            Jet Mah
            Posted @ 2008-01-15 17:53
            彈對話框吧?  回復(fù)  更多評論   
          • # re: Tomcat,Weblogic 等服務(wù)器 SSL 安全登陸的例子---附證書文件生成器
            LifeNote
            Posted @ 2008-01-15 17:57
            是彈出來一個(gè)安全證書的提示  回復(fù)  更多評論   
           
          主站蜘蛛池模板: 始兴县| 和田县| 邹平县| 颍上县| 综艺| 台前县| 页游| 阳原县| 盐亭县| 长武县| 科技| 特克斯县| 梅州市| 那坡县| 江门市| 巨野县| 福清市| 桓台县| 屯留县| 迁西县| 甘孜县| 政和县| 伽师县| 五莲县| 宁晋县| 百色市| 扎赉特旗| 纳雍县| 清徐县| 自贡市| 开原市| 德阳市| 玉龙| 柳河县| 鹤壁市| 织金县| 延长县| 卓尼县| 巍山| 博客| 邢台市|