Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting 401.2 when certificate authentication is enabled

I'm setting up a server so that only mapped certificates can get to the webservice. It is set to require SSL/Client certificates, anonymous authentication, asp.net impersonation, forms authentication, and windows authentication are all disabled. One-to-one client certificate mapping is enabled, and certs are set up on the box with an appropriate user mapping. When I try to use the webservice, I get 401.2. If I enable anonymous authentication, it works, but I don't want any old cert to be able to access the website.

I have another machine that has anonymous authentication disabled in this configuration, and it works. I'm not sure what the difference is.

like image 690
Kyle W Avatar asked Feb 28 '12 18:02

Kyle W


People also ask

How do I add a certificate to a Web service?

Make an online request by using the IIS Web Server Certificate Wizard and install the certificate at the time of the request. Make an offline request by using the IIS Web Server Certificate Wizard and obtain and install the certificate later. Request a certificate without using the IIS Web Server Certificate Wizard.


2 Answers

I ran into the same problem, but the solution above did not solve my problem. I was configuring IIS Certificate Authentication on a subdirectory of the website, not on the website itself.

So, this is wrong:

Wrong usage

And this is correct:

Correct usage

Once I moved the configuration to the root of the website, everything worked perfectly.

I found the solution at http://blogs.msdn.com/b/saurabh_singh/archive/2009/06/13/avoid-this-confusion-around-client-certificate-mapping-in-iis-6-0-7-0.aspx.

like image 109
Robert Bernstein Avatar answered Sep 19 '22 11:09

Robert Bernstein


Did you issue your client certs from a Certificate Server that the clients/server trust? If you look at the "Enhanced Key Usage" property on the certificates, is "Client Authentication" one of it's properties? In IIS, is the client certificate mapping role installed (see image 1)? did you enable "Client Certificate Mapping" and map the users to the certificate? You need to import all of the client certificates and map them to user accounts here. You can remove all of the other client authentication methods when you have configured that here.

enter image description here

like image 41
Nathan Rice Avatar answered Sep 21 '22 11:09

Nathan Rice