HAProxy service fails with error "bind :443 unable to load SSL certificate from PEM file <path/to/.pem>file"

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 8
  • HAProxy 1.8.27

Issue

  • HAProxy service fails with error "bind :443 unable to load SSL certificate from PEM file <path/to/.pem>file".
  • Why do the same certificate and private key work on RHEL 7 but fail on RHEL 8.

Resolution

If you are using old certificate which includes support for the TLS 1.0 and 1.1 protocols. The algorithms DSA, 3DES, and RC4 are allowed, while RSA keys and Diffie-Hellman parameters are accepted if they are at least 1023 bits long. Change the system wide cryptographic policies to meet the above conditions.

To check current policy :

$ update-crypto-policies --show

To change the policy from DEFAULT to LEGACY

update-crypto-policies --set LEGACY

Root Cause

  • RHEL 8 system wide DEFAULT cryptographic policies should be met by the certificate used in haproxy configuration failing which application refuses to use the certificate unless specified to do so.

From documentation : Chapter 4. Using system-wide cryptographic policies

DEFAULT

The default system-wide cryptographic policy level offers secure settings for current threat models. It allows the TLS 1.2 and 1.3 protocols, as well as the IKEv2 and SSH2 protocols. The RSA keys and Diffie-Hellman parameters are accepted if they are at least 2048 bits long.

LEGACY

This policy ensures maximum compatibility with Red Hat Enterprise Linux 5 and earlier; it is less secure due to an increased attack surface. In addition to the DEFAULT level algorithms and protocols, it includes support for the TLS 1.0 and 1.1 protocols. The algorithms DSA, 3DES, and RC4 are allowed, while RSA keys and Diffie-Hellman parameters are accepted if they are at least 1023 bits long.

FUTURE

A conservative security level that is believed to withstand any near-term future attacks. This level does not allow the use of SHA-1 in signature algorithms. It allows the TLS 1.2 and 1.3 protocols, as well as the IKEv2 and SSH2 protocols. The RSA keys and Diffie-Hellman parameters are accepted if they are at least 3072 bits long.

FIPS

A policy level that conforms with the FIPS 140-2 requirements. This is used internally by the fips-mode-setup tool, which switches the RHEL system into FIPS mode. 

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments