3

I am running into the same issue on my development server. I have already checked out stackoverflow.com/questions/46799365/… and that hasn't worked for me.

python -V
Python 2.7.11

and as soon as I call stripe, I get the Support for test mode requests made with versions of TLS lower than 1.2 has been disabled, and support in live mode will be dropped on June 13, 2018. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.

My app.yaml has ssl set to "latest" libraries: - name: django version: "1.9" - name: jinja2 version: "2.6" - name: markupsafe version: "0.15" - name: ssl version: latest - name: pycrypto version: latest

So am I supposed to do something with sandbox.py? I think my request is version 2.16.0 because I was getting some other environment issue when it wasn't. Is that he culprit or something else?

Here's the exact error

PermissionError at /
Request req_DrUOViv9FnjhAx: Support for test mode requests made with versions 
of TLS lower than 1.2 has been disabled, and support in live mode will be dropped on June 13, 2018. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.
Request Method:
GET
Request URL:
http://localhost:8080/
Django Version:
1.9.5
Exception Type:
PermissionError
Exception Value:
Request req_DrUOViv9FnjhAx: Support for test mode requests made with versions of TLS lower than 1.2 has been disabled, and support in live mode will be dropped on June 13, 2018. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.
Exception Location:
lib/stripe/api_requestor.py in handle_error_response, line 178
Python Executable:
/Users/USERNAME/PycharmProjects/PROJECTNAME/virtualenv-dev/bin/python
Python Version:
2.7.11
Python Path:
['/Users/USERNAME/PycharmProjects/PROJECTNAME',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine',
 '/Users/USERNAME/PycharmProjects/PROJECTNAME',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine',
 '/Users/USERNAME/PycharmProjects/PROJECTNAME/virtualenv/lib/python2.7',
 '/Users/USERNAME/PycharmProjects/PROJECTNAME/virtualenv/lib/python2.7/lib-dynload',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/django-1.9',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/jinja2-2.6',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/markupsafe-0.15',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/ssl-2.7.11',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/pycrypto-2.6',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/pytz-2017.2',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/webob-1.1.1',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/werkzeug-0.11.10',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/yaml-3.10',
 'lib']
Server time:
Sat, 24 Mar 2018 00:43:28 -0500
Mak
  • 31
  • 5

3 Answers3

1

I spent many hours on this about a month ago. It was a huge pain, but I finally got it to work.

One issue I was having is that Brew does something very annoying with its python versions. It makes python v3 the default so if you type python in the shell you get v3 and not v2. I manually changed the relevant symlinks in '/usr/local/bin' to make v2 the default.

I don't remember all the steps I took, but you'll want your '/usr/local/bin' to look something like this:

openssl -> /usr/local/Cellar/openssl/1.0.2n/bin/openssl
pip -> ../Cellar/python/2.7.14_3/bin/pip2
python -> ../Cellar/python/2.7.14_3/bin/python2

You'll then want to delete your virtualenv's and recreate them.

Note that I don't use python v3 at all, so if you need both v2 and v3 then YMMV.

