YANO's digital garage

Copyright ©YANO All rights reserved. https://www.bravotouring.com/~yano/

Last-modified: 2024-03-20 (水)


[一語一絵/IT系]

Let's Encrypt更新 / 2021-03-06 (土)

先週日曜、Webサーバーから

E: Package 'python-virtualenv' has no installation candidate
というエラーメール着弾。どうやらUbuntu 20.04 (Focal Fossa)にアップデートした余波でLet's Encryptの自動更新がエラーになったようだ。

Let's Encrypt
Let's Encrypt

[External]Ubuntu 20.04 上の certbot-auto でエラーが出る場合に倣ってpythonをpython3に書き換えてみたがダメ。手動でpython3-virtualenvをinstallしてみたものの、結局python2.7を見に行ってpipが古いと怒られる始末。

そもそも古いのは5年前に導入した自動更新スクリプトなんじゃね?と思い、git pullしなおしてみたものの、今度は

Skipping bootstrap because certbot-auto is deprecated on this system.
/opt/letsencrypt/letsencrypt-auto has insecure permissions!
To learn how to fix them, visit https://community.letsencrypt.org/t/certbot-auto-deployment-best-practices/91979/
Your system is not supported by certbot-auto anymore.
Certbot cannot be installed.
Please visit https://certbot.eff.org/ to check for other alternatives.
という結果に。

最新LTSのUbuntu 20がnot supportedてどういう事!?と思ったのだが、[External]2021年版Let's EncryptでのSSL証明書の発行方法/SSL化の方法によると

これまでcertbot-autoで証明書の発行ができたと思いますが、2020年12月のリリース1.10.0からDebian系で非対応になり、2021年1月のリリース1.11.0では全てのOSで非対応となりました。
という事で驚いたのだが、[External]Certbot-auto no longer works on Debian based systemsによると
The biggest factor that drove this deprecation now was Python 2 reaching its end-of-life this year. When this script was initially written 5 years ago, it was written to use Python 2 on most systems. While Python 2 is still receiving security support by various distros, the Python ecosystem has moved on and many of our dependencies are dropping support for Python 2. In order to continue to provide updates to our users, we have to get them on Python 3. We tried to migrate certbot-auto users to Python 3 in the past, but it's a ton of work and extremely error prone. Instead of trying to do this work and hope we didn't break anything (like we did last time 3), we decided to sunset the script in favor of other distribution methods.
という経緯があって、つまるところがPython3への移行を諦めてsnap版として再構築したという事らしい。

というわけで、

yano@vps:~$ sudo apt remove certbot-auto certbot
yano@vps:~$ sudo apt install snapd
yano@vps:~$ sudo snap install core; sudo snap refresh core
yano@vps:~$ sudo snap install --classic certbot
yano@vps:~$ sudo certbot renew
yano@vps:~$
とやって無事に証明書の更新ができた。

【参照】
●初めてのVPS構築 https://linux-svr.com/
無料の「Let's Encrypt」のSSL証明書のApacheへの設定手順 2018年9月30日
「Let's Encrypt」のsnap版certbotのインストール手順とテスト方法 2021年1月18日
●Certbot https://certbot.eff.org/
Certbot Instructions
Ubuntufocal Apache
●Let's Encrypt https://letsencrypt.org/
Certbot-auto deployment best practices 2019年4月24日
Certbot-auto no longer works on Debian based systems 2020年12月4日
●Let's Encrypt 総合ポータル https://letsencrypt.jp/
Let's Encrypt の使い方
ユーザーガイド
●Qiita http://qiita.com/
2021年版Let's EncryptでのSSL証明書の発行方法/SSL化の方法 2021年1月28日