I am trying to ascertain whether Python's request module conforms to RFC 6125 or not.
I created a Root CA Certificate and added it to my Linux's Trust Store. I then created a Server certificate and signed it with my Root CA Certificate and put the common name as "*.com". Then I started a server using OpenSSL's s_server using the Server Certificate.
Now as per RFC 6125 and this question, my python client should not establish a TLS connection if i try to connect with "foo.com". However, the Python client does not fail here and establishes a connection. I am executing this command in the terminal:
python -c "import requests; print(requests.get('https://foo.com', verify='/etc/ssl/certs/ca-certificates.crt'));"
But, if i try to connect with "bar.foo.com", i get the expected error:
requests.exceptions.SSLError: HTTPSConnectionPool(host='bar.foo.com', port=443): Max retries exceeded with url: / (Caused by SSLError(CertificateError("hostname 'bar.foo.com' doesn't match '*.com'",),))
In my opinion, this is a very trivial thing that should not happen.
So is there something wrong in my approach or does the Requests Module actually not fail in this scenario?
Looking forward to your help guys!
Thanks!