How to use SSL certitificates for Airnotifier

How to use SSL certitificates for Airnotifier

by Hittesh Ahuja -
Number of replies: 1

Currently I am getting this : 


 Starting new HTTPS connection (1): android.googleapis.com
Traceback (most recent call last):
  File "/opt/packages/airnotifier/api/push.py", line 132, in post
    response = gcm.process(token=[self.token], alert=data['alert'], extra=data['extra'], gcm=data['gcm'])
  File "/opt/packages/airnotifier/pushservices/gcm.py", line 95, in process
    return self.send(kwargs['token'], data=data, collapse_key=collapse_key, ttl=ttl)
  File "/opt/packages/airnotifier/pushservices/gcm.py", line 111, in send
    response = requests.post(self.endpoint, data=payload, headers=headers)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 107, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 447, in send
    raise SSLError(e, request=request)
SSLError: bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)



I believe thats because GCM is trying to connect to android.googleapis.com:443 via SSL . 

Question is : What certificate and Key do I pass to Airnotifier ( how to create it ? ) 


I created a self signed cert and private key using the open_ssl command but it doesnt seem to work.


Regards,

Hittesh 

Average of ratings: -
In reply to Hittesh Ahuja

Re: How to use SSL certitificates for Airnotifier

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi,

you don't have to create a certificate for making GCM work, you just need the project key and API number.

I think that your problem is that your python installation is missing some SSL libraries, please, review this issue:

https://tracker.moodle.org/browse/MDLSITE-3730

Juan

Average of ratings: Useful (1)