From 11059b216c6cb96b1eb85c3435e1e563195fc06a Mon Sep 17 00:00:00 2001 From: microshine Date: Sat, 2 Sep 2017 00:13:15 +0300 Subject: [PATCH] Update SSL install order 1. Firefox 2. System --- resources/osx-ssl.sh | 27 +++++++++++++-------------- src/ssl.ts | 4 ++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/resources/osx-ssl.sh b/resources/osx-ssl.sh index 94acbcae..b8cfdcab 100644 --- a/resources/osx-ssl.sh +++ b/resources/osx-ssl.sh @@ -5,27 +5,26 @@ certificateName="Fortify Local CA" echo -e "certificateName: ${certificateName}" echo -e "certPath: ${certPath}" -# keychain -security delete-certificate -c ${certificateName} /Library/Keychains/System.keychain -security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${certPath} # Firefox firefoxProfileDir=${userDir}/Library/Application\ Support/Firefox/Profiles firefoxProfiles=$( find "$firefoxProfileDir" -name "*.default*" ) firefoxDefaultProfile="${firefoxProfiles[0]}" -if [ -z "${firefoxDefaultProfile}" ] +if [ ! -z "${firefoxDefaultProfile}" ] then echo "Firfox is not installed" - exit 0 -fi + CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + echo -e "Delete old cert" + # Delete old cert + # /usr/local/Cellar/nss/3.31/bin/certutil -D -n "${certificateName}" -d "${firefoxDefaultProfile}" + ${CUR_DIR}/certutil -D -n "${certificateName}" -d "${firefoxDefaultProfile}" + ${CUR_DIR}/certutil -A -i "${certPath}" -n "${certificateName}" -t "C,c,c" -d "${firefoxDefaultProfile}" + ${CUR_DIR}/certutil -L -d "${firefoxDefaultProfile}" -CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -echo -e "Delete old cert" -# Delete old cert -# /usr/local/Cellar/nss/3.31/bin/certutil -D -n "${certificateName}" -d "${firefoxDefaultProfile}" -${CUR_DIR}/certutil -D -n "${certificateName}" -d "${firefoxDefaultProfile}" -${CUR_DIR}/certutil -A -i "${certPath}" -n "${certificateName}" -t "C,c,c" -d "${firefoxDefaultProfile}" -${CUR_DIR}/certutil -L -d "${firefoxDefaultProfile}" + sudo -u ${USER} bash ${CUR_DIR}/osx_firefox.sh +fi -sudo -u ${USER} bash ${CUR_DIR}/osx_firefox.sh \ No newline at end of file +# keychain +security delete-certificate -c ${certificateName} /Library/Keychains/System.keychain +security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${certPath} \ No newline at end of file diff --git a/src/ssl.ts b/src/ssl.ts index 063acb95..27b9f20a 100644 --- a/src/ssl.ts +++ b/src/ssl.ts @@ -229,8 +229,6 @@ async function InstallTrustedWindows(certPath: string) { const CERTUTIL = `${__dirname}\\..\\..\\certutil.exe`; const CERT_NAME = `Fortify Local CA`; - child_process.execSync(`certutil -addstore -user root "${certPath}"`); - // check Firefox was installed if (fs.existsSync(FIREFOX_DIR)) { // get profiles @@ -241,4 +239,6 @@ async function InstallTrustedWindows(certPath: string) { } }) } + + child_process.execSync(`certutil -addstore -user root "${certPath}"`); } \ No newline at end of file