LoginSignup
6
7

More than 3 years have passed since last update.

lego で Let's Encrypt

Last updated at Posted at 2019-07-18

はじめに

公式の certbot がありますが、本内容は lego を使用します。
https://github.com/go-acme/lego

バージョン:lego version 2.6.0 linux/amd64

なお、本手順では、認証ファイル方式の説明になります。

Apache

バーチャルホストの設定に認証ファイル用のエイリアスを追加します。
この辺は、好みの問題なので、ドキュメントルート配下に直接置く場合は、設定不要です。

    Alias /.well-known /etc/lego/webroot/.well-known
    <Directory "/etc/lego/webroot/.well-known">
       Order deny,allow
       Allow from all
    </Directory>

証明書リクエスト&生成

lego --accept-tos \
     --path /etc/lego/.lego/ \
     --http \
     --http.webroot /etc/lego/webroot/ \
     --domains "your-domain.com" \
     --email your-mail@gmail.com \
     run

/etc/lego/.lego/certificates/ に鍵ファイルや証明書が出力されます。

証明書を破棄

lego --accept-tos \
     --path /etc/lego/.lego/ \
     --http \
     --http.webroot /etc/lego/webroot/ \
     --domains "your-domain.com" \
     --email your-mail@gmail.com \
     revoke

証明書を更新

lego --accept-tos \
     --path /etc/lego/.lego/ \
     --http \
     --http.webroot /etc/lego/webroot/ \
     --domains "your-domain.com" \
     --email your-mail@gmail.com \
     renew \
     --days 30

※「--days 30」は、「renew」に対してのオプションなので、指定する位置に気をつける。

中間証明書について

以下サイトからダウンロードする。
https://letsencrypt.org/certificates/

2020年年末から Issuer が Let's Encrypt Authority X3 から R3 に変わっているので注意が必要です。

6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7