Skip to content

Allow enabling FIPS mode from an environment variable #10938

Closed
@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) WebSocketServer hixie mode connection establishing handles messages passed along with the upg
error: | Uncaught Error: error:060A80A3:digital envelope routines:FIPS_DIGESTINIT:disabled for fips      
error: | at Error (native)                                                                               
error: | at new Hash (crypto.js:56:18)                                                                   
error: | at Object.Hash (crypto.js:55:12)                                                                
error: | at WebSocketServer.completeHandshake (lib/WebSocketServer.js:411:24)                            
error: | at onClientVerified (lib/WebSocketServer.js:471:25)                                             
error: | at WebSocketServer.handleHixieUpgrade (lib/WebSocketServer.js:526:3)                            
error: | at WebSocketServer.handleUpgrade (lib/WebSocketServer.js:172:61)                                
error: | at Server.WebSocketServer._onServerUpgrade (lib/WebSocketServer.js:89:12)                       
error: | at onParserExecuteCommon (_http_server.js:409:14)                                               
error: | at HTTPParser.onParserExecute (_http_server.js:377:5)                         
Node Version How to enable FIPS Command to test
v4 On by default citgm ws
v6.0.0..v6.8.1 Requires env var OPENSSL_CONF=/path/to/openssl_fips_enabled.cnf citgm ws
v6.9.0.. Command line flag only mkdir 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