CAS tomcat6搭建

來源:互聯網
上載者:User

標籤:http   java   os   io   問題   linux   c   window   

#genkey:在tomcat根目錄下
keytool -genkey -alias tomcat_cas -keyalg RSA -storepass changeit -keystore server.keystore -validity 3600

#list key:
keytool -list -keystore $JAVA_HOME/jre/lib/security/cacerts

#delete
keytool -delete -trustcacerts -alias tomcat_cas -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit

#export:在tomcat根目錄下
keytool -export -trustcacerts -alias tomcat_cas -file server.cer -keystore server.keystore -storepass changeit

#import
keytool -import -trustcacerts -alias tomcat_cas -file server.cer -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit

(註:$JAVA_HOME:是linux下jdk根目錄,如果是在windows下將其替換為:%JAVA_HOME%         changeit為預設:storepass後的密碼必須與genkey指令後的確認密碼相同  在本地時網域名稱為:localhost)

常用步驟:

1:genkey

2:export

3:import

4:設定tomcat/conf/server.xml

<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
           keystoreFile="/home/brin/webserver/apache-tomcat-6.0.32/casserver.keystore"
           truststoreFile="/opt/jdk1.6.0_45/jre/lib/security/cacerts"
           keystorePass="changeit" />

5:啟動tomcat

6:https://localhost:8443/cas

常見問題補充:

1: java.io.IOException:Cannot recover key

storepass後的密碼與genkey最後的確認密碼不一致,可delete後重新genkey, export, import

2: java.io.IOException: Keystore was tempered with, or password was incorrect

tomcat/conf/server.xml中的keystorePass="xxx"密碼輸入錯誤

3: java.io.FileNotFoundException:/root/.keystore

tomcat/conf/server.xml中keystoreFile中沒有添加或輸入值有誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.