公司今天一個登陸的地方要修改,需要加一個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 這兩個屬性即可。
            <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的方式,瀏覽器會彈出安裝證書的對話框,確認(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 閱讀(3232) 評論(2)  編輯  收藏 所屬分類: JavaHibernateSpringTapestryJavascriptMysqlOracleOthersstrutstomcat
          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
            是彈出來一個安全證書的提示  回復(fù)  更多評論   
           
          主站蜘蛛池模板: 贺兰县| 东平县| 刚察县| 手游| 江永县| 称多县| 大关县| 思茅市| 宝山区| 岗巴县| 淮安市| 裕民县| 兰考县| 拜城县| 来凤县| 永平县| 海城市| 马山县| 达州市| 文安县| 盱眙县| 湘潭市| 浦北县| 金塔县| 玉树县| 津南区| 温宿县| 荃湾区| 兴海县| 宝清县| 慈溪市| 德清县| 西青区| 荃湾区| 阳山县| 山东省| 高阳县| 塔城市| 彭泽县| 吕梁市| 石门县|