申請 GCA SSL Apache 設備憑證
本文是依據 GCA 官方網站1), 實際處理的過程所整理程序.
GCA SSL 主機憑證申請流程圖
產生 CSR 憑證請求檔程序
- 登入有安裝 openssl 之 Linux 主機
- 產生密碼檔 server.key
openssl genrsa -des3 -out server.key 1024 設定密碼
- 產生 5 年效期的憑證需求檔 server.csr
openssl req -new -days 1825 -key server.key -out server.csr
- 以經濟部 ED 系統為例, 申請填寫內容如下:
Country Name (2 letter code) [GB]:TW State or Province Name (full name) [Berkshire]:Taiwan Locality Name (eg, city) [Newbury]:Taipei Organization Name (eg, company) [My Company Ltd]:Ministry of Economic Affairs,R.O.C. Organizational Unit Name (eg, section) []:Information management center Common Name (eg, your name or your server's hostname) []:ed.moea.gov.tw Email Address []:[email protected] Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
上 GCA 網站申請 SSL 憑證程序
安裝 apache 安裝 SSL 憑證程序
1. 取得 GRCA 自簽憑證及 GCA 憑證之憑證串鏈
- 一套 Apache 只需安裝一次就可以
- 在 Windows IE 下安裝 GRCA 2)
- 將 TW Government Root Certification Authority 憑證匯出為 GRCA_GCA.p7b
2. 完成 GRCA 自簽憑證及 GCA 憑證之憑證串鏈
- 將 GRCA_GCA.p7b 複製到 apache 的主機內
- 將憑證串連擋由 DER 編碼格式轉成 PEM 編碼格式3)
openssl pkcs7 -in GRCA_GCA.p7b -inform DER -print_certs -out GRCA_GCA.pem
- 將 PEM 檔複製成 Apache+mod_ssl 的 SSLCertificateChainFile
cp GRCA_GCA.pem /etc/pki/tls/certs/ca.crt
- 修改 ssl.conf 定義檔 4)
: SSLCertificateChainFile /etc/pki/tls/certs/ca.crt :
3. 安裝 SSL 伺服器軟體憑證
- 將簽發下來的 SSL 伺服器軟體憑證(server.cer)與密碼檔(server.key)複製到 apache 的主機內
- 將憑證擋由 DER 編碼格式轉成 PEM 編碼格式5)
- 將密碼檔加入 PIN 碼存成 PEM 編碼格式
openssl x509 -in server.cer -inform DER -out server.pem openssl rsa -in server.key -out mycert.pem <- 輸入 PIN 碼
- 將 PEM 檔複製成 Apache+mod_ssl 的 SSLCertificateFile
cp server.pem /etc/pki/tls/certs/server.crt cp mycert.pem /etc/pki/tls/private/mycert.pem
- 修改 ssl.conf 定義檔 6)
: SSLCertificateFile /etc/pki/tls/certs/server.crt : SSLCertificateKeyFile /etc/pki/tls/private/mycert.pem :
4. 散佈 GRCA 自簽憑證到用戶端
- 用戶端 IE 如果沒有安裝 GRCA 就會出現伺服器憑證為不被信任的警告訊息
- 安裝 GRCA 有以下兩種方式
- 由使用者到政府憑證總管理中心下載安裝 7)
- 更改程式首頁, 在 HTML 的 HEAD 內加入以下語法, 這樣用戶如果沒有安裝, 就可以自動安裝完成
<OBJECT data="http://grca.nat.gov.tw/pse/InstallRootCert.html" type="text/html"> </OBJECT>