Yelp / elastalert

Easy & Flexible Alerting With ElasticSearch
https://elastalert.readthedocs.org
Apache License 2.0
8k stars 1.73k forks source link

SSL Certificate Error in Elastlaert #1352

Open hemasalma opened 7 years ago

hemasalma commented 7 years ago

Hello,

when working with Elastalert we tried to send alerts to Zenoss tool(Event Management Tool), we have created the Zenoss Alerter and used that alert type in rule file and executed our rule file

in config.yaml i configured the following:

Connect with TLS to Elasticsearch

use_ssl: False

Verify TLS certificates

verify_certs: False

we got the following error:

ERROR:root:Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.14-py2.7.egg/elastalert/elastalert.py", line 1177, in alert return self.send_alert(matches, rule, alert_time=alert_time) File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.14-py2.7.egg/elastalert/elastalert.py", line 1254, in send_alert alert.alert(matches) File "elastalert_modules/my_alerts.py", line 146, in alert response = requests.post(url, data=json.dumps(payload),headers=headers,auth=(self.user,self.password)) File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 112, in post return request('post', url, data=data, json=json, kwargs) File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 513, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 623, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 514, in send raise SSLError(e, request=request) SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

ERROR:root:Uncaught exception running rule Examplerule4: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

can i have any ideas.. on this...

AxelMonroyX commented 6 years ago

Any updates ? same problem here

Qmando commented 6 years ago
File "elastalert_modules/my_alerts.py", line 146, in alert
response = requests.post(url, data=json.dumps(payload),headers=headers,auth=(self.user,self.password))

This is your code thats failing. Why don't you check out http://docs.python-requests.org/en/master/user/advanced/ which tells you how to turn off SSL verification..

Qmando commented 6 years ago

@AxelMonroyX Please post error logs? the OP's error occurs in a custom alerter, so this can't be the same issue.

AxelMonroyX commented 6 years ago

In my case I had to uninstall and reinstall pyOpenSSL and the problem is solved

pip uninstall -y pyOpenSSL
pip install pyOpenSSL

Seems that is a common problem with this library