Skip to content

Commit

Permalink
Fix openssl pkcs12 export in pre-start.erb when in FIPS mode
Browse files Browse the repository at this point in the history
On a Ubuntu Bionic FIPS enabled stemcell, pre-start.erb fails.
In FIPS Mode, the PKCS#12 format must use compatible encryption and
hashing algorithms.

Fixes: #358
  • Loading branch information
toabctl committed Sep 20, 2022
1 parent 2a0f803 commit e821c0b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion jobs/uaa/templates/bin/pre-start.erb
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,16 @@ function process_certs {
}

function insert_ssl_cert {
local FIPS_OPTS=""
if [ -f "/proc/sys/crypto/fips_enabled" ]; then
local FIPS_ENABLED="$(cat /proc/sys/crypto/fips_enabled)"
if [ "${FIPS_ENABLED}" = 1 ]; then
FIPS_OPTS="-certpbe PBE-SHA1-3DES"
fi
fi
log "Installing Server SSL certificate"

openssl pkcs12 -export -name uaa_ssl_cert \
openssl pkcs12 -export ${FIPS_OPTS} -name uaa_ssl_cert \
-in /var/vcap/jobs/uaa/config/uaa.crt \
-out /var/vcap/data/uaa/uaa_keystore.p12 \
-password pass:k0*l*s3cur1tyr0ck$
Expand Down

0 comments on commit e821c0b

Please sign in to comment.