瀏覽分類:

Nginx

Let’s Encrypt 憑證 – CentOS 7 – Nginx 環境安裝 (Certbot工具)

先前因為 SSL 憑證需要付費問題,後來找到了 Let’s Encrypt 憑證頒發機構 (Certificate Authority, CA) (https://letsencrypt.org/zh-tw/getting-started/),讓用戶可自行申請免費憑證,因為免費所以有些限制,相關限制可參考官網說明(https://letsencrypt.org/zh-tw/docs/rate-limits/)

月前收到Email Let’s Encrypt 寄來的通知「Let’s Encrypt certificate expiration notice for domain」,主要是說明你的網址要過期了,請記得要進行更新(如下圖)

整理了一下新的更新方式,這次找到 Certbot 工具,可以利用 Let’s Encrypt 進行申請免費的 HTTPS 憑證。

以下為操作流程

閱讀更多

如何建立一個私人的https

自己用 CA 簽自己的 certificate

  1. 先幫自己的 CA 生一組 key & certificate
  2. 幫自己的主機生一組 key & CSR
  3. 用自己的主機簽 CSR 讓他變成 certificate
openssl genrsa -des3 -out ca.key 4096

由於 CA 的 key 只有在簽 certificate 的時候會用到,不像 certificate 的 key 服務本身會用到,所以這邊可以加上 des3 ,會要你輸入一個密碼加密。

openssl req -x509 -new -nodes -key ca.key -sha256 -days 365 -out ca.crt

接下來我們幫 CA 生一組 certificate,通常這個天數會久不少。

openssl genrsa -out host.key 4096

這組是主機上的服務要用的 key ,就不加密了。

openssl req -new -key host.key -sha256 -out host.csr

最後來簽這個 CSR 產生 certificate

openssl x509 -req -in host.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out host.crt -days 30 -sha256