Created
August 2, 2023 08:20
-
-
Save ilmarkerm/c10652e2d36f6f2287d9565411d60df0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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