Unverified HTTPS request warning on Mac OS X #17

Closed
mturquette opened this Issue Jan 26, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@mturquette
Contributor

mturquette commented Jan 26, 2015

Whenever I run jic using keychain (I haven't tried oauth) I get the following warning:

$ jls
/Library/Python/2.7/site-packages/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
InsecureRequestWarning)
➏ PMWG-807 - Can we take the first derivative of a PELT - In Progress
curve?
...

Note that the keychain bits are working, as I only had to type in my password once. I'm not sure if something needs to be added in the code to verify the cert, or if jic doesn't know how to find CAs on Mac OS X, or if perhaps the Linaro Jira server is using a cert that Mac OS X doesn't know about? I doubt that last one since Chromium doesn't complain when browsing cards.linaro.org.

@ototo ototo self-assigned this Jan 30, 2015

@mturquette

This comment has been minimized.

Show comment
Hide comment
@mturquette

mturquette Apr 1, 2015

Contributor

I tried to fix this today but I'm a bit out of my depth. Following the URL linked in my original bug report I installed certifi:

sudo -H pip install certifici

And I modified jic as follows:

diff --git a/jic b/jic
index 57c36fe..28f55a9 100755
--- a/jic
+++ b/jic
@@ -35,6 +35,8 @@ import json
 import errno
 import traceback
 from collections import OrderedDict
+from requests.packages import urllib3
+import certifi


 __version__ = '15.07.1'
@@ -7297,6 +7299,11 @@ def main():

     signal.signal(signal.SIGINT, ctrl_c_handler)

+    http = urllib3.PoolManager(
+        cert_reqs='CERT_REQUIRED', # Force certificate check.
+        ca_certs=certifi.where(),  # Path to the Certifi bundle.
+    )
+
     try:
         cfg = Configuration()
         cl = CommandLine(cfg)

Any idea if the above code can be made to work?

Contributor

mturquette commented Apr 1, 2015

I tried to fix this today but I'm a bit out of my depth. Following the URL linked in my original bug report I installed certifi:

sudo -H pip install certifici

And I modified jic as follows:

diff --git a/jic b/jic
index 57c36fe..28f55a9 100755
--- a/jic
+++ b/jic
@@ -35,6 +35,8 @@ import json
 import errno
 import traceback
 from collections import OrderedDict
+from requests.packages import urllib3
+import certifi


 __version__ = '15.07.1'
@@ -7297,6 +7299,11 @@ def main():

     signal.signal(signal.SIGINT, ctrl_c_handler)

+    http = urllib3.PoolManager(
+        cert_reqs='CERT_REQUIRED', # Force certificate check.
+        ca_certs=certifi.where(),  # Path to the Certifi bundle.
+    )
+
     try:
         cfg = Configuration()
         cl = CommandLine(cfg)

Any idea if the above code can be made to work?

@rwalkerands

This comment has been minimized.

Show comment
Hide comment
@rwalkerands

rwalkerands Jan 20, 2016

Either (a) disable the warnings, or (b) enable verification.

To do (a):

import requests
requests.packages.urllib3.disable_warnings()

To do (b):
Change

options = { 'server': server, 'verify': False }

to

options = { 'server': server, 'verify': True }

in two places.

I've tested both approaches, and can confirm that they work.

Either (a) disable the warnings, or (b) enable verification.

To do (a):

import requests
requests.packages.urllib3.disable_warnings()

To do (b):
Change

options = { 'server': server, 'verify': False }

to

options = { 'server': server, 'verify': True }

in two places.

I've tested both approaches, and can confirm that they work.

@ototo ototo added the wontfix label May 18, 2016

@ototo ototo closed this May 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment