2019-03-23
Letsencryptの自動更新失敗(備忘録)
このブログを運用しているkusanagi nginx環境で、設定してたLetsencryptの自動更新が失敗して、サイトにアクセスできなくなった。 エラーメッセージを読むと、どうやらpython関連のvirtualenvというものから発生しているエラーのようだ。
OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pip wheel failed with error code 1
エラーログの内容をググってもズバリの解決策を示したサイトは見つからないため、最悪letsencryptの再導入でも良いと思い、次の方法で再導入をしてみた。
$ cd /usr/local
$ git clone https://github.com/certbot/certbot
$ cd certbot
$./certbot-auto certonly –standalone -t
これを実行したところ、まずはvirtualenvの更新作業が始まりだしたのでしめしめなどと思い見ていると、以後domainの登録などを行うプロセスとなり、ようやくsslの更新と自動更新設定が完了。
以下コマンドでssl設定が更新されていることがわかる。
$ ./certbot-auto renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/hogehoge.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not yet due for renewal
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The following certs are not due for renewal yet:
/etc/letsencrypt/live/hogehoge/fullchain.pem expires on 2019-06-21 (skipped)
No renewals were attempted.
さて3か月後はどうなっていることやら。
One Comment
./certbot-auto certonly –standalone -t の意味を調べるためにネットを当たったら、この-standaloneというパラメータはLetsencryptのcertbot自身のWeb Server機能を使用する場合のものらしいということが判明。「設定するのに80(HTTP)と443(HTTPS)のポートを使用するので、すでにapacheやnginxでWebサーバが動いていると動きません。」とのことで、SSL証明書の更新ができない。これを利用しないようにするには以下のコマンドで設定する必要がある。
certbot-auto certonly –webroot -w /var/www/sample/public -d xxxx.sample.com
早速実行したら以下のとおり設定が完了。
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Cert not yet due for renewal
You have an existing certificate that has exactly the same domains or certificate name you requested and isn’t close to expiry.
(ref: /etc/letsencrypt/renewal/hogehoge.conf)
What would you like to do?
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
1: Keep the existing certificate for now
2: Renew & replace the cert (limit ~5 per 7 days)
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel): 2
Renewing an existing certificate
IMPORTANT NOTES:
– Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/hogehoge/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/hogehoge/privkey.pem
Your cert will expire on 2019-06-22. 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”
– If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let’s Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
——————————————————————————–
参考サイト:Let’s Encryptの使い方。standaloneとwebroot