IIS6: Web Site presenting the wrong SSL certificate

64

Solution 1

SSL certificates are bound to the internal IP address of the web server, not the external IP addresses.

Let's say you have foo.example.com bound to Public IP A and bar.example.com on Public IP B, but your web server only has the IP address 192.168.0.1

Whether the request comes in on IP A or IP B, it is still going to end up at 192.168.0.1. Which means that IIS has no choice but to use the certificate that is assigned to foo.example.com.

To work around this issue, you will need to have multiple IP addresses assigned to your web server. This is easy to do. Speak to your sysadmin to have some IP's removed from the DHCP range (or ask him/her which ones you can use), then go to your properties for the network card (Control Panel > Network Connections), and go to the properties for TCP/IP.

You will need to have a static IP enabled in the first place (being a server I hope this is done anyway), and then click Advanced, and under the box for "IP addresses" click "Add" - and enter the new IP addresses you've been assigned by your sysadmin (Let's say 192.168.0.2).

Then, at your router, you need to ensure that requests from IP A on port 443 go to 192.168.0.1 and that all other requests on port 443 go to 192.168.0.2.

Then, in your IIS configuration, you need to bind the SSL Cert from foo.example.com to 192.168.0.1, and bind the rest to 192.168.0.2 (or leave as All Unassigned, as you have).

If this doesn't work, or you already have this configured, update your question and leave a comment to let us know.

Update: I just saw your comments, thanks for the update. You will need to ensure foo.example.com and bar.example.com are on two different public IP addresses. The reason being that because the packets are encrypted, there's no way you can use hostname based routing to send the request to the right IP address (I believe this is the case. If anyone knows different, let me know). The only part of the request that's visible to the routers is the destination IP. This is why you can only have one SSL per IP address. So you will need to have public IP's for this to work, and in your DNS an A record for bar.example.com that is different to foo.example.com.

Solution 2

In support of Farseeker, from Thawte:

Although the certificate is not tied to the IP address a unique IP address must be assigned to the domain as SSL is IP based and does not resolve to name based virtual hosts

If your server has only 1 IP address, the "All unassigned" can do nothing but point to that same, single IP address.

Solution 3

It sounds like "bar" is going to the same IP address as "foo" is using. Since "foo" is specifically configured to answer on that IP address, it grabs the request. The "host headers" don't apply for SSL requests (that's why IIS has a separate panel for standard requests with the ip/host/port mapping and another for ssl ip/port mapping, but no hostname).

Check your DNS records and ensure that "bar" is using a different IP from "foo" and your problem should be corrected.

When I configure SSL sites I give each domain that needs SSL its own IP address, and use a "common" IP for everything else. The DNS records, of course, need to use the correct address so that the correct site entry in IIS will handle the traffic.

Share:
64

Related videos on Youtube

Yaron Buki
Author by

Yaron Buki

Updated on September 17, 2022

Comments

  • Yaron Buki
    Yaron Buki almost 2 years

    I have a program that I would like to sell to small companies. I would like for the user to type in their company name during install, so I can use the name in the menu title or for any other general uses where the company name should appear! Where is the best place to store their info, app.config or the database? How would I go about getting the information from the user during install?

    Thank you in advance

    • Admin
      Admin almost 15 years
      If you ignore the certificate error, do you get the correct content from bar.example.com, or do you get content from foo.example.com?
  • Yaron Buki
    Yaron Buki about 13 years
    Is there a tutorial explaining how one would do that?
  • PVitt
    PVitt about 13 years
  • PVitt
    PVitt about 13 years
    As I already mentioned; I would use a machine setting located in the app.config
  • Yaron Buki
    Yaron Buki about 13 years
    My customActionData's property is /Message="[MESSAGE]". How to I use that in my program?
  • PVitt
    PVitt about 13 years
    You have to implement the installer component as well.
  • Yaron Buki
    Yaron Buki about 13 years
    Thanks for the direction. Here is a tutorial that I was looking for. Raquila.com/software/configure-app-config-application-settin‌​gs-during-msi-instal‌​l/
  • Jacques
    Jacques almost 11 years
    Mark, we have only one of the two websites that requires ssl, say htts://bar.example.com, but when we type in foo.example.com it comes up with the cert error and if you ignore and continue it goes to bar.example.com.
  • Jacques
    Jacques almost 11 years
    Mark, we have only one of the two websites that requires ssl, say "bar.example.com", but when we type in foo.example.com it comes up with the cert error and if you ignore and continue it goes to bar.example.com. The cert is specific "bar.example.com" and we don't want any SQL on foo.example.com. Looking at the iis properties for foo.example.com the button for view certificate is disabled, so I don't think there is any certificate configured for it. How can we stop people from attempting to browse to foo.example.com