Skip to content

Instantly share code, notes, and snippets.

@ilmarkerm
Created August 2, 2023 08:20
Show Gist options
  • Save ilmarkerm/c10652e2d36f6f2287d9565411d60df0 to your computer and use it in GitHub Desktop.
Save ilmarkerm/c10652e2d36f6f2287d9565411d60df0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Convert system trusted CA bundle to Oracle Wallet format (PKCS#12)
# Ilmar Kerm 2023
destdir="/nfs/install_master/base_installers/tools/mozilla_wallet"
tmpwallet="/tmp/systemwallet.p12"
backupdays=62
export walletpassword="EnterOracleWalletPasswordHere"
# Do the conversion to PKCS12
openssl pkcs12 -export -out "$tmpwallet" -in /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem -nokeys -passout env:walletpassword
# If conversion was successful, replace the wallet in shared location
if [ $? -eq 0 ]; then
[ -f "$destdir/ewallet.p12" ] && mv "$destdir/ewallet.p12" "$destdir/ewallet.p12.$(date +%Y-%m-%d)"
chmod 644 "$tmpwallet"
mv "$tmpwallet" "$destdir/ewallet.p12"
# delete old backup wallets
find "$destdir" -name 'ewallet.p12.2*' -mtime "+${backupdays}" -delete
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment