And explicitly disable redis-py TLS validation to restore the validation
behaviour back to how it was with redis-py v2, since Heroku Redis uses
self-signed certificates so connections to it will fail if validation
is enabled. This resolves the issue seen in bug 1510000.
This commit is contained in:
pyup.io bot 2019-01-03 02:33:37 -08:00 коммит произвёл Ed Morley
Родитель d060a26933
Коммит a726b5ee28
3 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -216,7 +216,9 @@ django-redis==4.10.0 \
--hash=sha256:f46115577063d00a890867c6964ba096057f07cb756e78e0503b89cd18e4e083
# Required by django-redis
redis==2.10.6 --hash=sha256:8a1900a9f2a0a44ecf6e8b5eb3e967a9909dfed219ad66df094f27f7d6f330fb
redis==3.0.1 \
--hash=sha256:8e0bdd2de02e829b6225b25646f9fb9daffea99a252610d040409a6738541f0a \
--hash=sha256:2100750629beff143b6a200a2ea8e719fcf26420adabb81402895e144c5083cf
elasticsearch==6.3.1 \
--hash=sha256:7546cc08e3899716e12fe67d12d7cfe9a64647014d1134b014c3c392b63cad42 \

Просмотреть файл

@ -40,7 +40,7 @@ def test_get_tls_redis_url():
https://devcenter.heroku.com/articles/securing-heroku-redis#connecting-directly-to-stunnel
"""
REDIS_URL = 'redis://h:abc8069@ec2-12-34-56-78.compute-1.amazonaws.com:8069'
TLS_REDIS_URL = 'rediss://h:abc8069@ec2-12-34-56-78.compute-1.amazonaws.com:8070'
TLS_REDIS_URL = 'rediss://h:abc8069@ec2-12-34-56-78.compute-1.amazonaws.com:8070?ssl_cert_reqs=none'
assert get_tls_redis_url(REDIS_URL) == TLS_REDIS_URL

Просмотреть файл

@ -19,7 +19,7 @@ def get_tls_redis_url(redis_url):
to wrap the connection with TLS.
Will convert 'redis://h:PASSWORD@INSTANCE.compute-1.amazonaws.com:8409'
...to: 'rediss://h:PASSWORD@INSTANCE.compute-1.amazonaws.com:8410'
...to: 'rediss://h:PASSWORD@INSTANCE.compute-1.amazonaws.com:8410?ssl_cert_reqs=none'
See:
https://devcenter.heroku.com/articles/securing-heroku-redis#connecting-directly-to-stunnel
@ -27,4 +27,8 @@ def get_tls_redis_url(redis_url):
url = furl(redis_url)
url.port += 1
url.scheme += 's'
# Disable TLS certificate validation (restoring the behaviour of the older redis-py 2.x),
# since for now Heroku Redis uses self-signed certificates:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1510000
url.args['ssl_cert_reqs'] = 'none'
return str(url)