GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: support FIPS mode of OpenSSL by indutny · Pull Request #1890 · nodejs/node

Conversation

@indutny

@indutny indutny commented Jun 3, 2015

Copy link
Copy Markdown
Member

Support building and running with FIPS-compliant OpenSSL. The process is
following:

  1. Download and verify openssl-fips-x.x.x.tar.gz from
    https://www.openssl.org/source/
  2. Extract source to openssl-fips folder
  3. cd openssl-fips && ./config fipscanisterbuild --prefix=pwd/out
  4. make -j && make install
  5. Get into io.js checkout folder
  6. ./configure --openssl-fips=/path/to/openssl-fips/out
  7. Build io.js with make -j

Fix: nodejs/node-v0.x-archive#25463

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@indutny

indutny commented Jun 3, 2015

Copy link
Copy Markdown
Member Author

R= @nodejs/crypto

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny
indutny force-pushed the feature/fips-mode branch from c4b3183 to c133579 Compare June 3, 2015 21:24
@indutny indutny mentioned this pull request Jun 3, 2015
Enabling FIPS-compliant encryption nodejs/node-v0.x-archive#25463
Closed
@indutny

indutny commented Jun 3, 2015

Copy link
Copy Markdown
Member Author

Aye, made a mistake in instructions. Force pushed!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mscdex mscdex added the crypto Issues and PRs related to the crypto subsystem. label Jun 3, 2015
bnoordhuis
bnoordhuis reviewed Jun 3, 2015
View reviewed changes
Comment thread configure Outdated

@bnoordhuis bnoordhuis Jun 3, 2015

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using make_global_settings like that is a horrible and not very portable hack.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@indutny indutny Jun 3, 2015

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, what would be your suggestion to override the linker command?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rvagg

rvagg commented Jun 3, 2015

Copy link
Copy Markdown
Member

@indutny I reckon those instructions should go in to the README rather than being lost in this issue, unless you can think of a better place for it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 4, 2015

Copy link
Copy Markdown
Member Author

Just figured out I could do it better and remove the need to patch fipsld. Will push an update soon.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 4, 2015

Copy link
Copy Markdown
Member Author

@rvagg agree!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@shigeki

shigeki commented Jun 4, 2015

Copy link
Copy Markdown
Contributor

The sources of openssl-fips-2.0.9 are about 8.4M bytes.
If it is really required, is it better to include all sources into the repo and build them within gyp?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

thefourtheye
thefourtheye reviewed Jun 4, 2015
View reviewed changes
Comment thread configure Outdated

@thefourtheye thefourtheye Jun 4, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not very pythonic. Recommended way is if not make_global_settings:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@indutny indutny Jun 4, 2015

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jbergstroem

jbergstroem commented Jun 4, 2015

Copy link
Copy Markdown
Member

I'm not very familiar to fips, but if it ends up being built as a library we should support building against a shared .so as well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 4, 2015

Copy link
Copy Markdown
Member Author

@shigeki sorry, but there are some complications with this FIPS thing. I'm not sure if it can be included in our source tree. Unless someone knows for sure.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@shigeki

shigeki commented Jun 4, 2015

Copy link
Copy Markdown
Contributor

@indutny No, problem, you can take your choice.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny
indutny force-pushed the feature/fips-mode branch 4 times, most recently from 9338069 to c9802dc Compare June 4, 2015 20:35
@indutny

indutny commented Jun 4, 2015

Copy link
Copy Markdown
Member Author

Everything addressed, removed the need to patch OpenSSL FIPS checkout. PTAL (cc @bnoordhuis @rvagg @shigeki )

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny
crypto: support FIPS mode of OpenSSL
282d4c9
Support building and running with FIPS-compliant OpenSSL. The process is
following:

1. Download and verify `openssl-fips-x.x.x.tar.gz` from
   https://www.openssl.org/source/
2. Extract source to `openssl-fips` folder
3. `cd openssl-fips && ./config fipscanisterbuild --prefix=`pwd`/out`
4. `make -j && make install`
5. Get into io.js checkout folder
6. `./configure --openssl-fips=/path/to/openssl-fips/out`
7. Build io.js with `make -j`

Fix: nodejs/node-v0.x-archive#25463
@indutny
indutny force-pushed the feature/fips-mode branch from c9802dc to 282d4c9 Compare June 4, 2015 20:36
thefourtheye
thefourtheye reviewed Jun 4, 2015
View reviewed changes
Comment thread src/node_crypto.cc Outdated

@thefourtheye thefourtheye Jun 4, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we directly do ERR_error_string(ERR_get_error(), NULL)?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@indutny indutny Jun 4, 2015

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't fit into 80 columns. Anyway, merged two previous lines into one. Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@thefourtheye thefourtheye Jun 4, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, okay. I would have done