new name
  • 15,861
  • 19
  • 68
  • 114
  • I think my problem might be related to this so I created the symlink for openssl. Now I have: "openssl -> /usr/local/Cellar/openssl/1.0.2n/bin/openssl", "pip -> ../Cellar/python/2.7.12_2/bin/pip", "python -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python" . After this I recreated the virtualenv, activated it and double checked openssl version is "OpenSSL 1.0.2n 7 Dec 2017", python -V is "Python 2.7.11" and pip -V is "pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)" when I run dev_appserver.py app.yaml, I still get the same about TLS upgrade :( – Mak Mar 25 '18 at 15:13
  • I ran a couple of statements from stripe support and I thought it might give us a clue (virtualenv-dev) PROJECT $ openssl version OpenSSL 1.0.2n 7 Dec 2017 (virtualenv-dev) PROJECT $ python -c "import ssl; print(ssl.OPENSSL_VERSION)" OpenSSL 0.9.8zh 14 Jan 2016 – Mak Mar 26 '18 at 20:20
  • Maybe it is your path or PYTHONPATH? Do you have more than one `openssl` or `python` installed on the mac? – new name Mar 26 '18 at 21:18
  • I do have more than one python. I did unset pythonpath and got the same issue. There is apparently another openssl but I can't figure out how to get rid of it – Mak Mar 27 '18 at 23:49
  • @Mak, Seems likely to be a path issue. Add the full paths of each `openssl` executable to your question along with the `PATH` environment variable from your virtualenv to your question. – new name Mar 28 '18 at 12:47
0

In addition to using the latest GAE ssl library, when running the application on the local development server you may also need to upgrade your local system's openssl library.

From How do I upgrade my Stripe integration from TLS 1.0 to TLS 1.2? (other specific OS versions are mentioned separately):

And from How do I upgrade my OpenSSL to support TLS 1.2? (other specific OS versions are mentioned separately):

If you are using any other Linux variant, you will need to ensure that running openssl version gives a version of at least 1.0.1. If it does not, you will need to take package updates, and may need to upgrade to a newer version of your operating system.

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
  • Related: https://stackoverflow.com/questions/47389082/braintree-sdk-sslcertificateerror-on-appengine-local-dev-server/47392275#47392275 – Dan Cornilescu Mar 24 '18 at 06:47
  • I'm on Mac OS and have been trying to get the openssl upgraded but having no luck, I'm using virtualenv and here's what happens when I follow the instructions in that stripe article for macs `$brew install openssl Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae dnscrypt-proxy Warning: openssl 1.0.2n is already installed $ brew install python Warning: python 3.6.4_4 is already installed` – Mak Mar 24 '18 at 07:13
  • Note that I use python 3.6.4 for another project but for this project, I need to use 2.7.11. 'which python' points to the Python in my virtualenv – Mak Mar 24 '18 at 07:20
  • I'm a linux user, so donno if this is olf any help. Try `python2` instead of `python` - obviously that answer is for systems with only python 2. – Dan Cornilescu Mar 24 '18 at 14:47
  • I'm not sure where I should be using python2 in the path. See my comment for Jeff above. I start the appengine server with dev_appserver.py app.yaml – Mak Mar 25 '18 at 15:14
  • I mean in all those instructions the generic executables are used: `python`, `pip`, etc. But more specific *should* be available as well: `python2`, `python3`, `pip2`, `pip3`, etc. Use those instead. In a way this is what @Jeff O'Neil's answer is based on as well. – Dan Cornilescu Mar 25 '18 at 15:48
  • Even `dev_appserver.py` uses inside the generic `python` executable. To be certain you use v2 you can invoke it with `python2 dev_appserver.py app.yaml`, for example. – Dan Cornilescu Mar 25 '18 at 15:53
  • So when I activate my virtualenv, I check that the python version is 2.7.11, pip version is 9.0.1 and openssl version is 1.0.2n. Then I ran python2 devappserver and I still get this darn TLS upgrade error. By the way Python2 -V also returns 2.7.11 . – Mak Mar 26 '18 at 19:56
  • I ran a couple of statements from stripe support and I thought it might give us a clue (virtualenv-dev) PROJECT $ openssl version OpenSSL 1.0.2n 7 Dec 2017 (virtualenv-dev) PROJECT $ python -c "import ssl; print(ssl.OPENSSL_VERSION)" OpenSSL 0.9.8zh 14 Jan 2016 – Mak Mar 26 '18 at 20:21
  • I also tried python2. (virtualenv-dev) PROJECT $ python2 -c "import ssl; print(ssl.OPENSSL_VERSION)" OpenSSL 0.9.8zh 14 Jan 2016 – Mak Mar 26 '18 at 20:21
  • Yup - that's 0.9.8zh, not 1.0.2n, which explains the issue. How did you install it in the venv? How about trying to create fresh venv - what version do you get in that one? – Dan Cornilescu Mar 26 '18 at 21:00
  • This is quite frustrating and sorry for dragging this along. Hate environment debugging. So I deleted the virtualenv and created a new one like this "virtualenv myvirtualenvdev" then once I activate myvirtualenvdev I get the same issue. openssl version is 1.0.2n while python -c "import ssl; print(ssl.OPENSSL_VERSION)" gives me 0.9.8zh – Mak Mar 27 '18 at 23:47
  • Try to print `ssl.__path__`, to at least see where is that picked up from. – Dan Cornilescu Mar 28 '18 at 04:05
0

Hope this helps someone in this situation....I had my IT admin help me and and it was a combination of things so I'm posting the solution here for my case to save someone else from the same frustration.

These instructions assume you are running these commands all as an Administrator

First remove HomeBrew:

echo -ne 'y\n' | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" sudo rm -rf /usr/local/Homebrew sudo rm -rf /usr/local/Caskroom sudo rm -rf /usr/local/Cellar

Remove other Pythons installed (v2)

sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7 sudo rm -rf "/Applications/Python 2.7"

Check for links and remove any you find with Cellar in the path

ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | grep 'Cellar' unlink <## Remove those you found ##>

Re-install Homebrew

echo -ne 'y\n' | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Add in openssl

brew install openssl brew postinstall openssl brew link openssl --force

Force Link openssl if needed

ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

Add in Python

brew install python@2 brew postinstall python@2 brew link python@2 --force

link openssl and Python (ensure these versions are what you have installed)

ln -s /usr/local/Cellar/openssl/1.0.2o/bin/openssl /usr/local/bin/openssl ln -s /usr/local/Cellar/openssl/1.0.2o/bin/openssl /usr/local/ssl/bin/openssl ln -s /usr/local/Cellar/python/2.7.14/bin/python /usr/local/bin/python

Clean HomeBrew Once Installed

brew cleanup -s brew cask cleanup brew prune

From here the command showed the correct version

python -c 'import ssl; print ssl.OPENSSL_VERSION'

Mak
  • 31
  • 5