Skip to content

Commit f7da22c

Browse files
author
Paulo Jesus
committed
BUG#26248116 : MYSQLPROVISION DOES NOT USE SECURE CONNECTIONS BY DEFAULT
The mysqlprovision internal component of the AdminAPI was not supporting secure connection by default due to a known limitation from connector-python. However, starting from connector-python 2.1.7 secure connections are established by default and that version (or higher) should be used for mysqlprovision. This patch add unit tests for regression to ensure that a version of connector-python with support for secure connection by default is used.
1 parent df8803f commit f7da22c

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

python/mysql_gadgets/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
LICENSE_FRM = (VERSION_FRM + "\n" + COPYRIGHT_FULL)
4545
PYTHON_MIN_VERSION = (2, 7, 0)
4646
PYTHON_MAX_VERSION = (4, 0, 0)
47-
CONNECTOR_MIN_VERSION = (1, 2, 1)
47+
# Minimum connector-python version that supports secure connection by default.
48+
CONNECTOR_MIN_VERSION = (2, 1, 7)
4849

4950
# Using mathematical notation for intervals, supported MYSQL versions are as
5051
# follows: [MIN_MYSQL_VERSION, MAX_MYSQL_VERSION [

unittest/scripts/js_devapi/scripts/dba_cluster_no_misconfigurations.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,31 @@ if (__have_ssl)
1010
else
1111
var cluster = dba.createCluster('dev');
1212

13+
// Dba.dissolve
14+
cluster.dissolve({force:true});
15+
16+
// Regression for BUG#26248116 : MYSQLPROVISION DOES NOT USE SECURE CONNECTIONS BY DEFAULT
17+
// Test can only be performed if SSL is supported.
18+
//@ Create cluster requiring secure connections (if supported)
19+
if (__have_ssl) {
20+
var result = session.runSql("SELECT @@global.require_secure_transport");
21+
var row = result.fetchOne();
22+
var req_sec_trans = row[0];
23+
session.runSql("SET @@global.require_secure_transport = ON");
24+
var cluster = dba.createCluster('dev', {memberSslMode: 'REQUIRED', clearReadOnly: true});
25+
} else {
26+
var cluster = dba.createCluster('dev', {memberSslMode: 'DISABLED', clearReadOnly: true});
27+
}
28+
29+
//@ Add instance requiring secure connections (if supported)
30+
add_instance_to_cluster(cluster, __mysql_sandbox_port2);
31+
32+
//@ Dissolve cluster requiring secure connections (if supported)
33+
cluster.dissolve({force:true});
34+
if (__have_ssl) {
35+
session.runSql("SET @@global.require_secure_transport = '" + req_sec_trans + "'");
36+
}
37+
1338
//@ Finalization
1439
// Will delete the sandboxes ONLY if this test was executed standalone
1540
if (deployed_here)

unittest/scripts/js_devapi/validation/dba_cluster_no_misconfigurations.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,17 @@
44
//@ Dba.createCluster
55
||
66

7+
// Dba.dissolve
8+
||
9+
10+
//@ Create cluster requiring secure connections (if supported)
11+
||
12+
13+
//@ Add instance requiring secure connections (if supported)
14+
||
15+
16+
//@ Dissolve cluster requiring secure connections (if supported)
17+
||
18+
719
//@ Finalization
820
||

0 commit comments

Comments
 (0)