fprintf(stderr, "openssl fips failed: %s\n",
    ERR_error_string(ERR_get_error(), NULL));

Can we use that?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@indutny indutny Jun 4, 2015

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but what is the point? It is harder to read, and takes the same two lines.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@thefourtheye thefourtheye Jun 4, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I was thinking along the lines of saving some memory. But, as Donald Knuth said, "Premature optimization is the root of all evil". So, this should be fine I guess :-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@indutny indutny Jun 4, 2015

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't save anything, in both JS and C/C++. Compiler are smart enough to figure it out ;)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@thefourtheye thefourtheye Jun 4, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@indutny Oh, I didn't know that even JS Engine could do that. Thanks :-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@indutny
fix
c836aba
rvagg
rvagg reviewed Jun 5, 2015
View reviewed changes
Comment thread deps/openssl/doc/FIPS.md Outdated

@rvagg rvagg Jun 5, 2015

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we have a link to this from the README? Perhaps at the bottom of the build section:

See also: [Building io.js with FIPS-compliant OpenSSL](./deps/openssl/doc/FIPS.md)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@shigeki

shigeki commented Jun 5, 2015

Copy link
Copy Markdown
Contributor

There seems a fix needed to build on my Ubuntu because /bin/sh is not bash but dash.

diff --git a/deps/openssl/fips/fipsld b/deps/openssl/fips/fipsld
index 513982a..4c345cd 100755
--- a/deps/openssl/fips/fipsld
+++ b/deps/openssl/fips/fipsld
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash

 # NOTE: Just a wrapper around normal fipsld
 FIPSLD=$1

And without CXX env, build was faild , so I set it manually.

I can't say whether this is really FIPS compliance or not because I've not read all of contents in OpenSSL handbook. I wonder if patched openssl can be allowed. Tests also show a lot of fips errors for their forbidden rules.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 5, 2015

Copy link
Copy Markdown
Member Author

@shigeki I think this is quite unusual. Is there any reason to replace /bin/sh with different terminal, instead of using chsh?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 5, 2015

Copy link
Copy Markdown
Member Author

@shigeki thanks for checking it out!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 5, 2015

Copy link
Copy Markdown
Member Author

I'll read the FIPS guide to be sure, but here is an excerpt that I think should answer the question of compliance:

OpenSSL itself is not validated,and never will be. Instead a carefully defined software component
called the OpenSSL FIPS Object Module has been created. 
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 5, 2015

Copy link
Copy Markdown
Member Author

I think it should be pretty much correct to use FIPS module with patched OpenSSL:

 The new
product may reference the FIPS 140-1 or FIPS 140-2 validated cryptographic module so
long as the new product does not alter the original validated cryptographic module. 

and

 A
product which uses an embedded validated cryptographic module cannot claim itself to be
validated; only that it utilizes an embedded validated cryptographic module. There is no
assurance that a product is correctly utilizing an embedded validated cryptographic module
- this is outside the scope of the FIPS 140-1 or FIPS 140-2 validation.

IANAL, but OpenSSL was never FIPS compliant, and regardless of any patches it won't became one :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@shigeki

shigeki commented Jun 6, 2015

Copy link
Copy Markdown
Contributor

In Ubuntu, /bin/sh is linked to dash by default. https://wiki.ubuntu.com/DashAsBinSh

I understand OpenSSL was never FIPS compliant. It needs so much requirements. Thanks for clarification.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 6, 2015

Copy link
Copy Markdown
Member Author

Gosh. Please forgive my ignorance, @shigeki . I was completely unaware of dash.

Maybe we can fix the script to make it POSIX compliant, instead of forcing the bash? I'll look into it tomorrow.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny
another fix
c425e47
@indutny

indutny commented Jun 9, 2015

Copy link
Copy Markdown
Member Author

@shigeki please take another look, it still requires CXX, but should work with dash.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

shigeki
shigeki reviewed Jun 10, 2015
View reviewed changes
Comment thread deps/openssl/doc/FIPS.md Outdated

@shigeki shigeki Jun 10, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to add some descriptions to the doc as

  • supported platform: Windows is not supported. Only build on MacOS and Linux are confirmed.
  • CXX env is needed.
  • confirmation of result of fips build as
$ ./iojs -e "console.log(process.versions.openssl)"
1.0.2a-fips

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@shigeki

shigeki commented Jun 10, 2015

Copy link
Copy Markdown
Contributor

Builds on my Ubuntu and MacOS are fine. Add some comments on the doc. LGTM.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

indutny added 3 commits June 10, 2015 12:33
@indutny
fixes
c5932ad
@indutny
fix
d0bb37e
@indutny
fix
8cfe4ab
@indutny

indutny commented Jun 10, 2015

Copy link
Copy Markdown
Member Author

@rvagg @shigeki all fixed, PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rvagg

