From 1cfb45732a9b257d0c039cae76789757426f263a Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 28 May 2019 16:10:11 -0700 Subject: [PATCH] tls: support TLS min/max protocol defaults in CLI Backport CLI switches for default TLS versions: - `--tls-max-v1.2` - `--tls-min-v1.0` - `--tls-min-v1.1` - `--tls-min-v1.2` PR-URL: https://github.com/nodejs/node/pull/27946 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: Beth Griggs Reviewed-By: Shelley Vohr --- doc/api/cli.md | 32 +++++++++++++++++++ doc/api/tls.md | 6 +++- doc/node.1 | 16 ++++++++++ lib/tls.js | 17 ++++++++-- src/node_options.cc | 17 ++++++++++ src/node_options.h | 4 +++ .../test-process-env-allowed-flags.js | 2 +- test/parallel/test-tls-cli-max-version-1.2.js | 15 +++++++++ test/parallel/test-tls-cli-min-version-1.0.js | 15 +++++++++ test/parallel/test-tls-cli-min-version-1.1.js | 15 +++++++++ test/parallel/test-tls-cli-min-version-1.2.js | 15 +++++++++ test/parallel/test-tls-min-max-version.js | 30 ++++++++++++++--- 12 files changed, 174 insertions(+), 10 deletions(-) create mode 100644 test/parallel/test-tls-cli-max-version-1.2.js create mode 100644 test/parallel/test-tls-cli-min-version-1.0.js create mode 100644 test/parallel/test-tls-cli-min-version-1.1.js create mode 100644 test/parallel/test-tls-cli-min-version-1.2.js diff --git a/doc/api/cli.md b/doc/api/cli.md index c322ed551044b0..57e2f8e8f0fb46 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -359,6 +359,38 @@ added: v4.0.0 Specify an alternative default TLS cipher list. Requires Node.js to be built with crypto support (default). +### `--tls-max-v1.2` + + +Does nothing, [`tls.DEFAULT_MAX_VERSION`][] is always 'TLSv1.2'. Exists for +compatibility with Node.js 11.x and higher. + +### `--tls-min-v1.0` + + +Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1'. Use for compatibility with +old TLS clients or servers. + +### `--tls-min-v1.1` + + +Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.1'. Use for compatibility +with old TLS clients or servers. + +### `--tls-min-v1.2` + + +Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.2'. Use this to disable +support for earlier TLS versions, which are less secure. + ### `--trace-deprecation`