hubsif/kodi-magentasport

Certificate verification fails for playing live game

Closed this issue · 1 comments

When trying to play any live stream or recording, the playback doesn't start and the following error is thrown:


2021-01-24 17:49:43.356 T:1757855968   ERROR: /home/osmc/.kodi/addons/plugin.video.magentasport/default.py:222: SyntaxWarning: name 'args' is used prior to global declaration
                                              global args
2021-01-24 17:50:02.274 T:1766248672   ERROR: Previous line repeats 2 times.
2021-01-24 17:50:02.274 T:1766248672   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IOError'>
                                            Error Contents: [Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)
                                            Traceback (most recent call last):
                                              File "/home/osmc/.kodi/addons/plugin.video.magentasport/default.py", line 313, in <module>
                                                locals()['get' + mode]()
                                              File "/home/osmc/.kodi/addons/plugin.video.magentasport/default.py", line 224, in getevent
                                                getvideo()
                                              File "/home/osmc/.kodi/addons/plugin.video.magentasport/default.py", line 279, in getvideo
                                                response = urllib.urlopen(url, context=ctx).read()
                                              File "/usr/lib/python2.7/urllib.py", line 87, in urlopen
                                                return opener.open(url)
                                              File "/usr/lib/python2.7/urllib.py", line 216, in open
                                                return getattr(self, name)(url)
                                              File "/usr/lib/python2.7/urllib.py", line 446, in open_https
                                                h.endheaders(data)
                                              File "/usr/lib/python2.7/httplib.py", line 1054, in endheaders
                                                self._send_output(message_body)
                                              File "/usr/lib/python2.7/httplib.py", line 892, in _send_output
                                                self.send(msg)
                                              File "/usr/lib/python2.7/httplib.py", line 854, in send
                                                self.connect()
                                              File "/usr/lib/python2.7/httplib.py", line 1279, in connect
                                                server_hostname=server_hostname)
                                              File "/usr/lib/python2.7/ssl.py", line 369, in wrap_socket
                                                _context=self)
                                              File "/usr/lib/python2.7/ssl.py", line 599, in __init__
                                                self.do_handshake()
                                              File "/usr/lib/python2.7/ssl.py", line 828, in do_handshake
                                                self._sslobj.do_handshake()
                                            IOError: [Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)
                                            -->End of Python script error report<--
2021-01-24 17:50:02.408 T:1916502960   ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.magentasport/?live=True&mode=event&event=%2Fevent%2F666769%2F228004]

When disabling SSL ceritifcate verification using an unverified context, this part of the code seems to work but the playback fails due to curl rejecting the unverified connection (probably when kodi starts trying to pull the media).

Kodi seems to not be trusting the DigiCert Global Root CA certificate, seems to be an issue with the ca-certificates package, in case someone else encounters this, the problem was fixed by following this guide https://unboxed.co/blog/opensslsslsslerror-certificate-verify-failed/ and adding the DigiCert Global Root CA certificate.