rvagg commented Jun 10, 2015

Copy link
Copy Markdown
Member

docs lgtm

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

thefourtheye
thefourtheye reviewed Jun 10, 2015
View reviewed changes
Comment thread README.md

@thefourtheye thefourtheye Jun 10, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have OS X, so I couldn't confirm this. Is ./Configure with a capital C, correct?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@indutny indutny Jun 10, 2015

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I have OS X. So I can confirm it ;)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@thefourtheye thefourtheye Jun 10, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, then :-) I just thought it was a typo.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@indutny
fix
566a6f7
@jbergstroem

jbergstroem commented Jun 10, 2015

Copy link
Copy Markdown
Member

Since no one else has mentioned shared library support I'll just have a look at what can be done after this lands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 10, 2015

Copy link
Copy Markdown
Member Author

You mean shared OpenSSL? This will certainly work, except that it won't have patches that we have applied to it. Namely:

  • ae8831f
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbergstroem

jbergstroem commented Jun 10, 2015

Copy link
Copy Markdown
Member

@indutny great; I'll have a look at it later then (especially for the FIPS scenario).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 10, 2015

Copy link
Copy Markdown
Member Author

Ok, cool. I tested it on OS X and Ubuntu, assuming that it is working and landing. Thanks everyone for the feedback!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indutny

indutny commented Jun 10, 2015

Copy link
Copy Markdown
Member Author

Landed in 0f68377, thank you everyone!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

indutny added a commit that referenced this pull request Jun 10, 2015
@indutny
crypto: support FIPS mode of OpenSSL
0f68377
Support building and running with FIPS-compliant OpenSSL. The process is
following:

1. Download and verify `openssl-fips-x.x.x.tar.gz` from
   https://www.openssl.org/source/
2. Extract source to `openssl-fips` folder
3. ``cd openssl-fips && ./config fipscanisterbuild --prefix=`pwd`/out``
   (NOTE: On OS X, you may want to run
    ``./Configure darwin64-x86_64-cc --prefix=`pwd`/out`` if you are going to
    build x64-mode io.js)
4. `make -j && make install`
5. Get into io.js checkout folder
6. `./configure --openssl-fips=/path/to/openssl-fips/out`
7. Build io.js with `make -j`
8. Verify with `node -p "process.versions.openssl"` (`1.0.2a-fips`)

Fix: nodejs/node-v0.x-archive#25463
PR-URL: #1890
Reviewed-By: Rod Vagg <[email protected]>
Reviewed-By: Shigeki Ohtsu <[email protected]>
@indutny indutny closed this Jun 10, 2015
@indutny
indutny deleted the feature/fips-mode branch June 10, 2015 23:51
@rvagg rvagg mentioned this pull request Jun 11, 2015
Release proposal: 2.3.0 #1939
Closed
rvagg added a commit that referenced this pull request Jun 13, 2015
@rvagg
2015-06-13 io.js v2.3.0 Release
41951d4
Notable Changes:

* libuv: Upgraded to 1.6.0 and 1.6.1, see full ChangeLog for details.
  (Saúl Ibarra Corretgé) #1905 #1889. Highlights include:
  - Fix TTY becoming blocked on OS X
  - Fix UDP send callbacks to not to be synchronous
  - Add uv_os_homedir() (exposed as os.homedir(), see below)
* npm: See full release notes for details. (Kat Marchán) #1899. Highlight:
  - Use GIT_SSH_COMMAND (available as of Git 2.3)
* openssl:
  - Upgrade to 1.0.2b and 1.0.2c, introduces DHE man-in-the-middle protection
    (Logjam) and fixes malformed ECParameters causing infinite loop
    (CVE-2015-1788). See the security advisory for full details.
    (Shigeki Ohtsu) #1950 #1958
  - Support FIPS mode of OpenSSL, see README for instructions.
    (Fedor Indutny) #1890
* os: Add os.homedir() method. (Colin Ihrig) #1791
* smalloc: Deprecate whole module. (Vladimir Kurchatkin) #1822
* Add new collaborators:
  - Alex Kocharin (@rlidwka)
  - Christopher Monsanto (@monsanto)
  - Ali Ijaz Sheikh (@ofrobots)
  - Oleg Elifantiev (@Olegas)
  - Domenic Denicola (@domenic)
  - Rich Trott (@Trott)
@mhdawson mhdawson mentioned this pull request Jul 24, 2015
FIPS build instructions #2242
Closed
@stefanmb stefanmb mentioned this pull request Nov 11, 2015
crypto: Resolve FIPS test failures and API issues #3760
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

crypto Issues and PRs related to the crypto subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Enabling FIPS-compliant encryption

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@indutny @rvagg @shigeki @jbergstroem @bnoordhuis @thefourtheye @mscdex
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.