【问题标题】:dotnet nuget ssl problem on linux azure devopslinux azure devops上的dotnet nuget ssl问题
【发布时间】:2020-05-18 12:28:58
【问题描述】:

我试图在 ubuntu 18.04 上构建 dotnet 项目。我有一些 nuget 数据包存储在本地 Azure Devops 服务器存储库中。我配置了 https 和自签名证书。我通过

添加了源

dotnet nuget add source https://myurl/nuget/v3/index.json --name Int1 --username myuser --password mypasswd --store-password-in-clear-text --configfile nuget.config

当我尝试执行还原时,出现以下错误:

/usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : Unable to load the service index for source https://myurl/nuget/v3/index.json. [/home/Frontend/myproject.sln] /usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : The SSL connection could not be established, see inner exception. [/home/Frontend/myproject.sln] /usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5): error : The remote certificate is invalid according to the validation procedure. [/home/Frontend/myproject.sln]

我将https://myurl/ 放入浏览器,下载.pem 证书,放入/usr/share/ca-certificates/ 并制作dkpg-reconfigure ca-certificates,但仍然报错。

Curl 也不行。

curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.

在 Windows 上,如果我将我的证书作为 root 信任,一切正常。有什么方法可以在 linux 上做同样的事情吗?

【问题讨论】:

  • 嗨,您有机会尝试以下解决方案吗?进展如何?

标签: .net ubuntu azure-devops nuget restore


【解决方案1】:

要在 Ubuntu 上安装 .pem 证书,您可能需要先将 .pem 证书转换为 .crt 证书。

您可以使用以下命令将 .pem 证书转换为 .crt 证书。

openssl x509 -outform der -in CERTIFICATE.pem -out CERTIFICATE.crt

然后将.crt复制到合适的位置:

sudo cp CERTIFICATE.crt /usr/local/share/ca-certificate

然后使用以下命令更新您的证书:

sudo update-ca-certificates

您可以查看this thread 了解更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-04
    • 2020-02-19
    • 2021-11-19
    • 1970-01-01
    • 1970-01-01
    • 2021-06-04
    相关资源
    最近更新 更多