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 d68da63 commit 3e37730
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 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,13 @@ function process_certs {
}

function insert_ssl_cert {
local FIPS_OPTS=""
if [ -f "/proc/sys/crypto/fips_enabled" ] && [ "$(</proc/sys/crypto/fips_enabled)" = "1" ]; then
FIPS_OPTS="-certpbe PBE-SHA1-3DES"
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 3e37730

Please sign in to comment.