Skip to content

Allow enabling FIPS mode from an environment variable#10938

@gibfahn

Description

@gibfahn

Problem

As of cae9eb35f0, it is no longer possible to enable FIPS mode with an environment variable. This change was to prevent security issues caused by the misuse of the $OPENSSL_CONF variable. However this means it is no longer possible to test that the FIPS binary actually fails as expected in CitGM.

We can expect (for example) citgm ws to fail with:

error: |4)WebSocketServerhixiemodeconnectionestablishinghandlesmessagespassedalongwiththeupgerror: |Uncaught Error: error:060A80A3:digitalenvelope routines:FIPS_DIGESTINIT:disabledforfipserror: |atError(native)error: |atnewHash(crypto.js:56:18)error: |atObject.Hash(crypto.js:55:12)error: |atWebSocketServer.completeHandshake(lib/WebSocketServer.js:411:24)error: |atonClientVerified(lib/WebSocketServer.js:471:25)error: |atWebSocketServer.handleHixieUpgrade(lib/WebSocketServer.js:526:3)error: |atWebSocketServer.handleUpgrade(lib/WebSocketServer.js:172:61)error: |atServer.WebSocketServer._onServerUpgrade(lib/WebSocketServer.js:89:12)error: |atonParserExecuteCommon(_http_server.js:409:14)error: |atHTTPParser.onParserExecute(_http_server.js:377:5)
Node VersionHow to enable FIPSCommand to test
v4On by defaultcitgm ws
v6.0.0..v6.8.1Requires env varOPENSSL_CONF=/path/to/openssl_fips_enabled.cnf citgm ws
v6.9.0..Command line flag onlymkdir bin; printf '#!/bin/sh'"\n/path/to/node --force-fips "'$*'>bin/node; export PATH=$PWD/bin:$PATH; citgm ws (doesn't work as child processes are spawned).

Possible solution

Allow OPENSSL_FIPS=enable to enable FIPS mode, but don't provide an equivalent to disable it, I don't think this causes any security issues.

Refs:

Turn off FIPS by default: #5181
Discussion of OPENSSL_FIPS: #3820
PR to ignore OPENSSL_CONF: https://github.com/nodejs/node-private/pull/82

cc/ @rvagg@bnoordhuis@shigeki@mhdawson@gdams@sxa555

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions