Kodi Community Forum
Solved Kodi 17 Krypton - SSL issues - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Mac OS X (https://forum.kodi.tv/forumdisplay.php?fid=56)
---- Thread: Solved Kodi 17 Krypton - SSL issues (/showthread.php?tid=282604)



Kodi 17 Krypton - SSL issues - enen92 - 2016-07-13

Dear all,

I am facing some issues regarding HTTPS requests in OSX through python addons. Not sure if this is a known issue or otherwise just a problem on my end, hence decided to post seeking advice.
These problems are affecting some of my addons, namely the KordKutters addon that can be installed through the official repository. This issue only occurs in my OSX setup. I can't reproduce the error neither in Linux arm, in Android or Linux x64.

Quote:15:41:22 T:123145312653312 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:590)
Traceback (most recent call last):
File "/Users/enen/Library/Application Support/Kodi/addons/plugin.video.kordkutters/addon.py", line 91, in <module>
get_playlists()
File "/Users/enen/Library/Application Support/Kodi/addons/plugin.video.kordkutters/resources/lib/youtubewrapper.py", line 35, in get_playlists
raw = urllib.urlopen(url)
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/urllib.py", line 87, in urlopen
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/urllib.py", line 213, in open
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/urllib.py", line 443, in open_https
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/httplib.py", line 1053, in endheaders
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/httplib.py", line 897, in _send_output
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/httplib.py", line 859, in send
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/httplib.py", line 1278, in connect
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/ssl.py", line 353, in wrap_socket
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/ssl.py", line 601, in __init__
File "/Users/Shared/jenkins/workspace/OSX-64/tools/depends/xbmc-depends/macosx10.10_x86_64-target/lib/python2.7/ssl.py", line 830, in do_handshake
IOError: [Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
-->End of Python script error report<--
15:41:22 T:140735260250112 DEBUG: ------ Window Init (DialogNotification.xml) ------

I am using the latest nightly build (kodi-20160712-89ef699-master-x86_64). The code works correctly using system python.

Below is the code that is triggering the error:

PHP Code:
import urllib
url 
'https://www.googleapis.com/youtube/v3/playlists?part=snippet,contentDetails&channelId=UCtp9s4L-kxIRy221VVtgjXg&maxResults=50&key=AIzaSyAxaHJTQ5zgh86wk7geOwm-y0YyNMcEkSc'
raw urllib.urlopen(url

Any help is greatly appreciated

Regards


RE: SSL issues - FernetMenta - 2016-07-13

Set environment variable SSL_CERT_FILE to the certificate you want to use. If you don't have any, you can download this one:
https://github.com/xbmc/xbmc/blob/master/tools/depends/target/openssl/cacert.pem

Then start Kodi with the environment variable set.

maybe @Memphiz can update the package to do this implicitly.


RE: SSL issues - enen92 - 2016-07-13

(2016-07-13, 17:51)FernetMenta Wrote: Set environment variable SSL_CERT_FILE to the certificate you want to use. If you don't have any, you can download this one:
https://github.com/xbmc/xbmc/blob/master/tools/depends/target/openssl/cacert.pem

Then start Kodi with the environment variable set.

maybe @Memphiz can update the package to do this implicitly.

Thanks for your help, that made the trick.
It would be great if it worked out of the box though. Should I fill a trac issue?

Cheers


RE: SSL issues - Memphiz - 2016-07-13

@FernetMenta - could the same approach like for android be used here?

https://github.com/xbmc/xbmc/blob/master/xbmc/interfaces/python/XBPython.cpp#L598


RE: SSL issues (kodi log uploader! and others) - Gigantur - 2016-07-21

I also have a few add-ons which get ssl errors.

Kodi (17.0-ALPHA2 Git:2016-06-30-f3ca4ea).

I have experimented with brew and openssl as well as python.org mac version - ssl seems fine in these without certificate errors.

Debug for abc-iview and debug for log uploader

Any help would be appreciated.


RE: SSL issues - Memphiz - 2016-07-21

The fix is in discussion:

https://github.com/xbmc/xbmc/pull/10108


RE: SSL issues - Memphiz - 2016-08-17

This should be fixed in next nightly build.


RE: SSL issues - Gigantur - 2016-08-20

I still get an error (looks different though) using log uploader

Debug

extract for interest:

20:34:44 T:123145309356032 DEBUG: Kodi Log Uploader: reading log...
20:34:44 T:123145309356032 DEBUG: Kodi Log Uploader: starting upload "/Users/tv/Library/Logs/kodi.log"...
20:34:49 T:123145309356032 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'urllib2.HTTPError'>
Error Contents: HTTP Error 405: Method Not Allowed
Traceback (most recent call last):


RE: SSL issues - Ned Scott - 2016-08-20

That's unrelated. The site the log uploader uses has been dead for a while.


SSL issues - Memphiz - 2016-08-20

Try the kordkutter addon which is a better test for https


RE: SSL issues - enen92 - 2016-09-07

(2016-08-17, 20:04)Memphiz Wrote: This should be fixed in next nightly build.

Not sure if this is already fixed but I have been trying the latest nightlies for OSX for a while now. Using the nightly from yesterday (6th September) the issue still persists. I noticed some changes referenced on the original PR were merged yesterday so I decided to try todays (7th) nightly build. However the Application crashes before starting.
No rush and no pressure at all, just FYI in case this is supposed to be already fixed.

Cheers and thanks for looking into the issue


RE: SSL issues - Memphiz - 2016-09-07

stupid bug introduced by the cmake system ... will be solved once this PR is merged:

https://github.com/xbmc/xbmc/pull/10416

Its a coincidence that exactly this bugfix was voided by cmake ...


RE: Kodi 17 Krypton - SSL issues - enen92 - 2016-09-11

It's working great again on latest nightlies! Thanks to Memphiz, fetzerch, FernetMenta and everyone else involved.
Marking the thread as solved


This forum uses Lukasz Tkacz MyBB addons.