Tags

,

For long time I have been trying to understand  FIPS-140 Certification and it’s effects. Today, I finally got to  configure RHEL6 system in fips mode and use openssl commands. Before we go and play with it, A brief Intro on what  FIPS and Openssl is.

FIPS-140 standard specifies the security requirements for a cryptographic module utilized within a security system protecting sensitive information in computer and telecommunication systems.   US national Institute of Standards and Technology(NIST) publishes FIPS series of standards for the implementation of Cryptographic modules. The Cryptographic Module Validation Program (CMVP) validates cryptographic modules to Federal Information Processing Standard (FIPS) 140-2 and other cryptography based standards.

FIPS 140-2 is primarily of interest to U.S., Canadian, and UK government agencies which have formal policies requiring use of FIPS 140 validated cryptographic software.

Products that have received a NIST/CSE validation are listed on the Cryptographic Module Validation List at http://csrc.nist.gov/cryptval/140-1/1401val.htm

OpenSSL is a Open Source software Implementing SSLv2/V3, TLS protocols and also provides general purpose Crypto libraries (aka libcrypto, libssl etc).

The intention of this article is to specify on how fips should be enabled on RHEL6 and to use approved ciphers with openssl.

Before we start using openssl and use FIPS approved security functions, The operating system has to be brought under fips mode, For that we need to rebuilt the initramfs with fips , prelink should be undone on all the libraries. I have enumerated the steps below.

Below are the steps to put RHEL6 system in FIPS mode  and use openssl with fips approved security functions.

Disable prelinking

change the line "PRELINKING=yes" to "PRELINKING=no" in /etc/sysconfig/prelink

For libraries that were already prelinked, the prelink should be  undone on all the system files using the following command:

$ prelink -u -a

initramfs should be regenerated with fips , to do that install dracut-fips package

$ yum install dracut-fips

Edit /etc/grub.conf  and add fips=1 to the end of the “kernel” line and reboot the system

kernel /vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=/dev/mapper/myvg-rootvol rd_LVM_LV=myvg/rootvol rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto fips=1 

For generating Certificates, openssl should be used only with specific set of Approvied Security Functions. For the list of Approved Security functions  that can be used refer NIST

In Brief below below algorithms can be used for signing, hashing and encyrption:

  • Symmetric Key (AES, TDEA and EES)
  • Asymmetric Key (DSS – DSA, RSA and ECDSA)
  • Secure Hash Standard (SHS)  Secure Hash Standard (SHS) (SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512)
  • Message Authentication (Triple-DES, AES and SHS)

To check if openssl is operating under fips mode,  issue the following

$ openssl md5 somefile

The above should fail as MD5 is not a fips approved Hash Standard.

$ openssl sha1 somefile

The above would work as SHA1 is the fips Approved Hash Standard.

Lets generate Self-signed CA certificate

1. Generate the key

$ openssl genrsa  1024 > dhcp210-11.key

2. Convert the key to PKCS8 Format

The encryption used in the genrsa command cannot be used in the FIPS mode as it uses MD5 to convert the password to a key. We have to either write it unencrypted (no -des3 option) and then convert it using the ‘openssl pkcs8’ command.

if we need it encrypted, or generate the key  using -newkey option during the openssl req command which already writes it encrypted in the pkcs8 format.

$ openssl pkcs8 -in dhcp210-11.key -topk8 -out dhcp210-11-enc.key -v1 PBE-SHA1-3DES

3. Create a Self signed CA certificate.

$ openssl req -new -x509 -key dhcp210-11-enc.key -out dhcp210-11.crt -days 366

or skip step-1 and 2 and generate key inplace (-newkey option) which encrypts private key using pkcs8 format

$ openssl req -new -x509 -newkey rsa:1024 -out dhcp210-11.crt -days 365

References:

1. http://csrc.nist.gov/publications/PubsFIPS.html

2. www.openssl.org

Advertisements