1

SSL을 통한 IIS Express (.NET 3.5) 및 Windows 사용자에 매핑 된 클라이언트 인증서를 사용하여 wcf 서비스를 호스팅하려고합니다.IIS Express에서 WCF 서비스 호출 : 무단으로

나는 다음과 같은 오류가 나타납니다 TestClient을 같은 콘솔 응용 프로그램을 사용하는 경우 :

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM,Negotiate'.

나는 내가 IIS 익스프레스 tracelogging을 확인할 때 나는 clientcertificate가 매핑되는보기 때문에이 가능 이해가 안 돼요을 httpmodule을 내 창 사용자에게 알리는 데 도움이됩니다. 그것은 401

내가 SVC는 클라이언트와 서버 쪽하지만 유일한 것은 모두에서 추적 활성화에 대한 응답을 설정 이름 "ServiceModel은 서비스"와 HttpModule을 것입니다 스크린 샷에서 보는 바와 같이

Extract from IIS tracelogging

: 서버 측에 기록 된이

내 IIS 익스프레스 (applicationHost.config 파일)의 Web.config에서 재정의되는 '연결'https://myurl/orderservice.svc/ClientCert '에 바이트를 수신 "입니다

<system.webServer> <security> <authentication> <windowsAuthentication enabled="true" /> <anonymousAuthentication enabled="false" /> <iisClientCertificateMappingAuthentication enabled="true" oneToOneCertificateMappingsEnabled="true" > <oneToOneMappings> <add enabled="true" certificate="MIICGjCCAYegAwIBAgIQfi996nkvEYdO6WBFfokO/jAJBgUrDgMCHQUAMCUxIzAhBgNVBAMTGkdsb2JhbFZpc2lvblNlcnZpY2VzUm9vdENBMB4XDTEyMDkwNzEyMjg1OVoXDTM5MTIzMTIzNTk1OVowHjEcMBoGA1UEAxMTR2xvYmFsVmlzaW9uQ2xpZW50MTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA5qBoLtQjkN2LtWdCQVbWqMA5N4jMmDM3yscUi3c7mwO9iFZaOcf41+SUFMivEXOOVI/5qVdaMII/ombGPopKoZhtXYUkv90psWwQHXNfqE1L+Vkur/u2KiQSImXLhSPF8qTR5RbRj3inpTWTg74p1a1HjbndU/lwu1cznl5vW/sCAwEAAaNaMFgwVgYDVR0BBE8wTYAQjpcP+m/6Y3T5yi7PJKxrGqEnMCUxIzAhBgNVBAMTGkdsb2JhbFZpc2lvblNlcnZpY2VzUm9vdENBghB+Uxyrj6x2rEV3HQ6vVX48MAkGBSsOAwIdBQADgYEAT5CiQCj4y9dW+zBSq96dRye3FJswAYiZgMLLoiyRV5h2QT7H0nxcdQ0mtdcN3OPunuvrYYlS58QVlBx6aozznmKeBuRl6GwWwQLYGxBRsKbQTuEiI85v1n/jK0LTT6FSGBMUlcJSn2NgnUAWgXvlf8f0SqLqApwWPeYybQxfz4U=" userName="CORP\mywindowsuser" password="mypassword" /> </oneToOneMappings> </iisClientCertificateMappingAuthentication> </authentication> <authorization> <add users="*" accessType="Allow"/> </authorization> <!--Require SSL *AND* require a client certificate --> <access sslFlags="Ssl, SslNegotiateCert"/> </security> </system.webServer> 

