Skip to content

Commit 1dcedf4

Browse files
author
Brett Hazen
committed
Change OpenSSL version error to a warning and change HTTPS port number to 18098
1 parent afc5719 commit 1dcedf4

File tree

3 files changed

+9
-32
lines changed

3 files changed

+9
-32
lines changed

buildbot/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ test_normal:
2929
test_security:
3030
@echo "Testing Riak Python Client (with security)"
3131
@../setup.py enable_security --riak-admin=${RIAK_ADMIN}
32-
(cd ..; RUN_YZ=1 SKIP_INDEXES=0 RUN_SECURITY=1 SKIP_POOL=1 SKIP_RESOLVE=1 RIAK_TEST_HTTP_PORT=8099 ./setup.py test)
32+
(cd ..; RUN_YZ=1 SKIP_INDEXES=0 RUN_SECURITY=1 SKIP_POOL=1 SKIP_RESOLVE=1 RIAK_TEST_HTTP_PORT=18098 ./setup.py test)

commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ class preconfigure(Command):
358358
* search = on
359359
* listener.protobuf.internal = 127.0.0.1:8087
360360
* listener.http.internal = 127.0.0.1:8098
361-
* listener.https.internal = 127.0.0.1:8099
361+
* listener.https.internal = 127.0.0.1:18098
362362
* ssl.certfile = $pwd/tests/resources/server.crt
363363
* ssl.keyfile = $pwd/tests/resources/server.key
364364
* ssl.cacertfile = $pwd/tests/resources/ca.crt
@@ -378,7 +378,7 @@ def initialize_options(self):
378378
self.host = "127.0.0.1"
379379
self.pb_port = "8087"
380380
self.http_port = "8098"
381-
self.https_port = "8099"
381+
self.https_port = "18098"
382382

383383
def finalize_options(self):
384384
if self.riak_conf is None:

riak/security.py

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,19 @@
2121
import string
2222
import datetime
2323
import calendar
24+
import warnings
2425
from riak import RiakError
2526
from distutils.version import LooseVersion
2627

2728
OPENSSL_VERSION_101G = 268439679
28-
OPENSSL_VERSION_101 = "1.0.1"
29-
OPENSSL_VERSION_NUM_POS = 1
30-
ssldate = datetime.date(2014, 4, 1)
3129
sslver = OpenSSL.SSL.OPENSSL_VERSION_NUMBER
3230
# Be sure to use at least OpenSSL 1.0.1g
33-
if (sslver < OPENSSL_VERSION_101G):
34-
# Check the build date on older versions
31+
if (sslver < OPENSSL_VERSION_101G) or \
32+
not hasattr(OpenSSL.SSL, 'TLSv1_2_METHOD'):
3533
verstring = OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION)
36-
verdots = string.split(verstring)[OPENSSL_VERSION_NUM_POS]
37-
builtstr = OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_BUILT_ON)
38-
timestamp = string.split(builtstr)
39-
40-
# Older versions don't have a time, only a date
41-
if len(timestamp) < 8:
42-
OPENSSL_VERSION_DAY_POS = 3
43-
OPENSSL_VERSION_MON_POS = 2
44-
OPENSSL_VERSION_YEAR_POS = 4
45-
else:
46-
OPENSSL_VERSION_DAY_POS = 4
47-
OPENSSL_VERSION_MON_POS = 3
48-
OPENSSL_VERSION_YEAR_POS = 7
49-
50-
calmap = dict([(v, k) for k, v in enumerate(calendar.month_abbr)])
51-
day = int(timestamp[OPENSSL_VERSION_DAY_POS])
52-
mon = calmap[timestamp[OPENSSL_VERSION_MON_POS]]
53-
year = int(timestamp[OPENSSL_VERSION_YEAR_POS])
54-
build = datetime.date(year, mon, day)
55-
if LooseVersion(verdots) < LooseVersion(OPENSSL_VERSION_101) or \
56-
build < ssldate or not hasattr(OpenSSL.SSL, 'TLSv1_2_METHOD'):
57-
raise RuntimeError("Found {0} version, but expected at least "
58-
"OpenSSL 1.0.1 built after {1} supporting TLS 1.2"
59-
.format(verstring, ssldate))
34+
msg = "Found {0} version, but expected at least OpenSSL 1.0.1g. " \
35+
"Security may not support TLS 1.2.".format(verstring)
36+
warnings.warn(msg, UserWarning)
6037

6138

6239
class SecurityError(RiakError):

0 commit comments

Comments
 (0)