views:

308

answers:

5

Here's a possible scenario.

Let's say I have a website "https://www.mywebsite.com" and there is a valid SSL certificate purchased for this domain.

I want to "mimick" this website on my LOCAL machine for a testing purpose.

So let's say I set up a locally-configured "https://www.mywebsite.com" (which is in essence https://localhost/mywebsite or something similar).

Would I be able to re-use the SSL certificate on my local testing website?

+1  A: 

You can re-use your SSL certificate if you configure your DNS so that your test machine is the same domain name as server, which is probably a bad idea.

You can also re-use it on your test machine if you don't mind clicking the box "accept this whacked out ssl cert"... So I suppose that the answer is technically yes, although I wouldn't personally do it.

Bear
A: 

I am not sure since the SSL certificate is bound by the domain name that was registered with the certificate. But you may be able to dupe the certificate by editing your hosts file to change localhost 127.0.0.1 to be mysite.com 127.0.0.1, ...in theory at least...if not this is a question for serverfault.com.

Hope this helps, Best regards, Tom.

tommieb75
A: 

You can't use it since the SSL cert is tied to the domain www.mywebsite.com unless you do a bit of trickery.

You can put an entry in your hosts file saying that domain is at 127.0.0.1, but that's not ideal as you could no longer reach the website.

If you just need a valid cert to test with, then a better alternative is to self-sign using the IIS Resource Kit.

Nick Craver
A: 

It depends what you are trying to test and why you need a certificate for testing.

If you use the certificate, it will correctly encrypt connections using SSL, but any client will get a certificate mis-match error. If you use a self-signed certificate instead, most clients will give you a warning about that, so it might be just as annoying or not.

If you are testing, for instance, a deployment script to make sure everything gets installed in the right place, it will work. If you are testing to make sure your code correctly redirects a non-secure connection to a secure one, it will work.

If you want to test the your website for functionality, usability, bugs, etc. then your testers will likely complain about the certificate warnings or errors, and you're probably better off doing something else.

bmb
A: 

I'm no expert on DNS, but this would introduce a pretty major vulnerability.

Basically if this was allowed, DNS poisoning could be used defeat the whole purpose of third party trust.

Think about it:

I infect your computer so that when you go to www.amazon.com it resolves www.amazon.com to a different domain. That domain uses amazon's ssl cert to fool you into thinking it's legit, so you send me your credit card information.

So, the answer to your question is, no you can't do this. You will still get errors, My guess is that somewhere on the verfication chain, it compares the domain that initiated the request with what its internal dns resolves the domain, to verify there is a match.

As others have said, you can test SSL with a Self Signed Cert, you just have to instruct your testers to import the cert, or go through the trouble of building your own trusted CA, and have testers add that CA as a trusted CA.

There is no point in stealing another sites SSL Cert.

Of course you could use the vulnerability in MD5 to create your own valid SSL cert.

http://www.digicert.com/news/2009-01-05-md5-ssl.htm

Alan