Tomcat配置SSL(單向認證)

來源:互聯網
上載者:User

轉載請註明出處:http://blog.csdn.net/sunyujia/

使用Openssl為Tomcat配置SSL(雙向認證) 見http://blog.csdn.net/sunyujia/archive/2008/10/05/3017405.aspx

單向認證比較簡單一個批處理就可以搞定了

讀者直接執行如下批處理demo.bat即可

  1. @echo off
  2. echo.
  3. echo 單向SSL驗證 TOMCAT_HOME/conf/server.xml檔案配置樣本
  4. echo.
  5. echo My Blog:ht^tp://blog.csdn.net/sunyujia/
  6. echo.
  7. echo ^<Connector port="443" 
  8. echo               protocol="HTTP/1.1" 
  9. echo               SSLEnabled="true"
  10. echo               maxThreads="150" 
  11. echo               scheme="https" 
  12. echo               secure="true"
  13. echo               clientAuth="false" 
  14. echo               sslProtocol="TLS"
  15. echo               enableLookups="false"
  16. echo               keystorePass="密碼" 
  17. echo               keystoreFile="tomcat.keystore"
  18. echo               useBodyEncodingForURI="true"/^>
  19. echo.
  20. echo 下面產生tomcat.keystore到TOMCAT_HOME 
  21. echo.
  22. echo Set shell = CreateObject("Shell.Application") >tmp.vbs
  23. echo Set selFolder = shell.BrowseForFolder(0, "選擇Tomcat目錄 http://blog.csdn.net/sunyujia/", 0, ssfDRIVES) >>tmp.vbs
  24. echo Set selFolderItem = selFolder.Self >>tmp.vbs
  25. echo wscript.echo selFolderItem.Path >>tmp.vbs
  26. echo.
  27. for /f "delims=" %%i in ('cscript /nologo tmp.vbs') do set TOMCAT_HOME=%%i
  28. echo.
  29. del tmp.vbs
  30. echo 密碼至少6位 稍後詢問主密碼是否與keystore密碼相同輸入y , server.xml檔案中keystorePass選項配置此密碼.
  31. echo 輸入過程中詢問資訊是否正確時輸入y表示正確
  32. echo.
  33. if exist tomcat.keystore (del tomcat.keystore)
  34. keytool -genkey -alias tomcat -keyalg RSA -keysize 1024 -validity 3650 -keystore tomcat.keystore
  35. echo.
  36. echo  檔案已產生
  37. echo.
  38. echo 移動目前的目錄下的tomcat.keystore到%TOMCAT_HOME%
  39. move tomcat.keystore "%TOMCAT_HOME%/tomcat.keystore"
  40. echo.
  41. pause

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.