Child pages
  • Amazon Linux AMI 에서 letencrypt certbot 으로 SSL 인증서 발급 에러

ImportError: No module named cryptography.hazmat.bindings.openssl.binding

증상

아마존 리눅스에서 certbot 실행시 "ImportError: No module named cryptography.hazmat.bindings.openssl.binding" 에러가 발생하며 발급 중지

$  cat /etc/system-release

Amazon Linux AMI release 2017.09
$ ./certbot certonly --debug


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 41, 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 rand, crypto, SSL
  File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
ImportError: No module named cryptography.hazmat.bindings.openssl.binding


조치

/opt/eff.org/certbot/venv/lib64/python2.7/site-packages/ 에 sitecustomize.py 를 만들고 다음 내용 추가

$ echo -e "import site\nsite.addsitedir('/opt/eff.org/certbot/venv/lib64/python2.7/dist-packages')" > /opt/eff.org/certbot/venv/lib64/python2.7/site-packages/sitecustomize.py


certbot 재실행

$ ./certbot-auto certonly --debug 


Ref



UnicodeDecodeError: 'ascii' codec can't decode byte

증상

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 330: ordinal not in range(128)


조치

설정 파일에 Non-Ascii 문자가 포함되어서 발생하며 GNU iconv 를 사용하여 설정 파일을 ASCII 로 강제 변환해서 처리

설정 파일에 한글 주석이 있는 경우에도 발생하므로 한글 주석을 삭제하거나 영어로 작성한다..

for i in sites-enabled/*.com; do echo $i; iconv -f UTF-8 -t US-ASCII//TRANSLIT -o $i.txt $i;done    



Ref