@@ -766,23 +766,42 @@ to enable FIPS using the configuration flag `--openssl-is-fips`.
766
766
### Configuring and building quictls/openssl for FIPS
767
767
768
768
For quictls/openssl 3.0 it is possible to enable FIPS when dynamically linking.
769
- Node.js currently uses openssl-3.0.0+quic which can be configured as
770
- follows:
771
- ``` console
772
- $ git clone git@github.com:quictls/openssl.git
773
- $ cd openssl
774
- $ ./config --prefix=/path/to/install/dir/ shared enable-fips linux-x86_64
769
+ If you want to build Node.js using openssl-3.0.0+quic, you can follow these
770
+ steps:
771
+
772
+ ** clone OpenSSL source and prepare build**
773
+ ``` bash
774
+ git clone git@github.com:quictls/openssl.git
775
+
776
+ cd openssl
777
+
778
+ ./config \
779
+ --prefix=/path/to/install/dir/ \
780
+ shared \
781
+ enable-fips \
782
+ linux-x86_64
775
783
```
776
- This can be compiled and installed using the following commands:
784
+
785
+ The ` /path/to/install/dir ` is the path in which the ` make install ` instructions
786
+ will publish the OpenSSL libraries and such. We will also use this path
787
+ (and sub-paths) later when compiling Node.js.
788
+
789
+ ** compile and install OpenSSL**
777
790
``` console
778
- $ make -j8
779
- $ make install_ssldirs
780
- $ make install_fips
791
+ make -j8
792
+ make install
793
+ make install_ssldirs
794
+ make install_fips
781
795
```
782
796
783
- After the FIPS module and configuration file have been installed by the above
784
- instructions we also need to update ` /path/to/install/dir/ssl/openssl.cnf ` to
785
- use the generated FIPS configuration file (` fipsmodule.cnf ` ):
797
+ After the OpenSSL (including FIPS) modules have been compiled and installed
798
+ (into the ` /path/to/install/dir ` ) by the above instructions we also need to
799
+ update the OpenSSL configuration file located under
800
+ ` /path/to/install/dir/ssl/openssl.cnf ` . Right next to this file, you should
801
+ find the ` fipsmodule.cnf ` file - let's add the following to the end of the
802
+ ` openssl.cnf ` file.
803
+
804
+ ** alter openssl.cnf**
786
805
``` text
787
806
.include fipsmodule.cnf
788
807
@@ -797,25 +816,53 @@ fips = fips_sect
797
816
activate = 1
798
817
```
799
818
800
- In the above case OpenSSL is not installed in the default location so two
801
- environment variables need to be set, ` OPENSSL_CONF ` , and ` OPENSSL_MODULES `
802
- which should point to the OpenSSL configuration file and the directory where
803
- OpenSSL modules are located:
819
+ You can e.g. accomplish this by running the following command - be sure to
820
+ replace ` /path/to/install/dir/ ` with the path you have selected. Please make
821
+ sure that you specify an absolute path for the ` .include fipsmodule.cnf ` line -
822
+ using relative paths did not work on my system!
823
+
824
+ ** alter openssl.cnf using a script**
804
825
``` console
805
- $ export OPENSSL_CONF=/path/to/install/dir/ssl/openssl.cnf
806
- $ export OPENSSL_MODULES=/path/to/install/dir/lib/ossl-modules
826
+ cat <<EOT >> /path/to/install/dir/ssl/openssl.cnf
827
+ .include /path/to/install/dir/ssl/fipsmodule.cnf
828
+
829
+ # List of providers to load
830
+ [provider_sect]
831
+ default = default_sect
832
+ # The fips section name should match the section name inside the
833
+ # included /path/to/install/dir/ssl/fipsmodule.cnf.
834
+ fips = fips_sect
835
+
836
+ [default_sect]
837
+ activate = 1
838
+ EOT
807
839
```
808
840
809
- Node.js can then be configured to enable FIPS:
841
+ As you might have picked a non-custom path for your OpenSSL install dir, we
842
+ have to export the following two environment variables in order for Node.js to
843
+ find our OpenSSL modules we built beforehand:
810
844
``` console
811
- $ ./configure --shared-openssl --shared-openssl-libpath=/path/to/install/dir/lib --shared-openssl-includes=/path/to/install/dir/include --shared-openssl-libname=crypto,ssl --openssl-is-fips
812
- $ export LD_LIBRARY_PATH=/path/to/install/dir/lib
813
- $ make -j8
845
+ export OPENSSL_CONF=/path/to/install/dir/ssl/openssl.cnf
846
+ export OPENSSL_MODULES=/path/to/install/dir/lib/ossl-modules
814
847
```
815
848
816
- Verify the produced executable:
849
+ ** build Node.js **
817
850
``` console
818
- $ ldd ./node
851
+ ./configure \
852
+ --shared-openssl \
853
+ --shared-openssl-libpath=/path/to/install/dir/lib \
854
+ --shared-openssl-includes=/path/to/install/dir/include \
855
+ --shared-openssl-libname=crypto,ssl \
856
+ --openssl-is-fips
857
+
858
+ export LD_LIBRARY_PATH=/path/to/install/dir/lib
859
+
860
+ make -j8
861
+ ```
862
+
863
+ ** verify the produced executable**
864
+ ``` console
865
+ ldd ./node
819
866
linux-vdso.so.1 (0x00007ffd7917b000)
820
867
libcrypto.so.81.3 => /path/to/install/dir/lib/libcrypto.so.81.3 (0x00007fd911321000)
821
868
libssl.so.81.3 => /path/to/install/dir/lib/libssl.so.81.3 (0x00007fd91125e000)
@@ -827,21 +874,23 @@ $ ldd ./node
827
874
libc.so.6 => /usr/lib64/libc.so.6 (0x00007fd910cec000)
828
875
/lib64/ld-linux-x86-64.so.2 (0x00007fd9117f2000)
829
876
```
877
+
830
878
If the ` ldd ` command says that ` libcrypto ` cannot be found one needs to set
831
879
` LD_LIBRARY_PATH ` to point to the directory used above for
832
880
` --shared-openssl-libpath ` (see previous step).
833
881
834
- Verify the OpenSSL version:
882
+ ** verify the OpenSSL version**
835
883
``` console
836
- $ ./node -p process.versions.openssl
884
+ ./node -p process.versions.openssl
837
885
3.0.0-alpha16+quic
838
886
```
839
887
840
- Verify that FIPS is available:
888
+ ** verify that FIPS is available**
841
889
``` console
842
- $ ./node -p ' process.config.variables.openssl_is_fips'
890
+ ./node -p 'process.config.variables.openssl_is_fips'
843
891
true
844
- $ ./node --enable-fips -p ' crypto.getFips()'
892
+
893
+ ./node --enable-fips -p 'crypto.getFips()'
845
894
1
846
895
```
847
896
0 commit comments