5

问题

如何修复 Octave(假设 libcurl 与 octave 捆绑在一起)urlread 导致对等证书无法使用给定的 CA 证书进行身份验证的修复(不是解决方法) ?

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

问题

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

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

## 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. Windows 7 Enterprise 64 位版本 6.1.7601 Service Pack 1 Build 7601 上的 octave-4.2.0-w64
  2. Windows 10 Pro 64 位版本 10.0.14393 Build 14393 上的 Octave 4.0.3
4

1 回答 1

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