升级到 ubuntu 18.04.1 后,curl 和 wget 无法使用 https 站点

curl and wget not working with https sites after upgrade to ubuntu 18.04.1

似乎是一个与 openssl 相关的问题。有人知道这是什么吗?

请注意 url 在浏览器中工作。

使用 wget:

# wget -d https://deb.nodesource.com/setup_8.x

DEBUG output created by Wget 1.19.4 on linux-gnu.

Reading HSTS entries from /home/user/.wget-hsts
URI encoding = ‘UTF-8’
Converted file name 'setup_8.x' (UTF-8) -> 'setup_8.x' (UTF-8)
--2018-09-02 19:54:06--  https://deb.nodesource.com/setup_8.x
Could not seed PRNG; consider using --random-file.
OpenSSL: error:2406F07A:random number generator:RAND_load_file:Not a regular file
Disabling SSL due to encountered errors.

与curl:

# curl -v -L https://deb.nodesource.com/setup_8.x

*   Trying 205.251.207.2...
* TCP_NODELAY set
* Connected to deb.nodesource.com (205.251.207.2) port 443 (#0)

<hangs>

您似乎 运行 喜欢这个 OpenSSL bug/feature:1.1.1 -> RAND_load_file() does not accept special files

查看源代码opwget,可以看到它在函数init_prng()中调用了RAND_load_file()。该函数还解释了一些可用于指向不同文件(应该是常规文件)的选项:

  /* Seed from a file specified by the user.  This will be the file
     specified with --random-file, $RANDFILE, if set, or ~/.rnd, if it
     exists.  */

您可以尝试其中的任何一个,或者使用 1.1.0 版本的 OpenSSL。或者像你已经做的那样使用 gnutls:-)


顺便说一句,我无法重现你的问题,所以我不能确定这是原因。但是,我认为您的问题不是升级到 18.04.1 引起的。您当前的 OpenSSL 安装似乎被其他东西弄乱了。版本号表示这是从未标记的 OpenSSL 存储库状态构建的。我不希望这些库在驻留在 /usr/lib/x86_64-linux-gnu.

中的 "standard" OpenSSL 库之前出现在您的 LD_LIBRARY_PATH

根据来回的评论,最后的结论是您过去构建并安装了一个版本的 OpenSSL 1.1.1,当时它运行良好。但是更新到18.04.1后,提到的bug暴露了。弄清楚该更新中的哪些确切更改导致了它会很有趣,但我想现在知道您的问题的直接答案就足够了:-)