port pyopenssl fix from urllib3
diff --git a/setup.py b/setup.py
index 898f7ab..71ba523 100755
--- a/setup.py
+++ b/setup.py
@@ -40,6 +40,12 @@
     os.system('twine upload dist/*')
     sys.exit()
 
+# pyOpenSSL version 18.0.0 dropped support for Python 2.6
+if sys.version_info < (2, 7):
+    PYOPENSSL_VERSION = 'pyOpenSSL >= 0.14, < 18.0.0'
+else:
+    PYOPENSSL_VERSION = 'pyOpenSSL >= 0.14'
+
 packages = ['requests']
 
 requires = [
@@ -96,7 +102,7 @@
     cmdclass={'test': PyTest},
     tests_require=test_requirements,
     extras_require={
-        'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],
+        'security': [PYOPENSSL_VERSION, 'cryptography>=1.3.4', 'idna>=2.0.0'],
         'socks': ['PySocks>=1.5.6, !=1.5.7'],
         'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],
     },