Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make IIS require SSL client certificate during initial handshake

Tags:

I am trying to configure an IIS website to require SSL client certificates. The website is set up in both IIS 6 and 7, though I am more interested in making it work for 7. I set the require client certificates property in IIS and it works fine when accessing the site through a web browser, but a Java-based client is having trouble accessing it.

I believe the problem is that IIS does not request a client certificate during the initial SSL handshake. Instead it negotiates a normal SSL connection, checks to see if the resource requires client certificates, and if it does it then initiates a new SSL handshake that requests a client certificate. IIS does this so support sites that only require the client certificates for certain resources. Even when the requirement is specified for the entire website, IIS still initiates two SSL handshakes. I want to force IIS to request the client certificate on the first SSL handshake, which will hopefully get things working for the client. (The client is developed by an external partner and I have virtually no knowledge of how it is set up and no access to its source code)

Has anyone dealt with this problem in IIS before?

like image 210
nslowes Avatar asked Mar 25 '10 18:03

nslowes


People also ask

How do I configure IIS Express to accept SSL client certificates?

Enable SSL for your project: View the properties of the project (F4) -> SSL Enabled to True (notice the SSL URL property gets populated) Set your project to start in SSL mode: Go to Project Properties (Alt+Enter), select the Web tab and modify the Project Url to the one from step 3. E.g. https://localhost:44300.

How do you create an IIS website that requires client certificate using self signed certificates?

Go to Default Web Site → SSL Settings . Enable Require SSL , choose Require for Client certificate and then click Apply to save the settings.


1 Answers

Here's how I did this, on IIS 7.5:

  1. Run the following in an admin command prompt: netsh http show sslcert
  2. Save the output in a text file. Will look something like this:

    IP:port                 : 0.0.0.0:443 Certificate Hash        : [a hash value] Application ID          : {[a GUID]} Certificate Store Name  : MY Verify Client Certificate Revocation    : Enabled Verify Revocation Using Cached Client Certificate Only    : Disabled Usage Check    : Enabled Revocation Freshness Time : 0 URL Retrieval Timeout   : 0 Ctl Identifier          : (null) Ctl Store Name          : (null) DS Mapper Usage    : Disabled Negotiate Client Certificate    : Disabled 
  3. Create a batch file using that info:

    netsh http show sslcert netsh http delete sslcert ipport=0.0.0.0:443 netsh http add sslcert ipport=0.0.0.0:443 certhash=[your cert hash from above] appid={[your GUID from above]} certstorename=MY verifyclientcertrevocation=enable VerifyRevocationWithCachedClientCertOnly=disable UsageCheck=Enable clientcertnegotiation=enable netsh http show sslcert 

    (Yes, you have to delete and re-add; you can't just alter clientcertnegotiation in-place. That's why it's important to save the hash and GUID, so it knows what to re-add.)

  4. Run that batch file, check for any errors, done.

Keep in mind that this setting is applied per-certificate, not per-server. So if you use multiple certs, or change/update your cert, you will have to do this again.

like image 111
CrazyPyro Avatar answered Sep 22 '22 17:09

CrazyPyro