【问题标题】:Mutual SSL security mode binding configurations相互 SSL 安全模式绑定配置
【发布时间】:2020-01-03 09:00:24
【问题描述】:

关于双向 ssl 的安全模式,我有两个问题。

我浏览了一些网站,例如:

1.https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/transport-security-with-certificate-authentication%20

2.https://www.codeproject.com/Articles/348595/Use-Mutual-SSL-Authentication-in-WCF

在所有绑定配置中。我意识到所有安全模式都设置为'Transport'

<bindings>  
      <wsHttpBinding>  
        <!-- configure wsHttp binding with Transport security mode and clientCredentialType as Certificate -->  
        <binding>  
          <security mode="Transport">  
            <transport clientCredentialType="Certificate"/>              
          </security>  
        </binding>  
      </wsHttpBinding>  
 </bindings> 

对此,我想知道是否可以使用其他类型的安全模式,例如 '消息''TransportWithMessageCredential'。如果有,为什么?

此外,如果可能的话,客户端是否必须将其安全模式更改为与服务器端相同?

【问题讨论】:

    标签: wcf wcf-binding wcf-security mutual-authentication


    【解决方案1】:

    微软官方文档还提供了一个使用相互证书的消息安全模式对客户端进行身份验证的示例。
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/message-security-with-mutual-certificates
    我们需要做的是在服务器端配置一个服务证书,在客户端一个证书,同时建立客户端和服务器端的证书信任关系。
    这是标准配置。

      <system.serviceModel>  
        <behaviors>  
          <serviceBehaviors>  
            <behavior name="serviceCredentialBehavior">  
              <serviceCredentials>  
                <serviceCertificate findValue="Contoso.com"   
                                    storeLocation="LocalMachine"  
                                    storeName="My"   
                                    x509FindType="FindBySubjectName" />  
              </serviceCredentials>  
            </behavior>  
          </serviceBehaviors>  
        </behaviors>  
        <services>  
          <service behaviorConfiguration="serviceCredentialBehavior"   
                   name="ServiceModel.Calculator">  
            <endpoint address="http://localhost/Calculator"   
                      binding="wsHttpBinding"  
                      bindingConfiguration="InteropCertificateBinding"  
                      name="WSHttpBinding_ICalculator"  
                      contract="ServiceModel.ICalculator" />  
          </service>  
        </services>  
        <bindings>  
          <wsHttpBinding>  
            <binding name="InteropCertificateBinding">  
              <security mode="Message">  
                <message clientCredentialType="Certificate"  
                         negotiateServiceCredential="false"  
                         establishSecurityContext="false" />  
              </security>  
            </binding>  
          </wsHttpBinding>  
        </bindings>  
      </system.serviceModel>
    

    这也适用于TransportWithMessageCredential 安全模式。只要安全模式是Transport安全模式,我们就需要给特定的端口绑定一个证书。
    此外,客户端和服务器端之间的绑定配置应该是一致的。就像服务合同在客户端和服务器端之间共享一样。
    如果有什么可以帮助的,请随时告诉我。

    【讨论】:

      猜你喜欢
      • 2011-06-09
      • 2021-11-09
      • 2017-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多