Can I test ssl connection locally with a valid certificate (CA) with local dns?

All we need is an easy explanation of the problem, so here it is.

I have a wildcard valid certificate signed by Certificate Authority. Is it possible to test the https locally from the server without a registered DNS?

My idea is to bind the domain name with 127.0.0.1 in /etc/hosts.

The HTML is running on Nginx container and I am using centos 7.

Is it possible to make an SSL handshake with curl https://<dnsname>.<name>.com:443 or it needs to be public DNS?

Note: ICMP is disabled but the server is connected to internet

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

For validating the certificate it is relevant that the domain in the URL matches the certificate. The certificate itself can be provided from any IP address, i.e. it does not have to be the public visible IP address but can also be a local one like 127.0.0.1. The mapping of domain to IP address is usually done by DNS but can also be done with a local hosts file, i.e. /etc/hosts in Linux.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply