LoginSignup
7
4

More than 3 years have passed since last update.

Let'sEncrypt の自動更新に失敗して期限が切れてた

Last updated at Posted at 2018-03-22

環境

  • OS: CentOS 6.9
  • Apache 2.2系

Let'sEncrypt のステータス

  • version: 0.20
  • 導入日: 2017年9月中旬
  • 期限切れ日: 2018年3月中旬
  • 12月の自動更新はうまくいってたらしい

ログの確認

/opt/eff.org/certbot/venv/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6

とりあえずこのキーワードでググる。
公式サイトが引っかかる。
DeprecationWarning について
バグっぽいのでアップデートすれば治るらしい。

certbot をアップデートする

といっても、 CentOS6 だと yum のリポジトリに登録されていないので以下の手順で。

certbot-auto の位置を確認する

which certbot-auto
CentOS6 だとそれぞれ置いてある位置が違う。
自分の場合は /user/bin/certbot-auto にあった。

最新版をダウンロードして設置

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
mv certbot-auto /user/bin/

/user/bin/ はさっき調べた時のディレクトリ。
上書きするか聞かれるので y を押す。

証明書の更新してみよう

/usr/bin/certbot-auto certonly --no-self-upgrade --post-hook "service httpd graceful"
cron に書いてある記述をそのまま実行。
先ほどのエラーは出なくなった!
が、違うエラーが出てきた。

All renewal attempts failed. The following certs could not be renewed:                                                                               
  /etc/letsencrypt/live/xxxx.com/fullchain.pem (failure)

保存に失敗した系?

新しく申請する

証明書フォルダ削除

削除と書いたが、やっぱり削除は怖いので移動(チキン)。

mkdir /etc/letsencrypt/live/_backup
mv /etc/letsencrypt/live/xxxx.com /etc/letsencrypt/live/_backup

新規登録

/usr/bin/certbot-auto certonly --standalone -d xxxx.com

再びエラー

certbot.errors.StandaloneBindError: Problem binding to port 443: Could not bind to IPv4 or IPv6.

443 のポート開いてると駄目らしい。

Apache 閉じて再実行

servce httpd stop
/usr/bin/certbot-auto certonly --standalone -d xxxx.com

すると。

Your cert will expire on 2018-06-00. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again. To non-interactively renew *all* of your certificates, run "certbot-auto renew"

成功したっぽい。

Apache を起動

service httpd start

Apache でエラー

ログは喪失したが、要約すると「証明書の指定間違ってるよ」とのこと。
なんで?って思い証明書の位置を見にいったら、ディレクトリが変わっていた。
/etc/letsencrypt/live/xxxx.com-0001
なんで?

vim /etc/httpd/conf.d/ssl.conf

該当する行をバシバシ -0001 を追加。

Apache をもう一度起動

service httpd start

今度こそ起動。
サイトも SSL になっていた。

ちゃんとメンテしよう

監視もしよう。

7
4
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
7
4