[osgeo4w-dev] [osgeo4w] #715: ssl.SSLError: A failure in the SSL library occurred (_ssl.c:1129)

OSGeo4W trac_osgeo4w at osgeo.org
Wed May 4 23:48:41 PDT 2022


#715: ssl.SSLError: A failure in the SSL library occurred (_ssl.c:1129)
------------------------+----------------------------
Reporter:  andreaerdna  |       Owner:  osgeo4w-dev@…
    Type:  defect       |      Status:  closed
Priority:  major        |   Component:  Package
 Version:               |  Resolution:  fixed
Keywords:               |
------------------------+----------------------------

Comment (by andreaerdna):

 Replying to [comment:5 jef]:
 > Grmpf, tried the patch without success.  `prgcloud.com` still fails.  On
 a closer look this is (meanwhile?) because its certificate is for
 `www.prgcloud.com`.  `www.prgcloud.com` and `www.python.org` work fine.

 >
 > Guess the fix for #696 cured this too.


 I cannot confirm the fixing of this bug.

 With both the OSGeo4W v2 shell and the Python console of QGIS 3.22.6 and
 3.24.2, the test.py Python scripts returns:

 {{{
 C:\OSGeo4W_V2>python3 test.py
 ssl prgcloud.com: FAIL A failure in the SSL library occurred (_ssl.c:1129)
 urllib prgcloud.com: FAIL <urlopen error A failure in the SSL library
 occurred (_ssl.c:1129)>
 ssl www.prgcloud.com: FAIL A failure in the SSL library occurred
 (_ssl.c:1129)
 urllib www.prgcloud.com: FAIL <urlopen error A failure in the SSL library
 occurred (_ssl.c:1129)>
 ssl www.python.org: OK
 urllib www.python.org: OK
 }}}

 With the Python console of QGIS 3.22.6 and 3.24.2, the following script:

 {{{
 import ssl
 import socket
 socketHandler = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 socketWraped = ssl.create_default_context().wrap_socket(socketHandler,
 server_hostname='www.prgcloud.com')
 socketWraped.connect(('www.prgcloud.com', 443))
 }}}

 returns:

 {{{
 Traceback (most recent call last):
   File "C:\OSC726~1\apps\Python39\lib\code.py", line 90, in runcode
     exec(code, self.locals)
   File "<input>", line 1, in <module>
   File "C:\OSC726~1\apps\Python39\lib\ssl.py", line 1342, in connect
     self._real_connect(addr, False)
   File "C:\OSC726~1\apps\Python39\lib\ssl.py", line 1333, in _real_connect
     self.do_handshake()
   File "C:\OSC726~1\apps\Python39\lib\ssl.py", line 1309, in do_handshake
     self._sslobj.do_handshake()
 ssl.SSLError: A failure in the SSL library occurred (_ssl.c:1129)
 }}}


 With the OSGeo4W v1 shell and the Python console of QGIS 3.16.16 (OSGeo4W
 v1), the test.py Python script returns:

 {{{
 C:\Program Files\QGIS 3.16.16v1>python3 test.py
 ssl prgcloud.com: FAIL [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
 failed: Hostname mismatch, certificate is not valid for 'prgcloud.com'.
 (_ssl.c:1045)
 urllib prgcloud.com: FAIL <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
 certificate verify failed: Hostname mismatch, certificate is not valid for
 'prgcloud.com'. (_ssl.c:1045)>
 ssl www.prgcloud.com: OK
 urllib www.prgcloud.com: OK
 ssl www.python.org: OK
 urllib www.python.org: OK
 }}}

 With the Python console of QGIS 3.16.16 (OSGeo4W v1), the following
 script:

 {{{
 import ssl
 import socket
 socketHandler = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 socketWraped = ssl.create_default_context().wrap_socket(socketHandler,
 server_hostname='www.prgcloud.com')
 socketWraped.connect(('www.prgcloud.com', 443))
 }}}

 returns no error.

-- 
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/715#comment:7>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.


More information about the osgeo4w-dev mailing list