1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Let's encrypt の証明書を無停止で更新する

1
Last updated at Posted at 2019-01-19

Let's encryptの証明書の有効期限が90日という衝撃の事実を最近知ったので、今回はその更新方法をまとめておきます。

更新方法

以下のコマンドでOKです。これで、サーバ内で有効期限が近いドメインの証明書が全て更新されます。

なお、私はwget経由でcertbotを取ってきたので以下のようなコマンドになってます。

./certbot-auto renew

certbotがコマンドとして使える場合は以下のようにしてもなるはずです。

sudo certbot renew

これをすればnginxを特に停止させずに更新できました。簡単ですね。

更新した証明書の有効期限を確認する

./certbot-auto certificatesで証明書の有効期限が確認できます。

$ ./certbot-auto certificates
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: xxxxxxxxxx.work
    Domains: xxxxxxxxxx.work
    Expiry Date: 2019-03-01 09:48:21+00:00 (VALID: 41 days)
    Certificate Path: /etc/letsencrypt/live/xxxxxxxxxx.work/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/xxxxxxxxxx.work/privkey.pem

ちなみに、Let's encryptの更新期限が残り20日になると以下のようなメールが届くみたいですね。

Hello,

Your certificate (or certificates) for the names listed below will expire in 19 days (on 01 Feb 19 23:57 +0000). Please make sure to renew your certificate before then, or visitors to your website will encounter errors.

We recommend renewing certificates automatically when they have a third of their
total lifetime left. For Let's Encrypt's current 90-day certificates, that means
renewing 30 days before expiration. See
https://letsencrypt.org/docs/integration-guide/ for details.

xxxxxxxxxx.work

自動更新ではないので注意

自動更新するためにはWebrootプラグインとかが必要みたいですが、私はnginx導入時にそれを導入していなかったので今後も手動で更新していこうと思っています。

もし無停止でWebrootプラグインを導入できて、自動更新できるようなものを知っていればぜひ教えてください。

参考

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?