이 구성을 사용하면 브라우저에서 svc 파일 (https://myurl/orderservice.svc?wsdl)로 이동할 때 클라이언트 인증서를 요청하고 자체 서명 된 인증서를 선택할 때 서비스의 wsdl을 볼 수 있습니다. 나에게 이것은 인증서 (rootca, 서버 및 클라이언트 인증서)가 정확하고 SSL이 작동 함을 의미합니다. 완성

이 내 서비스 구성 서버 쪽 :

<system.serviceModel> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"> 
    <baseAddressPrefixFilters> 
    <add prefix="https://myurl:443"/> 
    </baseAddressPrefixFilters> 
</serviceHostingEnvironment> 
<diagnostics wmiProviderEnabled="true"> 
    <messageLogging 
     logEntireMessage="true" 
     logMalformedMessages="true" 
     logMessagesAtServiceLevel="true" 
     logMessagesAtTransportLevel="true" 
     maxMessagesToLog="3000" 
    /> 
</diagnostics> 
<bindings> 
    <wsHttpBinding> 
    <binding name="ClientCert"> 
     <security mode="Transport"> 
     <message clientCredentialType="Certificate"/> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="wsHttpCertificateBehavior"> 
     <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/> 
     <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/> 
     <serviceAuthorization serviceAuthorizationManagerType="CompanyName.Model.Security.AuthorizationBehaviors.AdamAuthorizationManager,ServiceSecurity"> 
     <authorizationPolicies> 
      <add policyType="CompanyName.Model.Security.AuthorizationPolicies.AdamAuthorizationPolicy, ServiceSecurity" /> 
     </authorizationPolicies> 
     </serviceAuthorization> 
     <serviceCredentials> 
     <serviceCertificate findValue="certificatesubject" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/> 
     <clientCertificate> 
      <authentication revocationMode="NoCheck" mapClientCertificateToWindowsAccount="true" /> 
     </clientCertificate> 
     </serviceCredentials> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<services> 
    <service name="CompanyName.Model.Services.OrderService" behaviorConfiguration="wsHttpCertificateBehavior"> 
    <endpoint address="https://myurl/OrderService.svc/ClientCert" contract="CompanyName.Model.Services.ServiceContracts.IOrderService" binding="wsHttpBinding" bindingConfiguration="ClientCert"> 
    </endpoint> 
    </service> 
</services> 

서비스 구성 클라이언트 측

나는 다음 내가 얻을 서비스로 이동하는 경우
<system.serviceModel> 
    <diagnostics> 
     <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxSizeOfMessageToLog="26214400" /> 
    </diagnostics> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="ClientCertificate"> 
      <security mode="Transport"> 
      <transport clientCredentialType="Certificate"/> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="wsHttpCertificateBehavior"> 
      <clientCredentials> 
      <clientCertificate findValue="39820c4f767c809bb8f64b0f52ccfd686093896c" storeLocation="CurrentUser" storeName="My" x509FindType="FindByThumbprint"/> 
      <serviceCertificate> 
       <authentication revocationMode="NoCheck"/> 
      </serviceCertificate> 
      </clientCredentials> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    <client> 
     <endpoint name="ClientCertificate" address="https://myurl/OrderService.svc/ClientCert" contract="CompanyName.Model.Services.ServiceContracts.OrderService" binding="wsHttpBinding" bindingConfiguration="ClientCertificate" behaviorConfiguration="wsHttpCertificateBehavior"/> 
    </client> 
    </system.serviceModel> 

:

내가 브라우저에서 엔드 포인트에 액세스하려고하면

Browser response

그것이 (정상) 400 잘못된 요청

를 말한다 : 내가 올바른 인증서를 선택하면 0

Choose certificate

나는이를 얻을 수

누군가가 잘못된 구성을 찾거나 iis express에서 호스팅되는 wcf를 사용하여 ssl 및 clientcertificatemapping에 대한 경험이 있으면 알려주는데 이미 몇 시간을 소비하고 있습니다. 있는 wsHttpBinding은 클라이언트 및 서버에 있지만 ClientCredentialType을 config에게 서버 측 보안 전송하는 설정

는 메시지 보안이 아닌 전송을 위해 구성된다 : 2 CONFIGS 사이에 불일치가 존재

답변

3

.

<access sslFlags="Ssl, SslNegotiateCert, SslRequireCert"/> 

난이 도움이되기를 바랍니다)

:

서비스는 인증서를 사용하는 데 필요한

, 이것은 SslFlags가의 system.webServer 섹션에서 속성을 다음과 같이 설정 될 수 있음을 의미