热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

作者主签名的时间戳发现了一个建链问题:UntrustedRoot:证书链中的自签名证书

在我的.NETCore项目上执行dockerbuild时,我在所有NuGet上都收到以下错误:80.19/app/GradingTo

在我的 .NET Core 项目上执行 docker build 时,我在所有 NuGet 上都收到以下错误:

80.19 /app/GradingTool.Tests/GradingTool.Tests.csproj:错误 NU3028:来自源“https://api.nuget.org/v3/index.json”的包“Microsoft.EntityFrameworkCore 5.0.0”:作者主要签名时间戳发现链构建问题:UntrustedRoot:证书链中的自签名证书[/app/GradingTool.sln]

#12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj:错误 NU3037:来自“https://api.nuget.org/v3/index.json”的包“Microsoft.EntityFrameworkCore 5.0.0”:作者主签名有效期已过。[/app/GradingTool.sln]

#12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj:错误 NU3028:来自源“https://api.nuget.org/v3/index.json”的包“Microsoft.EntityFrameworkCore 5.0.0”:存储库会签的时间戳发现链构建问题:UntrustedRoot:证书链中的自签名证书 [/app/GradingTool.sln]

我以前从未遇到过这个错误,有人可以帮我找出问题所在吗?

Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:latest AS build-env
WORKDIR /app
RUN apt-get update -yq
&& apt-get install curl gnupg -yq
&& curl -sL https://deb.nodesource.com/setup_10.x | bash
&& apt-get install nodejs -yq
# Copy csproj and restore as distinct layers
COPY . ./
RUN dotnet restore
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:latest
RUN apt-get update
&& apt-get install -y --no-install-recommends libgdiplus libc6-dev
&& apt-get clean
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build-env /app/out .
ENV ASPNETCORE_URLS="http://+:4200"
ENV ASPNETCORE_ENVIROnMENT="Production"
ENV GOOGLE_APPLICATION_CREDENTIALS="Credentials/SchoolTools-e9f260bdf56e.json"
ENV VIRTUAL_HOST="eva.schooltools.lu,www.eva.schooltools.lu,schooltools.lu,www.schooltools.lu"
ENV LETSENCRYPT_HOST="eva.schooltools.lu,www.eva.schooltools.lu,schooltools.lu,www.schooltools.lu"
ENV LETSENCRYPT_EMAIL="wilson.silva@edutec.lu"
EXPOSE 4200
ENTRYPOINT ["dotnet", "GradingTool.dll"]

回答


更新:查看此公告:https : //github.com/NuGet/Announcements/issues/49

目前该问题似乎与 Debian 映像有关。

切换到基于 Ubuntu 或 Alpine 的映像:

FROM mcr.microsoft.com/dotnet/sdk:5.0-focal AS build-env

按照https://github.com/NuGet/Home/issues/10491获取更新。





回答


在Dockerfile文件中,我从

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim

FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine

这对我有用!



  • It's worth highlighting that this moves from a Debian based to Alpine based docker-image so there may be slight differences in the base packages etc so this may get rid of the immediate error but could introduce harder to track down issues in the long run.




回答


简答

代替 mcr.microsoft.com/dotnet/sdk:latest

mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim-amd64

一旦他们正式修补了证书问题,请返回 :latest。

长答案

这是因为您使用的 Debian docker 映像中存在问题:

mcr.microsoft.com/dotnet/sdk:latest

:latest 标签使用的是 Debian 映像 (5.0.102-1-buster-slim-amd64),Debian 发布了一个会产生证书问题的补丁。

NuGet 团队发布了新的预发布 Debian 映像,以缓解 ca 证书问题。在此处查看未解决的问题和图像替换解决方法:

https://github.com/NuGet/Announcements/issues/49#issuecomment-768766265

稍后他们将发布 SDK 映像的发布版本(一旦 Debian ca-certificates 包在 Debian 10 Buster 中发布)。

使用 :focal 标签 (Ubuntu) 也可以解决 .NET 应用程序的问题,但您必须考虑不再使用 Debian。

最新更新:

微软使用传统标签(如 sdk:5.0)发布了修补的 docker 镜像。从 :5.0.102-ca-patch-buster-slim-amd64 恢复到 :5.0 是安全的





回答


我认为 nuget.org 的证书存在一些问题。我目前正在从 nuget.org 获取所有 NuGet 包的以下内容

错误 NU3037:来自源“https://api.nuget.org/v3/index.json”的包“Microsoft.NETCore.Platforms 3.1.0”:作者主要签名有效期已过期。

错误 NU3028:来自源“https://api.nuget.org/v3/index.json”的包“Microsoft.AspNetCore.Metadata 3.1.2”:存储库会签的时间戳发现链构建问题:UntrustedRoot:自签名证书证书链




  • Yes, In their GitHub Repo under Issues there are many people having the same issue as us so hopefully they will fix it soon enough! Thanks for your response though!




回答


如前所述,可以在此处跟踪问题的当前更新:

https : //github.com/NuGet/Home/issues/10491

缩短您的旅程

已知的解决方法包括:


  • 降级到 .NET Core 3.1

  • 如果使用 docker,请将基本映像从“FROM mcr.microsoft.com/dotnet/sdk:5.0”更改为“FROM mcr.microsoft.com/dotnet/sdk:5.0-focal”或“FROM mcr.microsoft.com/dotnet” /sdk:5.0-高山"

  • 将其放在 nuget.config 的标记内以完全禁用验证(适用于 dotnet restore):


您还可以在此处查看状态:https : //status.nuget.org/





回答


此更改也有效:

FROM mcr.microsoft.com/dotnet/sdk:5.0-focal





回答


最好从 Debian 转到 Ubuntu 并跳过 Alpine,因为 Alpine 缺少 .net 区域和文化!即 sdk:5.0-focal 是您最好的选择,并且确实解决了这个问题。






推荐阅读
author-avatar
jizi456
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有