【问题标题】:Fix for Octave urlread causing Peer certificate cannot be authenticated with given CA certificates修复 Octave urlread 导致 Peer 证书无法使用给定 CA 证书进行身份验证的问题
【发布时间】:2017-01-17 00:42:14
【问题描述】:

问题

如何修复(不是解决方法)Octave(假设 libcurl 与 octave 捆绑)导致 Peer 证书无法使用给定 CA 证书进行身份验证

阅读 pkg install from forge in windows 后,Octave 维护者似乎意识到 Octave 4.0 的问题,但似乎没有可用的修复程序。

问题

看起来 Windows 上 Octave 的 urlread 不适用于 HTTPS,因为诸如 https://octave.sourceforge.io 之类的服务器证书无法使用 urlread(似乎称为 curl)所指的受信任证书进行身份验证。

例如,share\octave\4.2.0\m\pkg\private\get_forge_pkg.m 第 64 行在尝试运行 pkg install -forge时会导致问题> 安装软件包。

## Try get the list of all packages.
[html, succ] = urlread ("http://packages.octave.org/list_packages.php");    
if (! succ)
  error ("get_forge_pkg: could not read URL, please verify internet connection");
endif

从命令窗口运行 urlread 会显示以下错误。

>> [html, status, msg] = urlread ("http://packages.octave.org/list_packages.php");
>> msg
msg = Peer certificate cannot be authenticated with given CA certificates

尝试通过 HTTPS 访问 google.com,结果相同。

>> [html, status, msg] = urlread ("https://google.com");
>> msg
msg = Peer certificate cannot be authenticated with given CA certificates

IE 和 Google Chrome 根证书可以验证 sourceforge 证书。

尝试过的系统如下。

#[html, succ] = urlread ("http://packages.octave.org/list_packages.php");
sURLLink="https://octave.sourceforge.io/list_packages.php"
command=['curl --insecure ','"',sURLLink,'"'];
[succ, html] = system(command)
#if (! succ)
if (succ != 0)
  error ("get_forge_pkg: could not read URL, please verify internet connection");
endif

但是它导致了另一个错误。

>> pkg install -forge symbolic
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   559  100   559    0     0    389      0  0:00:01  0:00:01 --:--:--   393
sURLLink = https://octave.sourceforge.io/list_packages.php
succ = 0
html = bim
bsltl
cgi
....

error: get_forge_pkg: package NAME exists, but index page not available
error: called from
    get_forge_pkg at line 74 column 7
    get_forge_download at line 26 column 12
    pkg at line 382 column 29

相关信息

环境

  1. octave-4.2.0-w64 on Windows 7 Enterprise 64 bit Version 6.1.7601 Service Pack 1 Build 7601
  2. Windows 10 Pro 64 位版本 10.0.14393 Build 14393 上的 Octave 4.0.3

【问题讨论】:

    标签: https ssl-certificate octave libcurl urlread


    【解决方案1】:
    1. 您收到“无法验证对等证书”错误,因为您的 CA 存储不包含必要的 CA 证书。您可以获得更新的捆绑包from here
    2. 您尝试使用 curl 命令行工具不起作用的原因是您没有使用 -L, --location 选项来告诉 curl 遵循重定向,因此您只收到了 http://packages.octave.org/list_packages.php 返回的 303 响应。如果您使用 -L,您会看到它会将您重定向到 HTTPS:// URL 两次 - 只是让您不得不修复大小写 (1)。

    【讨论】:

    • 感谢您的回复。您能否提供更多详细信息,如何以及在何处更新 CURL 或 Octave 库使用的“CA 存储”? IE 或 Chrome 或 JRE 都有自己的存储库,所以我想 Octave 使用的库有自己的。
    • 由于我对 Octave 不熟悉,所以我不得不在这一点上含糊其辞。我非常了解 libcurl,既然使用了它,我可以谈谈这些细节。 libcurl 通常将“CA 包”作为文件(PEM 格式)加载。我想 Octave 文档应该阐明 CA 捆绑包的提供/更新位置/方式。
    • 谢谢丹尼尔,它给了寻找的方向。会调查的。
    • 仅供参考:Nick 在stackoverflow.com/questions/41687465 中提供了原因、修复版本和解决方法。
    猜你喜欢
    • 1970-01-01
    • 2017-03-16
    • 2017-11-26
    • 2020-06-27
    • 1970-01-01
    • 1970-01-01
    • 2021-06-21
    • 2013-01-12
    • 2013-01-18
    相关资源
    最近更新 更多