Skip to content

Commit a888b1d

Browse files
committed
[misc] Node.js v12 require TLSv1.2 by default
Correcting SSL test to permit TLSv1 and TLSv1.1 in case of windows server
1 parent 6b9402d commit a888b1d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

documentation/connection-options.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ Hostname/IP doesn't match certificate's altnames: "Host: other.example.com. is n
367367
```
368368
To fix this, correct the `host` value to correspond to the host identified in the certificate.
369369

370-
370+
#### routines:ssl_choose_client_version:unsupported protocol
371+
372+
Since Node.js 12 minimum TLS version is set to 1.2.
373+
MariaDB server can be build with different SSL library, old version supporting only TLS up to 1.1.
374+
The error "1976:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol" can occur if MariaDB SSL implementation doesn't support TLSv1.2.
375+
This can be solved by :
376+
- Server side: update MariaDB to a recent version
377+
- Client side: permit lesser version with "tls.DEFAULT_MIN_VERSION = 'TLSv1.1';" or with connection configuration: using option `ssl: { secureProtocol: 'TLSv1_1_method' }'
371378

372379

test/integration/test-ssl.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@ const base = require('../base.js');
44
const { assert } = require('chai');
55
const fs = require('fs');
66
const Conf = require('../conf');
7+
const tls = require('tls');
78

89
describe('ssl', function() {
910
let ca = null;
1011
let sslEnable = false;
1112

1213
before(function(done) {
1314
if (process.env.MAXSCALE_VERSION) this.skip();
15+
console.log(tls.DEFAULT_MIN_VERSION);
16+
if (
17+
process.platform === 'win32' &&
18+
tls.DEFAULT_MIN_VERSION === 'TLSv1.2' &&
19+
((shareConn.info.isMariaDB() && !shareConn.info.hasMinVersion(10, 4, 0)) ||
20+
(!shareConn.info.isMariaDB() && !shareConn.info.hasMinVersion(8, 0, 0)))
21+
) {
22+
//TLSv1.2 is supported on windows only since MariaDB 10.4 and MySQL 8.0
23+
//so if testing with Node.js 12, force possible TLS1.1
24+
tls.DEFAULT_MIN_VERSION = 'TLSv1.1';
25+
}
1426

1527
if (process.env.TEST_SSL_CA_FILE) {
1628
const caFileName = process.env.TEST_SSL_CA_FILE;

0 commit comments

Comments
 (0)