作者主签名的时间戳发现链构建问题:UntrustedRoot: self signed certificate in certificate chain
The author primary signature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain
在我的 .NET Core 项目上进行 docker 构建时,我的所有 NuGet 都出现以下错误:
80.19 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3028: Package 'Microsoft.EntityFrameworkCore 5.0.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain [/app/GradingTool.sln]
#12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3037: Package 'Microsoft.EntityFrameworkCore 5.0.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature validity period has expired. [/app/GradingTool.sln]
#12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3028: Package 'Microsoft.EntityFrameworkCore 5.0.0' from source 'https://api.nuget.org/v3/index.json': The repository countersignature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain [/app/GradingTool.sln]
我以前从来没有遇到过这个错误,
有人可以帮我找出问题所在吗?
Docker 文件:
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"]
我认为 nuget.org 的证书存在一些问题。我目前正在从 nuget.org
获取所有 NuGet 包的以下信息
error NU3037: Package 'Microsoft.NETCore.Platforms 3.1.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature validity period has expired.
error NU3028: Package 'Microsoft.AspNetCore.Metadata 3.1.2' from source 'https://api.nuget.org/v3/index.json': The repository countersignature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain
更新:查看此公告: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
缩短您的旅程
已知的解决方法包括:
- 降级到 .NET Core 3.1
- 如果使用 docker,请将基础映像从“FROM mcr.microsoft.com/dotnet/sdk:5.0”更改为“
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal" 或 "
来自 mcr.microsoft.com/dotnet/sdk:5.0-高山
- 将此放在 nuget.config 的标记内以完全禁用验证(适用于 dotnet restore):
<config> <add key="signatureValidationMode" value="accept" />
您也可以在这里查看状态:https://status.nuget.org/
在Dockerfile文件中,我从
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim
至
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine
这对我有用!
简答
替换mcr.microsoft.com/dotnet/sdk:latest
和mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim-amd64
一旦他们正式修补了证书问题,请返回:最新。
长答案
这是因为您正在使用的 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
是安全的
此更改也有效:
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal
最好从 Debian 转到 Ubuntu 并跳过 Alpine,因为 Alpine 缺少 .net 区域和文化!即 sdk:5.0-focal 是你最好的选择并且确实解决了这个问题。
如果您不想更改基本映像,另一种解决此问题的方法是安装 ca-certificates
软件包。
将此添加到您的 Dockerfile:
RUN echo "deb http://deb.debian.org/debian bullseye main" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i '$ d' /etc/apt/sources.list
当然,一旦解决了潜在的问题,就可以再次删除它。
我在 dotnet sdk 5.0.201 中遇到以下错误。
error NU3037: Package 'Microsoft.EntityFrameworkCore.Sqlite 5.0.0' from source 'https://api.nuget.org/v3/index.json': The repository countersignature validity period has expired.
在我将 sdk 更新到 5.0.401 并重建它之后它工作正常。
在我的 .NET Core 项目上进行 docker 构建时,我的所有 NuGet 都出现以下错误:
80.19 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3028: Package 'Microsoft.EntityFrameworkCore 5.0.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain [/app/GradingTool.sln]
#12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3037: Package 'Microsoft.EntityFrameworkCore 5.0.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature validity period has expired. [/app/GradingTool.sln]
#12 80.20 /app/GradingTool.Tests/GradingTool.Tests.csproj : error NU3028: Package 'Microsoft.EntityFrameworkCore 5.0.0' from source 'https://api.nuget.org/v3/index.json': The repository countersignature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain [/app/GradingTool.sln]
我以前从来没有遇到过这个错误, 有人可以帮我找出问题所在吗?
Docker 文件:
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"]
我认为 nuget.org 的证书存在一些问题。我目前正在从 nuget.org
获取所有 NuGet 包的以下信息error NU3037: Package 'Microsoft.NETCore.Platforms 3.1.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature validity period has expired.
error NU3028: Package 'Microsoft.AspNetCore.Metadata 3.1.2' from source 'https://api.nuget.org/v3/index.json': The repository countersignature's timestamp found a chain building issue: UntrustedRoot: self signed certificate in certificate chain
更新:查看此公告: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
缩短您的旅程
已知的解决方法包括:
- 降级到 .NET Core 3.1
- 如果使用 docker,请将基础映像从“FROM mcr.microsoft.com/dotnet/sdk:5.0”更改为“ FROM mcr.microsoft.com/dotnet/sdk:5.0-focal" 或 " 来自 mcr.microsoft.com/dotnet/sdk:5.0-高山
- 将此放在 nuget.config 的标记内以完全禁用验证(适用于 dotnet restore):
<config> <add key="signatureValidationMode" value="accept" />
您也可以在这里查看状态:https://status.nuget.org/
在Dockerfile文件中,我从
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim
至
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine
这对我有用!
简答
替换mcr.microsoft.com/dotnet/sdk:latest
和mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim-amd64
一旦他们正式修补了证书问题,请返回:最新。
长答案
这是因为您正在使用的 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
是安全的此更改也有效:
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal
最好从 Debian 转到 Ubuntu 并跳过 Alpine,因为 Alpine 缺少 .net 区域和文化!即 sdk:5.0-focal 是你最好的选择并且确实解决了这个问题。
如果您不想更改基本映像,另一种解决此问题的方法是安装 ca-certificates
软件包。
将此添加到您的 Dockerfile:
RUN echo "deb http://deb.debian.org/debian bullseye main" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i '$ d' /etc/apt/sources.list
当然,一旦解决了潜在的问题,就可以再次删除它。
我在 dotnet sdk 5.0.201 中遇到以下错误。
error NU3037: Package 'Microsoft.EntityFrameworkCore.Sqlite 5.0.0' from source 'https://api.nuget.org/v3/index.json': The repository countersignature validity period has expired.
在我将 sdk 更新到 5.0.401 并重建它之后它工作正常。