Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Conection error [CERTIFICATE_VERIFY_FAILED] #7

Closed
amirkforesightauto opened this issue Jun 19, 2019 · 6 comments
Closed

SSL Conection error [CERTIFICATE_VERIFY_FAILED] #7

amirkforesightauto opened this issue Jun 19, 2019 · 6 comments

Comments

@amirkforesightauto
Copy link

amirkforesightauto commented Jun 19, 2019

I have installed trains and when i run my code with the required 2 lines of integration, i get the following error message:
Retrying (Retry(total=239, connect=240, read=240, redirect=240, status=240)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)'),)': /auth.login
It seems like the firewall at my company that monitors https connections blocks the connection to your demo server.
Is there a way to fix it?

@raviv
Copy link
Contributor

raviv commented Jun 19, 2019

@amirkforesightauto You can run a trains server locally.
See here: https://github.com/allegroai/trains-server

@amirkforesightauto
Copy link
Author

I'm currently trying the demo server.

@bmartinn
Copy link
Member

Yes, it seems your company's firewall is doing some MITM.
Solutions:

  1. Direct python "requests" to use the enterprise certificate file. This can be achieved by setting the OS environment variables CURL_CA_BUNDLE or REQUESTS_CA_BUNDLE .

You can see a detailed discussion here
https://stackoverflow.com/questions/48391750/disable-python-requests-ssl-validation-for-an-imported-module

  1. Latest release-candidate already contains a feature to disable certificate verification (for security reasons this is not encouraged)
    In order to use this new feature:
  • Upgrade the trains package:
    pip install trains==0.9.3rc1
  • Create a new trains.conf configuration file (regular text file), containing:
    api { verify_certificate = False }
  • Copy the trains.conf file to ~/trains.conf (on windows: C:\Users\your_username\trains.conf)

Let me know if it solved the problem

@bmartinn bmartinn changed the title Conection error SSL Conection error [CERTIFICATE_VERIFY_FAILED] Jun 19, 2019
@amirkforesightauto
Copy link
Author

amirkforesightauto commented Jun 20, 2019

Thanks for the fast replies.
I did both solutions:

  1. CURL_CA_BUNDLE="" python
    I get the following error:
    W0620 10:20:00.536018 123 connectionpool.py:665] Retrying (Retry(total=236, connect=240, read=236, redirect=240, status=240)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /auth.login
    W0620 10:20:01.016951 123 connectionpool.py:851] /usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
    InsecureRequestWarning)

  2. uninstalled trans and then installed the specific version.
    created
    ~/trains.conf in
    with the code api { verify_certificate = False }
    I get the a new error report:
    W0620 10:59:45.468020 42 connectionpool.py:665] Retrying (Retry(total=237, connect=240, read=240, redirect=240, status=240)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)'),)': /auth.login

@amirkforesightauto
Copy link
Author

amirkforesightauto commented Jun 20, 2019

I tired the following lines:
TRAINS_API_HOST_VERIFY_CERT=False python
from trains import Task
task = Task.init(project_name, task_name)

and got the following messag:
InsecureRequestWarning: Certificate verification is disabled! Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
Retrying (Retry(total=239, connect=240, read=239, redirect=240, status=240)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /auth.logine:

I then tried going in the following website in my browser
https://demoapi.trainsai.io
and realized that this site is blocked by my company's firewall.
They opened the firewall - this was solved - thanks!!!

@bmartinn
Copy link
Member

Great news & I'm happy to hear IT agreed to open the firewall :)
Meanwhile, the feature already made its way to the current release v0.9.3
You can now safely upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants