letsencrypt 的 certbot 缺少 pyopenssl 模块

letsencrypt 的 certbot 缺少 pyopenssl 模块

我需要帮助设置 LetsEncrypt 的 CertBot

我在 CentOS 7 上运行 Python 2.7

当我运行 certbot 时出现以下错误:

[root@li86-193 frappe-bench]#certbot certonly --manual

Traceback (most recent call last):
  File "/usr/bin/certbot", line 7, in <module>
    from certbot.main import main
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 21, in <module>
    from certbot import client
  File "/usr/lib/python2.7/site-packages/certbot/client.py", line 10, in <module>
    from acme import client as acme_client
  File "/usr/lib/python2.7/site-packages/acme/client.py", line 31, in <module>
    requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 112, in inject_into_urllib3
    _validate_dependencies_met()
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 147, in _validate_dependencies_met
    raise ImportError("'pyOpenSSL' module missing required functionality. "
ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer.

[root@li86-193 frappe-bench]# pip show certbot
Name: certbot
Version: 0.11.1
Summary: ACME client
Home-page: https://github.com/letsencrypt/letsencrypt
Author: Certbot Project
Author-email: [email protected]
License: Apache License 2.0
Location: /usr/lib/python2.7/site-packages
Requires: ConfigArgParse, configobj, zope.component, pytz, setuptools, cryptography, zope.interface, pyrfc3339, mock, parsedatetime, six, acme, PyOpenSSL

[root@li86-193 frappe-bench]# pip show pyopenssl
Name: pyOpenSSL
Version: 16.2.0
Summary: Python wrapper module around the OpenSSL library
Home-page: https://pyopenssl.readthedocs.io/
Author: Hynek Schlawack
Author-email: [email protected]
License: Apache License, Version 2.0
Location: /usr/lib/python2.7/site-packages
Requires: six, cryptography

请帮忙

谢谢

答案1

不要尝试在 CentOS/RHEL 系统上手动安装 certbot。这只会造成很大的混乱。相反,请从 EPEL 安装它。

yum install epel-release
yum install certbot

答案2

在过去 2 个月中,我在 2 个不同的 Centos7 系统上两次遇到过同样的问题。以下是对我有用的方法:

  • yum remove pyOpenSSL [这将删除通过 epel 安装的 certbot]
  • yum install openssl-devel python-devel [实际上可能需要也可能不需要]
  • pip 安装 certbot
  • pip 安装 certbot-apache

完成这些步骤后,我就能够使用 certbot 成功更新我的证书。

答案3

我遇到了同样的问题。使用 python venv,我能够使用 pip 让 certbot 运行。

步骤:安装virtualenv

pip install virtualenv --upgrade

创建一个虚拟环境

virtualenv -p /usr/bin/python2.7 certbot

激活certbot虚拟环境

. /root/certbot/bin/activate

你的提示可能会变成这样

(certbot) [root@hostname ~]#

然后 pip 安装 certbot

pip install certbot

完成后,您可以在虚拟环境certbot中测试命令certbot,但如果您要使用 cron 设置 certbot 续订,则这不切实际。因此,请停用虚拟环境,

(certbot) [root@hostname ~]# deactivate

现在从运行 certbot 命令

/root/certbot/bin/certbot

答案4

这对我似乎有用。

从这里获取 rpm: http://rpm.pbone.net/index.php3/stat/4/idpl/31446026/dir/centos_7/com/pyOpenSSL-0.15.1-1.el7.noarch.rpm.html

wget ftp://ftp.muug.mb.ca/mirror/centos/7.2.1511/cloud/x86_64/openstack-mitaka/common/pyOpenSSL-0.15.1-1.el7.noarch.rpm
sudo rpm -Uvh pyOpenSSL-0.15.1-1.el7.noarch.rpm
sudo yum install certbot

相关内容