顯示具有 SSL 標籤的文章。 顯示所有文章
顯示具有 SSL 標籤的文章。 顯示所有文章

2016年10月20日 星期四

在全新的 Tomcat 8 設定 HTTPS

前面的文章成功在 Apache2 設定 HTTPS 之後,接著要在 Tomcat 8 上也設定 HTTPS。
環境一樣是要用全新的 Tomcat,因此流程也會包含環境建置。
而金鑰跟憑證的部份跟前面一樣,由 Godaddy 給予的兩個檔案:fe461f1ba212ab7.crt 和 gd_bundle-g2-g1.crt
以及事先產生好的金鑰檔 my-private-key.key。

Error 'handshake alert: unrecognized_name'

參考資料
  1. SSL handshake alert: unrecognized_name error since upgrade to Java 1.7.0
  2. Error 'handshake alert: unrecognized_name' when setting up application links after upgrading Confluence

在全新的 Apache 2.4 設定 HTTPS

在完成跟 GoDaddy 申請憑證之後,Godaddy 網站上可以取得兩個 CRT 檔
我這邊拿到的,一個是命名很像亂碼的 fe461f1ba212ab7.crt 檔案,另一個則是 gd_bundle-g2-g1.crt。
fe461f1ba212ab7.crt 這個檔案是 SSL Certificate File,而 gd_bundle-g2-g1.crt 則是 SSL Certificate Chain File
加上申請憑證前,我們需要自行先產生的金鑰,假設檔名是 my-private-key.key
總共有三個檔案,就可以完成 Apache 2.4 的 HTTPS 設定了。

2016年8月24日 星期三

Apache 2 SSL 的 Passphrase 問題

在 Apache 2 裡,如果要使用有被 Passphrase 保護的 key 給 SSL 使用
必須在某處提供 SSL 的 Passphrase 才能讓 Apache 正常啟動。

一般內建的方法是使用 builtin,也就是 Apache 啟動時會直接詢問使用者
其他方法則是可以把 Passphrase 寫在某個檔案裡,要 Apache 啟動時去讀取。

而寫設定的地方,在我的 container 中是放在 /etc/apache2/mods-enabled/ssl.conf 裡。

如果是不想那麼麻煩地處理 Passphrase 問題,想把他從金鑰中移掉
則可以參考 [2] 的方法,只需要指定輸入和輸出的金鑰檔名,然後輸入 Passphrase
就可以重製出一個不需要 Passphrase 的金鑰了。

以 RSA 的金鑰來說,指令如下:

openssl rsa -in /path/to/your/rsakey.key -out /path/to/your/rsa.nocrypt.key

參考資料
  1. Apache Requires SSL / Passphrase
  2. Remove the passphrase from an existing OpenSSL key file