os / slacker

Full-featured Python interface for the Slack API
Apache License 2.0
1.6k stars 245 forks source link

requests.exceptions.SSLError: hostname 'slack.com' doesn't match u'*.slack.com' #71

Closed eaglei15 closed 8 years ago

eaglei15 commented 8 years ago

I'm trying to use slacker on python 2.6.9 and getting the issue below, on 2.7.10 everything works. Upgrading to newer version of python is not possible in my case. Is there any workaround?

I'm getting the following error :

/usr/lib64/python2.6/site-packages/requests/packages/urllib3/util/ssl.py:320: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /usr/lib64/python2.6/site-packages/requests/packages/urllib3/util/ssl.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning /usr/lib64/python2.6/site-packages/requests/packages/urllib3/connection.py:303: SubjectAltNameWarning: Certificate for slack.com has no subjectAltName, falling back to check for a commonName for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.) SubjectAltNameWarning Traceback (most recent call last): File "slack.py", line 22, in notifySlacker() File "slack.py", line 20, in notifySlacker slack.chat.post_message('#general', 'Hello fellow slackers!') File "build/bdist.linux-x86_64/egg/slacker/init.py", line 287, in post_message

File "build/bdist.linux-x86_64/egg/slacker/init.py", line 71, in post

File "build/bdist.linux-x86_64/egg/slacker/init.py", line 57, in _request

File "/usr/lib64/python2.6/site-packages/requests/api.py", line 111, in post return request('post', url, data=data, json=json, _kwargs) File "/usr/lib64/python2.6/site-packages/requests/api.py", line 57, in request return session.request(method=method, url=url, _kwargs) File "/usr/lib64/python2.6/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, _send_kwargs) File "/usr/lib64/python2.6/site-packages/requests/sessions.py", line 585, in send r = adapter.send(request, _kwargs) File "/usr/lib64/python2.6/site-packages/requests/adapters.py", line 475, in send raise SSLError(e, request=request) requests.exceptions.SSLError: hostname 'slack.com' doesn't match u'*.slack.com'

import _ssl print _ssl._test_decode_cert('slack.cert')

Python 2.6.9

{'notBefore': 'Jan 26 00:00:00 2015 GMT', 'serialNumber': '27CE5D06960D3796B9E8F6BB000D2DE9', 'notAfter': 'Feb 18 23:59:59 2017 GMT', 'version': 3, 'subject': ((('countryName', u'US'),), (('stateOrProvinceName', u'California'),), (('localityName', u'San Francisco'),), (('organizationName', u'Slack Technologies, Inc'),), (('commonName', u'*.slack.com'),)), 'issuer': ((('countryName', u'US'),), (('organizationName', u'GeoTrust Inc.'),), (('commonName', u'GeoTrust SSL CA - G3'),))}

Python 2.7.10

{'crlDistributionPoints': (u'http://gn.symcb.com/gn.crl',), 'subjectAltName': (('DNS', '.slack.com'), ('DNS', 'slack.com')), 'notBefore': u'Jan 26 00:00:00 2015 GMT', 'caIssuers': (u'http://gn.symcb.com/gn.crt',), 'OCSP': (u'http://gn.symcd.com',), 'serialNumber': u'27CE5D06960D3796B9E8F6BB000D2DE9', 'notAfter': 'Feb 18 23:59:59 2017 GMT', 'version': 3L, 'subject': ((('countryName', u'US'),), (('stateOrProvinceName', u'California'),), (('localityName', u'San Francisco'),), (('organizationName', u'Slack Technologies, Inc'),), (('commonName', u'.slack.com'),)), 'issuer': ((('countryName', u'US'),), (('organizationName', u'GeoTrust Inc.'),), (('commonName', u'GeoTrust SSL CA - G3'),))}

eaglei15 commented 8 years ago

Installing package python-pyOpenSSL per https://github.com/onjin/ejpiaj/issues/1 solved the error.

os commented 8 years ago

👍

david-drinn commented 7 years ago

The target link in @eaglei15 post above is broken. Copy and pasting it works. Or click here.

https://github.com/onjin/ejpiaj/issues/1