Access https sites with IP address

I wonder why I get a certificate error if I try to access a site with an IP address instead of a domain name. Let's say, for example, that it nslookupsays google.com- 173.194.43.96, so I tried to look at https://173.194.43.96 and received a certificate error that the security certificate provided by this website was issued for a different website address. Why is this so?

+6
source share
4 answers

This is because an SSL certificate is issued for a specific domain name. If the certificate name does not match the visited domain, the browser will display an error.

SSL - , , , , . .

, IP- , DNS -, , . IP-, , DNS. , - .

SSL IP- - Google , 173.194.43.96 , , google ip-, SNI . , , ...

SSL, :

https://timnash.co.uk/guessing-ssl-questions/

+6

, , www.google.com, IP-. , , www.google.com .

.: www.digicert.com/ssl-support/certificate-name-mismatch-error.htm

+1

Host + Domain Name www.yoursite.com yoursite.com. SSL- , . , . , SSL- domain.com www.domain.com secure.domain.com, www.domain.com secure.domain.com domain.com.

0

MAC High Sierra Python 3.6.4 : : HostHeaderSSLAdapter 1st, , , iphtpsadapter, - .

readme , .

1. pip install requests[security] forcediphttpsadapter

2. :

import requests
from forcediphttpsadapter.adapters import ForcedIPHTTPSAdapter
session = requests.Session()
session.mount("https://example.com", ForcedIPHTTPSAdapter(dest_ip='1.2.3.4'))
response = session.get(
    '/some/path', headers={'Host': 'example.com'}, verify=False)

. "www" URL.

0

Source: https://habr.com/ru/post/1613679/


All Articles