【问题标题】:WCF server certificate validation on LANLAN 上的 WCF 服务器证书验证
【发布时间】:2020-02-24 13:55:07
【问题描述】:

我的服务和我的客户端位于两个不同的 LAN 网络。 服务拥有自己的签名证书,用于建立 TCP TLS 连接。 客户端不直接信任此证书,但信任它的根证书。最佳情况下,客户端不必安装任何额外的证书。

服务器不关心客户端身份,但客户端应该关心。 客户端如何验证它是否连接到预期的服务器?

      <endpoint address="net.tcp://10.64.62.1:23269/CalculatorService"
                binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_ICalculatorService"
                contract="CalculatorService.ICalculatorService"
                name="clientEndpointBehavior"
                behaviorConfiguration="clientEndpointBehavior"
                >        
        <identity>
          <dns value="" />
        </identity>
      </endpoint>

&lt;identity&gt; 中唯一不将身份锁定到单个证书或需要 Windows ClientCredentialType 的设置是 &lt;dns&gt;。 但在这种情况下,我无法弄清楚 &lt;dns&gt; 的值应该是多少,这如何防止也由以受信任的根 CA 开头的链签名的假证书?

【问题讨论】:

    标签: .net wcf service x509certificate tls1.2


    【解决方案1】:

    你是对的,身份部分用于在连接特定服务器时识别服务器。它应该是下面的形式。

       <endpoint address="net.tcp://10.157.13.69:21011/" binding="netTcpBinding"
            bindingConfiguration="NetTcpBinding_IService" contract="ServiceReference1.IService"
            name="NetTcpBinding_IService">
            <identity>
              <userPrincipalName value="VABQIA969VM\Administrator" />
            </identity>
          </endpoint>
    

    请查看以下官方说明。
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/service-identity-and-authentication
    如何保证证书通信的安全,请参考以下文档。
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/working-with-certificates

    【讨论】:

    • 您好 Abraham,userPrincipalName 需要 Windows 客户端凭据类型,因为客户端和服务位于不同的网络中,因此不适合 Windows。我也通读了这两个链接,但没有为这种情况提供建议
    猜你喜欢
    • 2013-12-24
    • 1970-01-01
    • 2010-12-06
    • 2014-05-11
    • 2012-08-06
    • 2015-05-13
    • 1970-01-01
    • 2012-05-08
    • 2021-11-11
    相关资源
    最近更新 更多