close

寫這個是為了方便自己使用不同web server時,

能快速查詢安裝步驟,

至於比較安全的配置,不在本文內容.

 

向TWCA申請憑證,

如何產生key與csr檔,

openssl genrsa -out ***.key 2048

openssl req -new -key ***.key -out ***.csr

得到

***.csr
***.key (要留著很重要)

 

從twca取得的憑證有
root.cer
server.cer
uca_1.cer
uca_2.cer

首先,

將uca_1.cer與uca_2.cer結合,

在命令提示字元中,執行copy uca_2.cer+uca_1.cer uca.cer

會得到uca,cer => 總合的中繼憑證

 

apache web server

配置檔中有三個參數,

SSLCertificateFile /path/server.cer
SSLCertificateKeyFile /path/***.key
SSLCertificateChainFile /path/uca.cer

 

nginx web server

結合server.cer與uca.cer

在命令提示字元中,執行​copy server.cer+uca.cer combine.cer

會得到combine.cer => 總合的憑證.

轉換為pem檔

openssl x509 -inform pam -in combine.​cer -out combine.pem

配置檔中有兩個參數,

ssl_certificate      /path/combine.pem;
ssl_certificate_key  /path/***.key;

iis web server
需使用pfx檔作為憑證.
openssl pkcs12 -export -out ***.pfx -inkey ***.key -in server.cer -certfile uca.cer

(密碼Aa123456)
匯入時也需要密碼.

 

AWS 憑證上傳

這邊使用console management -> ACM (AWS Certificate Manager)

aws acm上傳憑證.png

上傳憑證時,說要pem格式,一開始從TWCA取得的憑證就是此格式.

Certificate body : server.cer的內容

Certificate private key : ***.key解密後的內容​ => openssl rsa -in ***.key -out ***.pem  (這是因為一開始產生key的時候使用了rsa 2048加密)

Certificate ​chain是選填,但基本上外簽的憑證皆需填寫.自簽的憑證則不用 : uca.cer + root.cer的內容

格式為

-----BEGIN CERTIFICATE----- Intermediate certificate 2 -----END CERTIFICATE-----
-----BEGIN CERTIFICATE----- Intermediate certificate 1 -----END CERTIFICATE-----
-----BEGIN CERTIFICATE----- Optional: Root certificate -----END CERTIFICATE-----

 

參考

Importing Certificates into AWS Certificate Manager

arrow
arrow
    文章標籤
    aws certificate
    全站熱搜

    abcg5 發表在 痞客邦 留言(0) 人氣()