証明書切れ…Σ(´∀`;)

この記事は1年以上前に書かれたものです。 情報が古い可能性があります。

このブログの証明書切れに気づいたので。

1日で気づいてよかった!

 

Let's encrypt を使ってるので 3 か月ごとに更新が必要なんですよね。

認証は http-01 なので、サイトが動いてればできるはず。正常なら。。。

 

更新は cron で renew を入れるだけなんですが、失敗していた模様。

 

原因 1.

コマンドがミスってた

多くのサイトにこう書いてますよね。。。

更新用のコマンド certbot renew

こんなコマンドがなかったのです(多分パッケージによりますが)。

正しくは

certbot-auto renew

私の環境の場合 /usr/bin/certbot-auto なので、コマンドを修正して終了。

 

cron はこんな感じ。

0 3 10 * * /usr/bin/certbot/certbot-auto renew >> /root/renew.log && /usr/bin/systemctl nginx restart

ログが見えなくて困ったので、適当に吐き出すように設定。

このままだと更新がなくても月に1回 nginx が再起動してしまうので、ほんとは –post-hook オプションを使うほうがよさそう。

書式は

–post-hook "systemctl reload nginx"

最終的には

0 3 10 * * /usr/bin/certbot/certbot-auto renew --post-hook "systemctl reload nginx"  1>>/root/cert.log 2>&1

 

原因 2.

エラー

Attempting to renew cert (xxxxx.com) from /etc/letsencrypt/renewal/www.naokilog.com.conf produced an unexpected error: 'ascii' codec can't decode byte 0xe8 in position 9: ordinal not in range(128). Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/www.naokilog.com/fullchain.pem (failure)

nginx のコメントに日本語があったらエラーになる模様。

テキトウに英語に書き直して対処。

 

試験前日に何やってんだろ(´・ω・`)

コメント

タイトルとURLをコピーしました