尝试在 Amazon Linux 上运行时: Linux ip #1 SMP Sat Oct 24 01:31:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Git 提交哈希: 6950dbd0708d3ba16b717ad1097332fc37e33f15
我收到以下错误:
[ec2-user<strong i="10">@ip</strong> letsencrypt]$ ./letsencrypt-auto
Checking for new version...
Creating virtual environment...
Installing Python packages...
Requesting root privileges to run letsencrypt...
sudo /home/ec2-user/.local/share/letsencrypt/bin/letsencrypt --no-self-upgrade
Traceback (most recent call last):
File "/home/ec2-user/.local/share/letsencrypt/bin/letsencrypt", line 7, in <module>
from letsencrypt.cli import main
File "/home/ec2-user/.local/share/letsencrypt/local/lib/python2.7/dist-packages/letsencrypt/cli.py", line 21, in <modul
e>
import OpenSSL
File "/home/ec2-user/.local/share/letsencrypt/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <modul
e>
from OpenSSL import rand, crypto, SSL
File "/home/ec2-user/.local/share/letsencrypt/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/home/ec2-user/.local/share/letsencrypt/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
这在 2 月 8 日开始工作......但是,当尝试检查旧版本以查找问题所在时,letsencrypt-auto 不断将自身重新升级到最新版本!
任何更新..我也面临同样的问题..
以下是日志(环境 - amazon linux)
发出的命令: ./letsencrypt-auto --help
Checking for new version...
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Requesting root privileges to run letsencrypt...
sudo /home/ec2-user/.local/share/letsencrypt/bin/letsencrypt --help
Traceback (most recent call last):
File "/home/ec2-user/.local/share/letsencrypt/bin/letsencrypt", line 7, in <module>
from letsencrypt.cli import main
File "/home/ec2-user/.local/share/letsencrypt/local/lib/python2.7/dist-packages/letsencrypt/cli.py", line 21, in <module>
import OpenSSL
File "/home/ec2-user/.local/share/letsencrypt/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/ec2-user/.local/share/letsencrypt/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/home/ec2-user/.local/share/letsencrypt/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
尝试这个
须藤 ./letsencrypt-auto --help
尝试了上面的命令,它起作用了。
同样的问题,也通过前缀 sudo 解决。 这是怎么解决的?
同样的问题发生并使用 sudo 修复,谢谢
在 Amazon Linux 上更新到最新的 certbot 后,我也遇到了这个问题(Linux ip-172-31-10-255 4.9.75-25.55.amzn1.x86_64 #1 SMP Fri Jan 5 23:50:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux)
似乎在/opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/cryptography/
下安装了加密包
但是 python 没有找到它,因为它没有在 lib64 路径之外查找/操作。 注意下面的所有路径都是/lib/
而不是/lib64/
我已经完全删除了这个 env rm -rf /opt/eff.org
并重新安装了 cert-bot 并且仍然遇到相同的错误/问题。
`
[root@ip-172-31-10-255 venv]# /certbot/certbot-auto --debug renew
Error: couldn't get currently installed version for /opt/eff.org/certbot/venv/bin/letsencrypt:
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
@utdrmac我刚才在部署新证书时遇到了同样的错误 - 您的评论激发了以下黑客修复,通过剥洋葱并将依赖项链接回local/lib/python2.7
路径收集:
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/cryptography /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/cryptography
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/cryptography-2.0.2.dist-info /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/cryptography-2.0.2.dist-info
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/cffi /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/cffi
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/cffi-1.10.0.dist-info /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/cffi-1.10.0.dist-info
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/_cffi_backend.so /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/_cffi_backend.so
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/.libs_cffi_backend /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/.libs_cffi_backend
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/zope.interface-4.1.3-py2.7-nspkg.pth /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope.interface-4.1.3-py2.7-nspkg.pth
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/zope.interface-4.1.3-py2.7.egg-info /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope.interface-4.1.3-py2.7.egg-info
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/zope/interface /opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope/interface
@HinchK我也考虑过这个问题,但是是的,确实非常 hack-y。 请查看此解决方案: https :
@HinchK谢谢。 那(暂时)为我修复了它。 (AWS)
@HinchK ,你的解决方案很棒。 谢谢。
@HinchK的解决方案同样修复了我的 AWS Linux 服务器。
当我今天去更新我的证书并且 certbot 从 0.19.0 更新到 0.21.1 时,它坏了。
我自己第二次遇到了这个问题。 当 certbot 在没有足够权限的情况下运行升级时,这似乎是一个问题。 更新以静默方式失败,当 certbot 尝试实际运行时,检测到软件处于错误状态。 在库安装/更新例程中更好的错误检测可能有助于防止将来出现混淆。
@utdrmac链接到上面的解决方案为我解决了这个问题(但必须以 root 身份运行它)。 当 certbot 刚刚尝试升级到 0.22.0 时(在 AWS EC2 上),遇到了同样的错误。
刚刚在不同的 AWS 区域再次遇到这个问题; 并且可以通过 pip 确认@utdrmac的安装对我https://github.com/certbot/certbot/issues/1680#issuecomment -358728515
在我的实例中推出 pip certbot; 因为我之前的符号链接解决方法是一个非常粗暴的黑客,它有效但可能不会在未来奏效。
我遇到了同样的问题。 这是为我解决的问题:
/opt/eff.org/certbot/venv/local/bin/pip 安装加密接口
在尝试了其他一切之后, @HinchK的 hack 是唯一对我
我还可以确认 awls99 - 前几天遇到了同样的问题,尝试了一切,所有解决方案对该问题的影响为 0。
@HinchK方式解决了这个问题。
@gmegidish解决方案对我很有用。 我在亚马逊 linux ec2 实例上运行它。
@HinchK一枪一杀! :-)
@gmegidish是男人!!!
谢谢!!
/opt/eff.org/certbot/venv/local/bin/pip 安装加密接口
为我工作!
@alex ,知道这里会发生什么吗?
我们目前使用加密 2.0.2、pyOpenSSL 16.2.0 和https://github.com/certbot/certbot/blob/master/letsencrypt-auto-source/pieces/dependency-requirements.txt 中的其他固定
如果这是关于 Amazon Linux,我猜是https://github.com/pypa/pip/issues/4464
抄送: @reaperhulk
嘿,
我找到了一个对我有用的解决方案,通过 CTRL-F 用我的眼睛浏览网页。
在此链接上, @ utdrmac 直接使用 pip 安装 certbot。
https://github.com/certbot/certbot/issues/1680#issuecomment -358728515
至少我为我工作。
哦,考虑一下使用 pip 安装 certbot 插件也可以管理 nginx 的自动配置( @bmw ):
https://github.com/certbot/certbot/issues/1736#issuecomment -165189246
祝你好运 !
编辑:我也在 Amazon linux 上安装证书。
再次遇到这个问题,按照操作,首先尝试,现在我的 crontab 看起来像:
0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/bin/certbot renew --no-bootstrap --nginx 1> /var/log/cerbot.log 2>&1
我今天遇到了同样的问题, @HinchK的解决方案工作正常,我只需要更换
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/cryptography-2.0.2.dist-info /opt/eff.org/certbot/venv/local/lib/ python2.7/dist-packages/cryptography-2.0.2.dist-info
经过
ln -s /opt/eff.org/certbot/venv/local/lib64/python2.7/dist-packages/cryptography-2.2.2.dist-info /opt/eff.org/certbot/venv/local/lib/ python2.7/dist-packages/cryptography-2.2.2.dist-info
并发挥了魅力。
我今天遇到了这个问题。
我在 Amazon Linux AMI 4.4.30-32.54.amzn1.x86_64 上对 certbot 0.26.1 的解决方法是:
cd /opt/eff.org/certbot/venv/lib64/python2.7
rmdir 站点包(在我的例子中,这个目录是空的)
ln -s dist-packages 站点包
这就是全部,它对我有用。
确认@smartITNinja解决方案也适用于我。
那些在 Amazon Linux 1 或 2 上有问题吗? 如果是 Amazon Linux 2,您可以而且应该使用 EPEL7 包超过certbot-auto
。 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-an-instance.html#letsencrypt描述了如何安装这些软件包
@smartITNinja @lpkirby
当我尝试ln dist-packages site-packages
,我得到了hard link not allowed for directory
。
你真的将 dist-packages 硬链接到 site-packages 吗?
@saiday - fwiw - 不,我做了一个符号链接。
@bmw - 这很有趣。 AWS 文档中的某些地方说您不应在 Amazon Linux 2 中安装 EPEL,而有些地方则向您展示了如何安装。
@bmw亚马逊 Linux 1
@saiday抱歉,它是“软链接”而不是硬链接。 评论现已修复,包括正确的步骤。 谢谢!
/opt/eff.org/certbot/venv/lib64/python2.7
drwxr-xr-x 9 root root 4096 Jul 18 14:14 dist-packages
lrwxrwxrwx 1 root root 13 Jul 18 14:26 site-packages -> dist-packages
那很有意思。 AWS 文档中的某些地方说您不应在 Amazon Linux 2 中安装 EPEL,而有些地方则向您展示了如何安装。
呵呵。 不幸的是,我对 Amazon Linux 2 的了解不够,无法以一种或另一种方式提供推荐。 我只能说:
certbot-auto
。@smartITNinja thx,这解决了我在亚马逊 EC2 中的问题
@smartITNinja今天在 Amazon Linux 1 EC2 上为我工作。
干杯👍
唯一有效的是@smartITNinja的 hack。 我一直遇到这个问题。 需要更新 certbot 脚本以“捕获”它并解决它或提供有用的错误消息。 AWS EC2 是一个主要的发行版,Let's Encrypt 应该开箱即用。 时期。
在 Amazon Linux AMI 上遇到了同样的问题。
最终只使用了 certbot docker 容器。 花了大约 90 秒。
假设您已安装并运行 docker:
docker pull certbot/certbot
docker run -it --rm --name certbot \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
certbot/certbot \
certonly --manual --preferred-challenges dns-01 --agree-tos -d "example.com" -d "*.example.com" --server https://acme-v02.api.letsencrypt.org/directory
我在我使用的基础 AMI 上遇到了这个问题。 我这样做是为了解决这个问题。 (符号链接对我不起作用)
sudo rm -Rf /opt/eff.org
sudo /opt/letsencrypt/letsencrypt-auto --help --debug
现在基础已经固定,我可以按预期将它用于任何网站。 如果您还没有证书并且仅在您的基础上工作,则这种方式很好。
如果您已经拥有证书或需要更新:
首先删除坏包:
sudo rm -Rf /opt/eff.org
将--debug
附加到您正在运行的命令。
感谢@gmegidish,我找到了对我
unset PYTHON_INSTALL_LAYOUT
sudo rm -rf /opt/eff.org/certbot/
pip install cryptography interface
./certbot-auto renew -v --debug
/opt/letsencrypt/letsencrypt-auto --help
(测试它是否有效)
更新:
我刚刚完成了 Amazon Linux 2 的基本安装,最新的 certbot 几乎开箱即用。 我唯一需要安装的是来自 AWS yum 存储库的 python-virtualenv。
关闭支持跟踪支持和推荐的安装路径,适用于 Amazon Linux 1 的 #6505 和适用于 Amazon Linux 2 的 #6506。
这做到了: sudo /opt/eff.org/certbot/venv/local/bin/pip install cryptography interface zope
这做到了:
sudo /opt/eff.org/certbot/venv/local/bin/pip install cryptography interface zope
这也对我有用。
而且……最新的 certbot 更新崩溃了:
Requesting to rerun ./certbot-auto with root privileges...
Upgrading certbot-auto 0.40.0 to 0.40.1...
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 41, in <module>
from josepy.interfaces import JSONDeSerializable
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/interfaces.py", line 7, in <module>
from josepy import errors, util
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/util.py", line 7, 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
使用以下方法修复它:
sudo /opt/eff.org/certbot/venv/local/bin/pip install cryptography interface zope
这让我再次工作......也许它不应该自动更新?
这让我再次工作......也许它不应该自动更新?
如果您想要这种行为,您可以使用标志--no-self-upgrade
,但是,请记住,这将使您退出所有更改以确保安全或让您与 Let's Encrypt 的服务器兼容。
还请记住,当您第一次在 Amazon Linux 上运行没有标志的 certbot-auto 时,它会退出并显示以下消息:
FATAL: Amazon Linux support is very experimental at present...
if you would like to work on improving it, please ensure you have backups
and then run this script again with the --debug flag!
在发生变化之前(由 https://github.com/certbot/certbot/issues/6505 跟踪),我认为您应该继续期待出现此类问题。
我有一个 Ec2 Amazon Linux AMI 实例的解决方案:
在 venv 中安装所有软件包:
/opt/eff.org/certbot/venv/bin/pip2 install cryptography zope interface
/opt/eff.org/certbot/venv/bin/pip2 install --upgrade pip
接下来你需要同步 lib64/ 和 lib/ 文件夹:
rsync -avz /opt/eff.org/certbot/venv/lib64/python2.7/dist-packages/ /opt/eff.org/certbot/venv/lib/python2.7/dist-packages/
测试:
/usr/local/bin/certbot-auto certonly --debug --webroot
在两个实例 AMI 中为我工作。 =)
对于它的价值,我决定放弃certbot-auto
脚本并通过以下步骤让它在 Amazon Linux 上运行:
pip install -y python36 python36-devel python36-tools augeas-libs libffi-devel
pip-3.6 install certbot certbot-dns-route53
我知道不推荐这样做——但它对我有用!
顺便说一句,在 Amazon Linux 2 上,它在包管理器中,您需要做的就是
amazon-linux-extras install epel
yum -y install certbot certbot-dns-route53
解决方案是启用 EPEL ,只需运行sudo yum-config-manager --enable epel
,这在certbot docs/instructions 和aws docs 中都有提到,请参见:
我服务器上的 certbot-auto 脚本只是自动更新自己(我没有意识到它会这样做,现在我知道--no-self-upgrade
标志)并且“ImportError:No module named cryptography”问题又回来了。
我设法找到了一个在这里工作的解决方案: https :
最有用的评论
@utdrmac我刚才在部署新证书时遇到了同样的错误 - 您的评论激发了以下黑客修复,通过剥洋葱并将依赖项链接回
local/lib/python2.7
路径收集: