Certbot ImportError: ‘pyOpenSSL‘ module missing required functionality

本文探讨了在CenOS上遇到的Certbot renew命令失败问题,原因可能是pyOpenSSL模块版本过旧。解决方案包括卸载并重新安装相关Python包,如requests、six和urllib3。

原文地址:Certbot ImportError: 'pyOpenSSL' module missing required functionality(永久地址,保存网址不迷路 🙃)

问题描述

执行 certbot renew 产生如下错误:

# certbot renew --renew-hook "docker-compose -f /usr/local/harbor/docker-compose.yml restart"
/usr/lib/python2.7/site-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).
Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please comment in
https://github.com/pypa/setuptools/issues/1458
about the steps that led to this unsupported combination.
************************************************************
  sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
Traceback (most recent call last):
  File "/usr/bin/certbot", line 9, in <module>
    load_entry_point('certbot==1.0.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2859, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 2, in <module>
    from certbot._internal import main as internal_main
  File "/usr/lib/python2.7/site-packages/certbot/_internal/main.py", line 20, in <module>
    from certbot._internal import client
  File "/usr/lib/python2.7/site-packages/certbot/_internal/client.py", line 14, in <module>
    from acme import client as acme_client
  File "/usr/lib/python2.7/site-packages/acme/client.py", line 37, in <module>
    requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()  # type: ignore
  File "/usr/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 118, in inject_into_urllib3
    _validate_dependencies_met()
  File "/usr/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 160, in _validate_dependencies_met
    "'pyOpenSSL' module missing required functionality. "
ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer.

问题原因

在 CenOS 中,或者其他发行版,我们可以通过 pip 安装 Python 模块,也可以使用 yum 源安装 Python 模块。

也就说,问题可能有两种原因:
1)同个包即通过 yum 安装,也通过 pip 安装,最后导致冲突
2)或者某个模块依赖于更新版本的 pyOpenSSL 模块

从日志中看,可能是 urllib3 模块的问题。

解决办法

下面是原文作者给出的解决方案,能够解决我们的问题:

pip uninstall -y requests
yum reinstall -y python-requests
pip uninstall -y six
yum reinstall -y python-six
pip uninstall -y urllib3
yum reinstall -y python-urllib3

相关文章

「Certbot」- 仅申请证书、在内网中申请证书、DNS01
「Certbot」- ocsp.int-x3.letsencrypt.org Read timed out
「Certbot」- The manual plugin is not working
「ACME protocal」- 原理简述
「Certbot」- Rate Limits
「Certbot」- SERVFAIL looking up CAA for
「Certbot」- 基本概念

参考文献

ImportError: ‘pyOpenSSL’ module missing required functionality. Try upgrading to v0.14 or newer.

[root@wpf-centos7 ~]# certbot --apache -d yourdomain.com -d www.yourdomain.com /usr/lib/python2.7/site-packages/josepy/util.py:9: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release. from cryptography.hazmat.primitives.asymmetric import rsa ^CTraceback (most recent call last): File "/usr/bin/certbot", line 9, in <module> load_entry_point('certbot==1.11.0', 'console_scripts', 'certbot')() File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point return ep.load() File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "/usr/lib/python2.7/site-packages/certbot/main.py", line 2, in <module> from certbot._internal import main as internal_main File "/usr/lib/python2.7/site-packages/certbot/_internal/main.py", line 17, in <module> from certbot import crypto_util File "/usr/lib/python2.7/site-packages/certbot/crypto_util.py", line 13, in <module> from cryptography import x509 # type: ignore File "/usr/lib64/python2.7/site-packages/cryptography/x509/__init__.py", line 8, in <module> from cryptography.x509.base import ( File "/usr/lib64/python2.7/site-packages/cryptography/x509/base.py", line 23, in <module> from cryptography.x509.extensions import Extension, ExtensionType File "/usr/lib64/python2.7/site-packages/cryptography/x509/extensions.py", line 630, in <module> class ReasonFlags(Enum): File "/usr/lib/python2.7/site-packages/enum/__init__.py", line 257, in __new__ enum_class._value2member_map_[value] = enum_member KeyboardInterrupt [root@wpf-centos7 ~]# certbot --apache -d gxlscc.fun -d www.gxlscc.fun /usr/lib/python2.7/site-packages/josepy/util.py:9: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release. from cryptography.hazmat.primitives.asymmetric import rsa Traceback (most recent call last): File "/usr/bin/certbot", line 9, in <module> load_entry_point('certbot==1.11.0', 'console_scripts', 'certbot')() File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point return ep.load() File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "/usr/lib/python2.7/site-packages/certbot/main.py", line 2, in <module> from certbot._internal import main as internal_main File "/usr/lib/python2.7/site-packages/certbot/_internal/main.py", line 21, in <module> from certbot._internal import account File "/usr/lib/python2.7/site-packages/certbot/_internal/account.py", line 17, in <module> from acme.client import ClientBase # pylint: disable=unused-import File "/usr/lib/python2.7/site-packages/acme/client.py", line 39, in <module> requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3() # type: ignore File "/usr/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 133, in inject_into_urllib3 _validate_dependencies_met() File "/usr/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 175, in _validate_dependencies_met "'pyOpenSSL' module missing required functionality. " ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer. [root@wpf-centos7 ~]#
最新发布
11-27
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值