公司今天一個登陸的地方要修改,需要加一個SSL安全登陸,于是查些資料并總結如下,希望對有用的著的朋友有幫助
          文件打包地址: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 的默認端口是80,https 的默認端口是433,ftp 的默認端口是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 的默認端口是80,https 的默認端口是433,ftp 的默認端口是21。


          2.部署keystore 文件
            打開 server.xml 文件,修改內容如下:
           
           * 只需去掉 server.xml 中對SSL定義的注釋,在加上 keystoreFile、keystorePass 這兩個屬性即可。
            <Service
                name="Catalina">
              <Connector
                  port="8080"
            ...
              </Connector>
             
           <!-- Define a SSL HTTP/1.1 Connector on port 8443 --------------------- 要加入的內容在這里 -->
              <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"/>


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


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

           

           

          posted on 2008-01-15 12:32 LifeNote 閱讀(3232) 評論(2)  編輯  收藏 所屬分類: JavaHibernateSpringTapestryJavascriptMysqlOracleOthersstrutstomcat
          Comments
          • # re: Tomcat,Weblogic 等服務器 SSL 安全登陸的例子---附證書文件生成器
            Jet Mah
            Posted @ 2008-01-15 17:53
            彈對話框吧?  回復  更多評論   
          • # re: Tomcat,Weblogic 等服務器 SSL 安全登陸的例子---附證書文件生成器
            LifeNote
            Posted @ 2008-01-15 17:57
            是彈出來一個安全證書的提示  回復  更多評論   
           
          主站蜘蛛池模板: 酒泉市| 鸡西市| 会泽县| 长白| 确山县| 镇安县| 应用必备| 蒲城县| 天祝| 曲靖市| 洞头县| 肥乡县| 眉山市| 南漳县| 泾源县| 新蔡县| 安顺市| 普兰店市| 聂荣县| 永定县| 海口市| 塔城市| 宣化县| 商城县| 冕宁县| 南江县| 韩城市| 宜宾市| 会同县| 金沙县| 清新县| 贵阳市| 海口市| 德化县| 东山县| 英吉沙县| 马尔康县| 南召县| 梨树县| 措勤县| 遂川县|