この記事は下記記事をもとに、2019年版を作成させて頂きました。感謝。
https://qiita.com/hogehoge-banana/items/0f8285c5dcccab3f11bc
なにがおきたの?
Amazone linux にwgetでinstallしたcertbot-auto が、SSL証明書発行時に走るアップデートで、以下のエラーが発生しました。
# certbot-auto certonly --webroot -w /srv/letsencrypt/example.com/ -d example.com -m info@example.com --agree-tos
Upgrading certbot-auto 0.34.2 to 0.35.0...
Replacing certbot-auto...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Traceback (most recent call last):
File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 7, in <module>
from certbot.main import main
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/main.py", line 10, in <module>
import josepy as jose
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/__init__.py", line 44, in <module>
from josepy.interfaces import JSONDeSerializable
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/interfaces.py", line 8, in <module>
from josepy import errors, util
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/util.py", line 4, in <module>
import OpenSSL
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in <module>
from cryptography import x509
ImportError: No module named cryptography
要約
cryptographyも必要だけど、pip install cryptography
でインストールできなかったため、
pipでcertbotインストールする。
環境
$ cat /etc/system-release
Amazon Linux AMI release 2018.03
wgetで /usr/bin/
に certbot-auto
をインストールしてました
やったこと
# rm -rf /opt/eff.org/*
# pip install -U certbot
# certbot renew --debug
https://github.com/certbot/certbot/issues/1680#issuecomment-358728515
上記より引用
certbot-auto
コマンドはエラーのままなので、削除しておく。
このcertbot
コマンドは、Amazone linux特有の --debug
フラグすら不要で動作しました。ここらへんの動きはわからず。もし判る方いらっしゃったら、教えてくれると嬉しい限りです。
[補足] pip install cryptography
でインストールできなかった
# python -V
Python 2.7.16
# which pip
/usr/bin/pip
# pip install cryptography
Requirement already satisfied: cryptography in /usr/local/lib64/python2.7/site-packages
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/local/lib64/python2.7/site-packages (from cryptography)
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: ipaddress; python_version < "3" in /usr/local/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: enum34; python_version < "3" in /usr/local/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: pycparser in /usr/local/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography)