ssl - 让 Nuget 使用 SSL 将客户端证书传递到私有(private) ProGet 服务器

标签 ssl nuget ssl-certificate nuget-server

我有一个当前使用 SSL 的 ProGet 服务器,并且需要客户端证书才能与其通信。我们希望能够直接从命令行或在 Visual Studio 包管理器中使用此服务器。

当通过浏览器访问时,查看存储库没有问题。在命令行上使用 nuget.exe 时,结果为 403 Forbidden。我使用 Fiddler 来监视请求,它突出显示服务器正在请求客户端证书,Fiddler 允许您注入(inject)所需的证书,然后 nuget 请求成功。

是否可以在使用 NuGet 时提供客户端证书:

nuget install PackageName -Source https://myhost -Cert ???

或者对于这样的设置,我们将不得不退回到使用 API key 来获得访问权限?

我们可以在使用 Visual Studio 时提供证书吗?

最佳答案

从 NuGet 5.7.2 开始,您可以使用 client-cert feature .

配置示例:

<configuration>
    ...
    <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <add key="Contoso" value="https://contoso.com/packages/" />
        <add key="Example" value="https://example.com/bar/packages/" />
    </packageSources>
    ...
    <clientCertificates>    
        <storeCert packageSource="Contoso"
                   storeLocation="currentUser"
                   storeName="my"
                   findBy="thumbprint" 
                   findValue="4894671ae5aa84840cc1079e89e82d426bc24ec6" />
        <fileCert packageSource="Example"
                  path=".\certificate.pfx" 
                  password="..." />
        <fileCert packageSource="Bar"
                  path=".\certificate.pfx" 
                  clearTextPassword="..." />
    </clientCertificates>
...
</configuration>

您也可以使用 nuget client-certs CLI 命令进行配置。

关于ssl - 让 Nuget 使用 SSL 将客户端证书传递到私有(private) ProGet 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42096554/

相关文章:

php - 如何在 symfony 的开发和生产版本中禁用 HTTPS 或更改为 HTTP?

php - Apache - 仅允许具有某些 SSL 证书的客户端访问 (POST) 某些端点

facebook - 需要帮助了解我何时需要 SSL 证书

android - 推特连接失败

.net - 如果我将 .NET 工件打包为 nupkgs,如何使用 Nolio 部署它们?

Azure:无法安装正确推送到工件源存储库的 PowerShell 模块

c# - 在 nuget 包中包含引用的项目 DLL [.Net Core RC3 *.csproj 文件]

php - 无法从本地机器与 cURL/PHP 建立 SSL 连接,从网络服务器工作

android - 可以与 Android 应用共享我的服务器证书吗?

ssl - 集群节点之间 OrientDB 2.2 TLS 加密二进制连接出错