imperva / incapsula-logs-downloader

A Python script for downloading log files from Incapsula
MIT License
30 stars 35 forks source link

SSL CERTIFICATE_VERIFY_FAILED (_ssl.c:897) #45

Closed matheusquei closed 2 years ago

matheusquei commented 2 years ago

I have inserted the custom cert file but still continuously with this SSL error:

2022-05-09 17:35:09,573 INFO LogsDownloader initializing is done 2022-05-09 17:35:09,574 INFO No last downloaded file is found - downloading index file and starting to download all the log files in it 2022-05-09 17:35:09,574 INFO Downloading logs index file... Request failed: HTTPSConnectionPool(host='logs1.incapsula.com', port=443): Max retries exceeded with url: /10XXX_19XXXXX/logs.index (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897)'),)) 2022-05-09 17:35:10,629 ERROR An error has occur while making a open connection to https://logs1.incapsula.com/10XXX_19XXXXX/logs.index. [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897) 2022-05-09 17:35:10,633 ERROR Failed to downloading index file and starting to download all the log files in it - Connection error, Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 343, in _make_request self._validate_conn(conn) File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn conn.connect() File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 358, in connect sslcontext=context) File "/usr/lib/python3.6/site-packages/urllib3/util/ssl.py", line 354, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/lib64/python3.6/ssl.py", line 365, in wrap_socket _context=self, _session=session) File "/usr/lib64/python3.6/ssl.py", line 776, in init self.do_handshake() File "/usr/lib64/python3.6/ssl.py", line 1036, in do_handshake self._sslobj.do_handshake() File "/usr/lib64/python3.6/ssl.py", line 648, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897)During handling of the above exception, another exception occurred:Traceback (most recent call last): File "/root/incapsula-logs-downloader/script/LogsDownloader.py", line 593, in request_file_content response = https.request('GET', url, headers=auth_header) File "/usr/lib/python3.6/site-packages/urllib3/request.py", line 68, in request urlopen_kw) File "/usr/lib/python3.6/site-packages/urllib3/request.py", line 89, in request_encode_url return self.urlopen(method, url, extra_kw) File "/usr/lib/python3.6/site-packages/urllib3/poolmanager.py", line 324, in urlopen response = conn.urlopen(method, u.request_uri, kw) File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 667, in urlopen response_kw) File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 667, in urlopen response_kw) File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 667, in urlopen response_kw) File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/lib/python3.6/site-packages/urllib3/util/retry.py", line 399, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='logs1.incapsula.com', port=443): Max retries exceeded with url: /10XXX_19XXXXX/logs.index (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897)'),))During handling of the above exception, another exception occurred:Traceback (most recent call last): File "/root/incapsula-logs-downloader/script/LogsDownloader.py", line 129, in get_log_files self.logs_file_index.download() File "/root/incapsula-logs-downloader/script/LogsDownloader.py", line 480, in download file_content = self.file_downloader.request_file_content(self.config.BASE_URL + "logs.index") File "/root/incapsula-logs-downloader/script/LogsDownloader.py", line 620, in request_file_content raise Exception("Connection error") Exception: Connection error2022-05-09 17:35:10,633 INFO Sleeping for 30 seconds before trying to fetch logs again...

Can someone help me?