ssl - 如何在 Ubuntu 中将 OpenSSL 从 1.0.2g 升级到 1.1.0g 并让 python 识别新的 OpenSSL

标签 ssl openssl ubuntu-16.04 tls1.2 pyopenssl

我有 Ubuntu 16.04。它有 OpenSSL 1.0.2g。我需要使用 OpenSSL 1.1.0g。请注意,OpenSSL 1.1.0g 安装在我的另一台机器 Ubuntu 18 中。但是我需要在 Ubuntu 16.04 中运行一个 python 程序,但我需要特定的 OpenSSL 1.1.0g。我做了:

sudo apt-get upgrade
sudo apt-get update

但是我的 Ubuntu 机器中的 OpenSSL 没有得到更新。我该如何更新它?

我使用 python socket, ssl 模块在端口 443 中建立 TLS 连接。如果我更新旧的 OpenSSL 1.0,python 会自动识别 OpenSSL 1.1.0g .2gOpenSSL 1.1.0g

升级OpenSSL的原因是我需要运行python程序ssl socket,但我需要程序使用OpenSSL 1.1.0g

当我尝试时:

sudo apt-get install openssl

并通过以下方式检查 OpenSSL 版本:openssl version -a 我得到旧版本 OpenSSL 1.0.2g

如何在我的 Ubuntu 14.06 机器上获取新版本 OpenSSL 1.1.0g

最佳答案

为什么仅通过更新无法让 OpenSSL 1.1.0g 在 Ubuntu 16.04 上运行:

您的 Ubuntu 18OpenSSL 1.1.0g 因为该版本在其存储库中可用。有时,它在存储库系统上有多个版本的包可用。但是,看起来 Ubuntu 16.04 根本没有您需要的版本。这就是为什么您不能,并且您将无法通过更新使 OpenSSL 1.1.0gUbuntu 16.04 上运行。存储库中可用的版本是 different .

以及如何去做:

您要么需要手动安装它,要么为 Ubuntu 16.04 找到一个存储库,使 OpenSSL 1.1.0g 在系统上可用。我不确定是否有可用的存储库,所以如果您想手动安装它,请按照以下步骤操作:

wget https://www.openssl.org/source/old/1.1.0/openssl-1.1.0g.tar.gz
tar xzvf openssl-1.1.0g.tar.gz
cd openssl-1.1.0g
./config
make
sudo make install

openssl version -a

就是这样!

警告:默认情况下,通过安装系统中不可用的新版本 OpenSSL,您引入的版本与系统维护提供的更新不兼容.你需要自己照顾它。也许,根据您的情况,值得您使用 Ubuntu 18,它默认具有您需要的 OpenSSL 版本。这是最简单、最安全的方法。

希望一切顺利。 祝你好运!

关于ssl - 如何在 Ubuntu 中将 OpenSSL 从 1.0.2g 升级到 1.1.0g 并让 python 识别新的 OpenSSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51560964/

相关文章:

ruby-on-rails - 如何在 Rails 3.1+ 中将参数传递给 Thin 以配置 SSL?

php - 如何让新版本的 openssl 显示在我的 phpinfo 中

ssl - SSL证书有什么意义?

ssl - Thunderbird 中对 LDAP 的 TLS 支持

security - "an introduction to openssl programming."文章。过期证书

cryptography - 使用 openssl EVP 例程使用公钥加密文件

linux - Ubuntu 16.04 上的 ng 服务问题

Swift 测试有时会失败并出现 "module map file"错误

redis - 无法连接到位于 127.0.0.1 的 Redis :6379: Connection refused

kotlin - 具有自签名 ssl 证书的 GRPC Okhttp android 客户端 channel