From a33aed778e3a425dba7a54230ea63cba34f8b3c3 Mon Sep 17 00:00:00 2001 From: HeshanSudarshana Date: Fri, 22 Mar 2024 16:27:14 +0530 Subject: [PATCH] Update fips script to accommodate bouncycastle update --- .../product/src/main/startup-scripts/fips.bat | 111 ++++++----- .../product/src/main/startup-scripts/fips.sh | 178 +++++++++--------- 2 files changed, 150 insertions(+), 139 deletions(-) diff --git a/modules/distribution/product/src/main/startup-scripts/fips.bat b/modules/distribution/product/src/main/startup-scripts/fips.bat index 31081d9ce3..c9ba6067e7 100644 --- a/modules/distribution/product/src/main/startup-scripts/fips.bat +++ b/modules/distribution/product/src/main/startup-scripts/fips.bat @@ -16,10 +16,10 @@ rem KIND, either express or implied. See the License for the rem specific language governing permissions and limitations rem under the License. -set BC_FIPS_VERSION=1.0.2.3 +set BC_FIPS_VERSION=1.0.2.4 set BCPKIX_FIPS_VERSION=1.0.7 -set EXPECTED_BC_FIPS_CHECKSUM=da62b32cb72591f5b4d322e6ab0ce7de3247b534 +set EXPECTED_BC_FIPS_CHECKSUM=9008d04fc13da6455e6a792935b93b629757335d set EXPECTED_BCPKIX_FIPS_CHECKSUM=fe07959721cfa2156be9722ba20fdfee2b5441b0 @@ -80,27 +80,28 @@ if exist "%CARBON_HOME%\repository\components\dropins\bcpkix_fips*.jar" ( DEL /F "%CARBON_HOME%\repository\components\dropins\bcpkix_fips*.jar" echo Successfully removed bcpkix-fips_%BCPKIX_FIPS_VERSION%.jar from components\dropins. ) -if not exist "%CARBON_HOME%\repository\components\plugins\bcprov-jdk15on*.jar" ( +if not exist "%CARBON_HOME%\repository\components\plugins\bcprov-jdk*.jar" ( set server_restart_required=true - if exist "%homeDir%\.wso2-bc\backup\bcprov-jdk15on*.jar" ( - for /r %homeDir%\.wso2-bc\backup\ %%G in (bcprov-jdk15on*.jar) do ( + if exist "%homeDir%\.wso2-bc\backup\bcprov-jdk*.jar" ( + for /r %homeDir%\.wso2-bc\backup\ %%G in (bcprov-jdk*.jar) do ( set bcprov_location=%%G set file_name=%%~nG goto checkbcprovVersion ) :checkbcprovVersion for /f "tokens=2 delims=_" %%v in ("%bcprov_file_name%") do set "bcprov_version=%%v" + for /f "tokens=1 delims=_" %%a in ("%bcprov_file_name%") do set "bcprov_jar=%%a" goto bbb :bbb move "%bcprov_location%" "%CARBON_HOME%\repository\components\plugins" echo Moved %bcprov_file_name% from %homeDir%\.wso2-bc\backup to components/plugins. - ) else ( echo "Required bcprov-jdk15on jar is not available in %homeDir%/.wso2-bc/backup. Download the jar from maven central repository." ) + ) else ( echo "Required bcprov jar is not available in %homeDir%/.wso2-bc/backup. Download the jar from maven central repository." ) ) -if not exist "%CARBON_HOME%\repository\components\plugins\bcpkix-jdk15on*.jar" ( +if not exist "%CARBON_HOME%\repository\components\plugins\bcpkix-jdk*.jar" ( set server_restart_required=true - if exist "%homeDir%\.wso2-bc\backup\bcpkix-jdk15on*.jar" ( - for /r %homeDir%\.wso2-bc\backup\ %%G in (bcpkix-jdk15on*.jar) do ( + if exist "%homeDir%\.wso2-bc\backup\bcpkix-jdk*.jar" ( + for /r %homeDir%\.wso2-bc\backup\ %%G in (bcpkix-jdk*.jar) do ( set bcpkix_location=%%G set bcpkix_file_name=%%~nG set verify=false @@ -108,14 +109,17 @@ if not exist "%CARBON_HOME%\repository\components\plugins\bcpkix-jdk15on*.jar" ( ) :foundBcPkix1 for /f "tokens=2 delims=_" %%v in ("%bcpkix_file_name%") do set "bcpkix_version=%%v" + for /f "tokens=1 delims=_" %%a in ("%bcpkix_file_name%") do set "bcpkix_jar=%%a" goto bbb :bbb move "%bcpkix_location%" "%CARBON_HOME%\repository\components\plugins" echo Moved %bcpkix_file_name% from %homeDir%\.wso2-bc\backup to components/plugins. - ) else ( echo "Required bcpkix-jdk15on jar is not available in %homeDir%/.wso2-bc/backup. Download the jar from maven central repository." ) + ) else ( echo "Required bcpkix jar is not available in %homeDir%/.wso2-bc/backup. Download the jar from maven central repository." ) ) +echo "bcprov_text %bcprov_text%" +echo "bcpkix_text %bcpkix_text%" findstr /c:%bcprov_text% %api_publisher_bundles_info% > nul if %errorlevel%==1 ( set server_restart_required=true @@ -207,41 +211,43 @@ if not exist "%homeDir%\.wso2-bc\backup" ( mkdir "%homeDir%\.wso2-bc\backup" ) -if exist %CARBON_HOME%\repository\components\plugins\bcprov-jdk15on*.jar ( +if exist %CARBON_HOME%\repository\components\plugins\bcprov-jdk*.jar ( set server_restart_required=true - for /r %CARBON_HOME%\repository\components\plugins\ %%G in (bcprov-jdk15on*.jar) do ( + for /r %CARBON_HOME%\repository\components\plugins\ %%G in (bcprov-jdk*.jar) do ( set bcprov_location=%%G set bcprov_file_name=%%~nG goto checkBcVersion ) :checkBcVersion for /f "tokens=2 delims=_" %%v in ("%bcprov_file_name%") do set "bcprov_version=%%v" + for /f "tokens=1 delims=_" %%a in ("%bcprov_file_name%") do set "bcprov_jar=%%a" goto removeBcProv :removeBcProv - echo Removing existing bcprov-jdk15on jar from plugins folder. - if exist "%homeDir%\.wso2-bc\backup\bcprov-jdk15on*.jar" ( - DEL /F "%homeDir%\.wso2-bc\backup\bcprov-jdk15on*.jar" + echo Removing existing bcprov jar from plugins folder. + if exist "%homeDir%\.wso2-bc\backup\bcprov-jdk*.jar" ( + DEL /F "%homeDir%\.wso2-bc\backup\bcprov-jdk*.jar" ) move "%bcprov_location%" "%homeDir%\.wso2-bc\backup" echo Successfully removed %bcprov_file_name% from components\plugins. ) -if exist %CARBON_HOME%\repository\components\plugins\bcpkix-jdk15on*.jar ( +if exist %CARBON_HOME%\repository\components\plugins\bcpkix-jdk*.jar ( set server_restart_required=true - for /r %CARBON_HOME%\repository\components\plugins\ %%G in (bcpkix-jdk15on*.jar) do ( + for /r %CARBON_HOME%\repository\components\plugins\ %%G in (bcpkix-jdk*.jar) do ( set bcpkix_location=%%G set bcpkix_file_name=%%~nG goto checkBcpkixVersion ) :checkBcpkixVersion for /f "tokens=2 delims=_" %%v in ("%bcpkix_file_name%") do set "bcpkix_version=%%v" + for /f "tokens=1 delims=_" %%a in ("%bcpkix_file_name%") do set "bcpkix_jar=%%a" goto removeBcPkix :removeBcPkix - echo Removing existing bcpkix-jdk15on jar from plugins folder. - if exist "%homeDir%\.wso2-bc\backup\bcpkix-jdk15on*.jar" ( - DEL /F "%homeDir%\.wso2-bc\backup\bcpkix-jdk15on*.jar" + echo Removing existing bcpkix jar from plugins folder. + if exist "%homeDir%\.wso2-bc\backup\bcpkix-jdk*.jar" ( + DEL /F "%homeDir%\.wso2-bc\backup\bcpkix-jdk*.jar" ) move "%bcpkix_location%" "%homeDir%\.wso2-bc\backup" echo Successfully removed %bcpkix_file_name% from components\plugins. @@ -361,8 +367,11 @@ if not exist "%CARBON_HOME%\repository\components\lib\bcpkix-fips*.jar" ( ) ) -set bcprov_text=bcprov-jdk15on,%bcprov_version%,../plugins/bcprov-jdk15on_%bcprov_version%.jar,4,true -set bcpkix_text=bcpkix-jdk15on,%bcpkix_version%,../plugins/bcpkix-jdk15on_%bcpkix_version%.jar,4,true +set bcprov_text=%bcprov_jar%,%bcprov_version%,../plugins/%bcprov_jar%_%bcprov_version%.jar,4,true +set bcpkix_text=%bcpkix_jar%,%bcpkix_version%,../plugins/%bcpkix_jar%_%bcpkix_version%.jar,4,true + +echo "bcprov_text %bcprov_text%" +echo "bcpkix_text %bcpkix_text%" set api_publisher_temp_file=%CARBON_HOME%\repository\components\api-publisher-deprecated\configuration\org.eclipse.equinox.simpleconfigurator\api_publisher_temp.info findstr /v /c:%bcprov_text% /c:%bcpkix_text% %api_publisher_bundles_info% > !api_publisher_temp_file! @@ -396,8 +405,8 @@ goto printRestartMsg :verifyFipsMode set verify=true -if exist %CARBON_HOME%\repository\components\plugins\bcprov-jdk15on*.jar ( - for /r %CARBON_HOME%\repository\components\plugins\ %%G in (bcprov-jdk15on*.jar) do ( +if exist %CARBON_HOME%\repository\components\plugins\bcprov-jdk*.jar ( + for /r %CARBON_HOME%\repository\components\plugins\ %%G in (bcprov-jdk*.jar) do ( set bc_location=%%G set file_name=%%~nG set verify=false @@ -407,8 +416,8 @@ if exist %CARBON_HOME%\repository\components\plugins\bcprov-jdk15on*.jar ( echo Found %file_name% in plugins folder. This jar should be removed. ) -if exist %CARBON_HOME%\repository\components\plugins\bcpkix-jdk15on*.jar ( - for /r %CARBON_HOME%\repository\components\plugins\ %%G in (bcpkix-jdk15on*.jar) do ( +if exist %CARBON_HOME%\repository\components\plugins\bcpkix-jdk*.jar ( + for /r %CARBON_HOME%\repository\components\plugins\ %%G in (bcpkix-jdk*.jar) do ( set bcpkix_location=%%G set file_name=%%~nG set verify=false @@ -435,79 +444,79 @@ if exist "%CARBON_HOME%\repository\components\lib\bcpkix-fips*.jar" ( ) ) else ( set verify=false - echo can not be found bc-fips_%BC_FIPS_VERSION%.jar in components/lib folder. This jar should be added. + echo can not be found bcpkix-fips_%BCPKIX_FIPS_VERSION%.jar in components/lib folder. This jar should be added. ) -findstr /i /c:"bcprov-jdk15on" "%api_publisher_bundles_info%" > nul +findstr /i /c:"bcprov-jdk" "%api_publisher_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcprov-jdk15on entry in api-publisher bundles.info. This should be removed. + echo Found bcprov entry in api-publisher bundles.info. This should be removed. ) -findstr /i /c:"bcpkix-jdk15on" "%api_publisher_bundles_info%" > nul +findstr /i /c:"bcpkix-jdk" "%api_publisher_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcpkix-jdk15on entry in api-publisher bundles.info. This should be removed. + echo Found bcpkix entry in api-publisher bundles.info. This should be removed. ) -findstr /i /c:"bcprov-jdk15on" "%api_devportal_bundles_info%" > nul +findstr /i /c:"bcprov-jdk" "%api_devportal_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcprov-jdk15on entry in api-devportal bundles.info. This should be removed. + echo Found bcprov entry in api-devportal bundles.info. This should be removed. ) -findstr /i /c:"bcpkix-jdk15on" "%api_devportal_bundles_info%" > nul +findstr /i /c:"bcpkix-jdk" "%api_devportal_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcpkix-jdk15on entry in api-devportal bundles.info. This should be removed. + echo Found bcpkix entry in api-devportal bundles.info. This should be removed. ) -findstr /i /c:"bcprov-jdk15on" "%api_key_manager_bundles_info%" > nul +findstr /i /c:"bcprov-jdk" "%api_key_manager_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcprov-jdk15on entry in api-key-manager bundles.info. This should be removed. + echo Found bcprov entry in api-key-manager bundles.info. This should be removed. ) -findstr /i /c:"bcpkix-jdk15on" "%api_key_manager_bundles_info%" > nul +findstr /i /c:"bcpkix-jdk" "%api_key_manager_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcpkix-jdk15on entry in api-key-manager bundles.info. This should be removed. + echo Found bcpkix entry in api-key-manager bundles.info. This should be removed. ) -findstr /i /c:"bcprov-jdk15on" "%default_bundles_info%" > nul +findstr /i /c:"bcprov-jdk" "%default_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcprov-jdk15on entry in default bundles.info. This should be removed. + echo Found bcprov entry in default bundles.info. This should be removed. ) -findstr /i /c:"bcpkix-jdk15on" "%default_bundles_info%" > nul +findstr /i /c:"bcpkix-jdk" "%default_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcpkix-jdk15on entry in default bundles.info. This should be removed. + echo Found bcpkix entry in default bundles.info. This should be removed. ) -findstr /i /c:"bcprov-jdk15on" "%traffic_manager_bundles_info%" > nul +findstr /i /c:"bcprov-jdk" "%traffic_manager_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcprov-jdk15on entry in traffic-manager bundles.info. This should be removed. + echo Found bcprov entry in traffic-manager bundles.info. This should be removed. ) -findstr /i /c:"bcpkix-jdk15on" "%traffic_manager_bundles_info%" > nul +findstr /i /c:"bcpkix-jdk" "%traffic_manager_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcpkix-jdk15on entry in traffic-manager bundles.info. This should be removed. + echo Found bcpkix entry in traffic-manager bundles.info. This should be removed. ) -findstr /i /c:"bcprov-jdk15on" "%gateway_worker_bundles_info%" > nul +findstr /i /c:"bcprov-jdk" "%gateway_worker_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcprov-jdk15on entry in gateway-worker bundles.info. This should be removed. + echo Found bcprov entry in gateway-worker bundles.info. This should be removed. ) -findstr /i /c:"bcpkix-jdk15on" "%gateway_worker_bundles_info%" > nul +findstr /i /c:"bcpkix-jdk" "%gateway_worker_bundles_info%" > nul if %errorlevel%==0 ( set verify=false - echo Found bcpkix-jdk15on entry in gateway-worker bundles.info. This should be removed. + echo Found bcpkix entry in gateway-worker bundles.info. This should be removed. ) if "%verify%"=="true" ( diff --git a/modules/distribution/product/src/main/startup-scripts/fips.sh b/modules/distribution/product/src/main/startup-scripts/fips.sh index aa660c79b6..60377081f3 100644 --- a/modules/distribution/product/src/main/startup-scripts/fips.sh +++ b/modules/distribution/product/src/main/startup-scripts/fips.sh @@ -14,10 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -BC_FIPS_VERSION=1.0.2.3; +BC_FIPS_VERSION=1.0.2.4; BCPKIX_FIPS_VERSION=1.0.7; -EXPECTED_BC_FIPS_CHECKSUM="da62b32cb72591f5b4d322e6ab0ce7de3247b534" +EXPECTED_BC_FIPS_CHECKSUM="9008d04fc13da6455e6a792935b93b629757335d" EXPECTED_BCPKIX_FIPS_CHECKSUM="fe07959721cfa2156be9722ba20fdfee2b5441b0" # Get standard environment variables @@ -49,7 +49,7 @@ if [ "$ARGUMENT" = "DISABLE" ] || [ "$ARGUMENT" = "disable" ]; then sever_restart_required=true echo "Removing existing bcpkix-fips jar from lib folder." rm rm $CARBON_HOME/repository/components/lib/bcpkix-fips*.jar 2> /dev/null - echo "Successfully removed bcpkix-fips_$BCPKIX_JDK15ON_VERSION.jar from component/lib." + echo "Successfully removed bcpkix-fips_$BCPKIX_FIPS_VERSION.jar from component/lib." fi if [ -f $CARBON_HOME/repository/components/dropins/bc_fips*.jar ]; then sever_restart_required=true @@ -61,37 +61,39 @@ if [ "$ARGUMENT" = "DISABLE" ] || [ "$ARGUMENT" = "disable" ]; then sever_restart_required=true echo "Removing existing bcpkix_fips jar from dropins folder." rm rm $CARBON_HOME/repository/components/dropins/bcpkix_fips*.jar 2> /dev/null - echo "Successfully removed bcpkix_fips_$BCPKIX_JDK15ON_VERSION.jar from component/dropins." + echo "Successfully removed bcpkix_fips_$BCPKIX_FIPS_VERSION.jar from component/dropins." fi - if [ ! -e $CARBON_HOME/repository/components/plugins/bcprov-jdk15on*.jar ]; then + if [ ! -e $CARBON_HOME/repository/components/plugins/bcprov-jdk*.jar ]; then sever_restart_required=true - if [ -e $homeDir/.wso2-bc/backup/bcprov-jdk15on*.jar ]; then - location=$(find "$homeDir/.wso2-bc/backup/" -type f -name "bcprov-jdk15on*.jar" | head -1) + if [ -e $homeDir/.wso2-bc/backup/bcprov-jdk*.jar ]; then + location=$(find "$homeDir/.wso2-bc/backup/" -type f -name "bcprov-jdk*.jar" | head -1) bcprov_file_name=$(basename "$location") + bcprov_jar_name=${bcprov_file_name%_*} bcprov_version=${bcprov_file_name#*_} bcprov_version=${bcprov_version%.jar} mv "$location" "$CARBON_HOME/repository/components/plugins" echo "Moved $bcprov_file_name from $homeDir/.wso2-bc/backup to components/plugins." else - echo "Required bcprov-jdk15on jar is not available in $homeDir/.wso2-bc/backup. Download the jar from maven central repository." + echo "Required bcprov jar is not available in $homeDir/.wso2-bc/backup. Download the jar from maven central repository." fi fi - if [ ! -e $CARBON_HOME/repository/components/plugins/bcpkix-jdk15on*.jar ]; then + if [ ! -e $CARBON_HOME/repository/components/plugins/bcpkix-jdk*.jar ]; then sever_restart_required=true - if [ -e $homeDir/.wso2-bc/backup/bcpkix-jdk15on*.jar ]; then - location=$(find "$homeDir/.wso2-bc/backup/" -type f -name "bcpkix-jdk15on*.jar" | head -1) + if [ -e $homeDir/.wso2-bc/backup/bcpkix-jdk*.jar ]; then + location=$(find "$homeDir/.wso2-bc/backup/" -type f -name "bcpkix-jdk*.jar" | head -1) bcpkix_file_name=$(basename "$location") + bcpkix_jar_name=${bcpkix_file_name%_*} bcpkix_version=${bcpkix_file_name#*_} bcpkix_version=${bcpkix_version%.jar} mv "$location" "$CARBON_HOME/repository/components/plugins" echo "Moved $bcpkix_file_name from $homeDir/.wso2-bc/backup to components/plugins." else - echo "Required bcpkix-jdk15on jar is not available in $homeDir/.wso2-bc/backup. Download the jar from maven central repository." + echo "Required bcpkix jar is not available in $homeDir/.wso2-bc/backup. Download the jar from maven central repository." fi fi - bcprov_text="bcprov-jdk15on,$bcprov_version,../plugins/$bcprov_file_name,4,true"; - bcpkix_text="bcpkix-jdk15on,$bcpkix_version,../plugins/$bcpkix_file_name,4,true"; + bcprov_text="$bcprov_jar_name,$bcprov_version,../plugins/$bcprov_file_name,4,true"; + bcpkix_text="$bcpkix_jar_name,$bcpkix_version,../plugins/$bcpkix_file_name,4,true"; if ! grep -q "$bcprov_text" "$api_publisher_bundles_info" ; then echo $bcprov_text >> $api_publisher_bundles_info; @@ -158,14 +160,14 @@ if [ "$ARGUMENT" = "DISABLE" ] || [ "$ARGUMENT" = "disable" ]; then elif [ "$ARGUMENT" = "VERIFY" ] || [ "$ARGUMENT" = "verify" ]; then verify=true; - if [ -f $CARBON_HOME/repository/components/plugins/bcprov-jdk15on*.jar ]; then - location=$(find "$CARBON_HOME/repository/components/plugins/" -type f -name "bcprov-jdk15on*.jar" | head -1) + if [ -f $CARBON_HOME/repository/components/plugins/bcprov-jdk*.jar ]; then + location=$(find "$CARBON_HOME/repository/components/plugins/" -type f -name "bcprov-jdk*.jar" | head -1) file_name=$(basename "$location") verify=false echo "Found $file_name in plugins folder. This jar should be removed." fi - if [ -f $CARBON_HOME/repository/components/plugins/bcprov-jdk15on*.jar ]; then - location=$(find "$CARBON_HOME/repository/components/plugins/" -type f -name "bcpkix-jdk15on*.jar" | head -1) + if [ -f $CARBON_HOME/repository/components/plugins/bcprov-jdk*.jar ]; then + location=$(find "$CARBON_HOME/repository/components/plugins/" -type f -name "bcpkix-jdk*.jar" | head -1) file_name=$(basename "$location") verify=false echo "Found $file_name in plugins folder. This jar should be removed." @@ -190,61 +192,61 @@ elif [ "$ARGUMENT" = "VERIFY" ] || [ "$ARGUMENT" = "verify" ]; then echo "bcpkix-fips_$BCPKIX_FIPS_VERSION.jar can not be found in components/lib folder. This jar should be added." fi - if grep -q "bcprov-jdk15on" "$api_publisher_bundles_info" ; then + if grep -q "bcprov-jdk" "$api_publisher_bundles_info" ; then verify=false - echo "Found bcprov-jdk15on entry in api-publisher bundles.info. This should be removed."; + echo "Found bcprov entry in api-publisher bundles.info. This should be removed."; fi - if grep -q "bcpkix-jdk15on" "$api_publisher_bundles_info" ; then + if grep -q "bcpkix-jdk" "$api_publisher_bundles_info" ; then verify=false - echo "Found bcpkix-jdk15on entry in api-publisher bundles.info. This should be removed."; + echo "Found bcpkix entry in api-publisher bundles.info. This should be removed."; fi - if grep -q "bcprov-jdk15on" "$api_devportal_bundles_info" ; then + if grep -q "bcprov-jdk" "$api_devportal_bundles_info" ; then verify=false - echo "Found bcprov-jdk15on entry in api-devportal bundles.info. This should be removed."; + echo "Found bcprov entry in api-devportal bundles.info. This should be removed."; fi - if grep -q "bcpkix-jdk15on" "$api_devportal_bundles_info" ; then + if grep -q "bcpkix-jdk" "$api_devportal_bundles_info" ; then verify=false - echo "Found bcpkix-jdk15on entry in api-devportal bundles.info. This should be removed."; + echo "Found bcpkix entry in api-devportal bundles.info. This should be removed."; fi - if grep -q "bcprov-jdk15on" "$api_key_manager_bundles_info" ; then + if grep -q "bcprov-jdk" "$api_key_manager_bundles_info" ; then verify=false - echo "Found bcprov-jdk15on entry in api-key-manager bundles.info. This should be removed."; + echo "Found bcprov entry in api-key-manager bundles.info. This should be removed."; fi - if grep -q "bcpkix-jdk15on" "$api_key_manager_bundles_info" ; then + if grep -q "bcpkix-jdk" "$api_key_manager_bundles_info" ; then verify=false - echo "Found bcpkix-jdk15on entry in api-key-manager bundles.info. This should be removed."; + echo "Found bcpkix entry in api-key-manager bundles.info. This should be removed."; fi - if grep -q "bcprov-jdk15on" "$default_bundles_info" ; then + if grep -q "bcprov-jdk" "$default_bundles_info" ; then verify=false - echo "Found bcprov-jdk15on entry in default bundles.info. This should be removed."; + echo "Found bcprov entry in default bundles.info. This should be removed."; fi - if grep -q "bcpkix-jdk15on" "$default_bundles_info" ; then + if grep -q "bcpkix-jdk" "$default_bundles_info" ; then verify=false - echo "Found bcpkix-jdk15on entry in default bundles.info. This should be removed."; + echo "Found bcpkix entry in default bundles.info. This should be removed."; fi - if grep -q "bcprov-jdk15on" "$control_plane_bundles_info" ; then + if grep -q "bcprov-jdk" "$control_plane_bundles_info" ; then verify=false - echo "Found bcprov-jdk15on entry in control-plane bundles.info. This should be removed."; + echo "Found bcprov entry in control-plane bundles.info. This should be removed."; fi - if grep -q "bcpkix-jdk15on" "$control_plane_bundles_info" ; then + if grep -q "bcpkix-jdk" "$control_plane_bundles_info" ; then verify=false - echo "Found bcpkix-jdk15on entry in control-plane bundles.info. This should be removed."; + echo "Found bcpkix entry in control-plane bundles.info. This should be removed."; fi - if grep -q "bcprov-jdk15on" "$traffic_manager_bundles_info" ; then + if grep -q "bcprov-jdk" "$traffic_manager_bundles_info" ; then verify=false - echo "Found bcprov-jdk15on entry in traffic-manager bundles.info. This should be removed."; + echo "Found bcprov entry in traffic-manager bundles.info. This should be removed."; fi - if grep -q "bcpkix-jdk15on" "$traffic_manager_bundles_info" ; then + if grep -q "bcpkix-jdk" "$traffic_manager_bundles_info" ; then verify=false - echo "Found bcpkix-jdk15on entry in traffic-manager bundles.info. This should be removed."; + echo "Found bcpkix entry in traffic-manager bundles.info. This should be removed."; fi - if grep -q "bcprov-jdk15on" "$gateway_worker_bundles_info" ; then + if grep -q "bcprov-jdk" "$gateway_worker_bundles_info" ; then verify=false - echo "Found bcprov-jdk15on entry in gateway-worker bundles.info. This should be removed."; + echo "Found bcprov entry in gateway-worker bundles.info. This should be removed."; fi - if grep -q "bcpkix-jdk15on" "$gateway_worker_bundles_info" ; then + if grep -q "bcpkix-jdk" "$gateway_worker_bundles_info" ; then verify=false - echo "Found bcpkix-jdk15on entry in gateway-worker bundles.info. This should be removed."; + echo "Found bcpkix entry in gateway-worker bundles.info. This should be removed."; fi if [ $verify = true ]; then @@ -274,84 +276,84 @@ else if [ ! -d "$homeDir/.wso2-bc/backup" ]; then mkdir "$homeDir/.wso2-bc/backup" fi - if [ -f $CARBON_HOME/repository/components/plugins/bcprov-jdk15on*.jar ]; then + if [ -f $CARBON_HOME/repository/components/plugins/bcprov-jdk*.jar ]; then sever_restart_required=true - location=$(find "$CARBON_HOME/repository/components/plugins/" -type f -name "bcprov-jdk15on*.jar" | head -1) - echo "Removing existing bcpkix-jdk15on jar from plugins folder." - if [ -f $homeDir/.wso2-bc/backup/bcprov-jdk15on*.jar ]; then - rm $homeDir/.wso2-bc/backup/bcprov-jdk15on*.jar + location=$(find "$CARBON_HOME/repository/components/plugins/" -type f -name "bcprov-jdk*.jar" | head -1) + echo "Removing existing bcprov jar from plugins folder." + if [ -f $homeDir/.wso2-bc/backup/bcprov-jdk*.jar ]; then + rm $homeDir/.wso2-bc/backup/bcprov-jdk*.jar fi mv "$location" "$homeDir/.wso2-bc/backup" bcprov_file_name=$(basename "$location") echo "Successfully removed $bcprov_file_name from component/plugins." fi - if [ -f $CARBON_HOME/repository/components/plugins/bcpkix-jdk15on*.jar ]; then + if [ -f $CARBON_HOME/repository/components/plugins/bcpkix-jdk*.jar ]; then sever_restart_required=true - echo "Removing existing bcpkix-jdk15on jar from plugins folder." - location=$(find "$CARBON_HOME/repository/components/plugins/" -type f -name "bcpkix-jdk15on*.jar" | head -1) - if [ -f $homeDir/.wso2-bc/backup/bcpkix-jdk15on*.jar ]; then - rm $homeDir/.wso2-bc/backup/bcpkix-jdk15on*.jar + echo "Removing existing bcpkix jar from plugins folder." + location=$(find "$CARBON_HOME/repository/components/plugins/" -type f -name "bcpkix-jdk*.jar" | head -1) + if [ -f $homeDir/.wso2-bc/backup/bcpkix-jdk*.jar ]; then + rm $homeDir/.wso2-bc/backup/bcpkix-jdk*.jar fi mv "$location" "$homeDir/.wso2-bc/backup" bcpkix_file_name=$(basename "$location") echo "Successfully removed $bcpkix_file_name from component/plugins." fi - if grep -q "bcprov-jdk15on" "$api_publisher_bundles_info" ; then + if grep -q "bcprov-jdk" "$api_publisher_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcprov-jdk15on/d' $api_publisher_bundles_info + sed -i'' -e '/bcprov-jdk/d' $api_publisher_bundles_info fi - if grep -q "bcpkix-jdk15on" "$api_publisher_bundles_info" ; then + if grep -q "bcpkix-jdk" "$api_publisher_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcpkix-jdk15on/d' $api_publisher_bundles_info + sed -i'' -e '/bcpkix-jdk/d' $api_publisher_bundles_info fi - if grep -q "bcprov-jdk15on" "$api_devportal_bundles_info" ; then + if grep -q "bcprov-jdk" "$api_devportal_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcprov-jdk15on/d' $api_devportal_bundles_info + sed -i'' -e '/bcprov-jdk/d' $api_devportal_bundles_info fi - if grep -q "bcpkix-jdk15on" "$api_devportal_bundles_info" ; then + if grep -q "bcpkix-jdk" "$api_devportal_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcpkix-jdk15on/d' $api_devportal_bundles_info + sed -i'' -e '/bcpkix-jdk/d' $api_devportal_bundles_info fi - if grep -q "bcprov-jdk15on" "$api_key_manager_bundles_info" ; then + if grep -q "bcprov-jdk" "$api_key_manager_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcprov-jdk15on/d' $api_key_manager_bundles_info + sed -i'' -e '/bcprov-jdk/d' $api_key_manager_bundles_info fi - if grep -q "bcpkix-jdk15on" "$api_key_manager_bundles_info" ; then + if grep -q "bcpkix-jdk" "$api_key_manager_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcpkix-jdk15on/d' $api_key_manager_bundles_info + sed -i'' -e '/bcpkix-jdk/d' $api_key_manager_bundles_info fi - if grep -q "bcprov-jdk15on" "$default_bundles_info" ; then + if grep -q "bcprov-jdk" "$default_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcprov-jdk15on/d' $default_bundles_info + sed -i'' -e '/bcprov-jdk/d' $default_bundles_info fi - if grep -q "bcpkix-jdk15on" "$default_bundles_info" ; then + if grep -q "bcpkix-jdk" "$default_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcpkix-jdk15on/d' $default_bundles_info + sed -i'' -e '/bcpkix-jdk/d' $default_bundles_info fi - if grep -q "bcprov-jdk15on" "$control_plane_bundles_info" ; then + if grep -q "bcprov-jdk" "$control_plane_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcprov-jdk15on/d' $control_plane_bundles_info + sed -i'' -e '/bcprov-jdk/d' $control_plane_bundles_info fi - if grep -q "bcpkix-jdk15on" "$control_plane_bundles_info" ; then + if grep -q "bcpkix-jdk" "$control_plane_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcpkix-jdk15on/d' $control_plane_bundles_info + sed -i'' -e '/bcpkix-jdk/d' $control_plane_bundles_info fi - if grep -q "bcprov-jdk15on" "$traffic_manager_bundles_info" ; then + if grep -q "bcprov-jdk" "$traffic_manager_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcprov-jdk15on/d' $traffic_manager_bundles_info + sed -i'' -e '/bcprov-jdk/d' $traffic_manager_bundles_info fi - if grep -q "bcpkix-jdk15on" "$traffic_manager_bundles_info" ; then + if grep -q "bcpkix-jdk" "$traffic_manager_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcpkix-jdk15on/d' $traffic_manager_bundles_info + sed -i'' -e '/bcpkix-jdk/d' $traffic_manager_bundles_info fi - if grep -q "bcprov-jdk15on" "$gateway_worker_bundles_info" ; then + if grep -q "bcprov-jdk" "$gateway_worker_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcprov-jdk15on/d' $gateway_worker_bundles_info + sed -i'' -e '/bcprov-jdk/d' $gateway_worker_bundles_info fi - if grep -q "bcpkix-jdk15on" "$gateway_worker_bundles_info" ; then + if grep -q "bcpkix-jdk" "$gateway_worker_bundles_info" ; then sever_restart_required=true - sed -i'' -e '/bcpkix-jdk15on/d' $gateway_worker_bundles_info + sed -i'' -e '/bcpkix-jdk/d' $gateway_worker_bundles_info fi if [ -e $CARBON_HOME/repository/components/lib/bc-fips*.jar ]; then @@ -382,7 +384,7 @@ else echo "Checksum verification failed: The downloaded bc-fips-$BC_FIPS_VERSION.jar may be corrupted." fi elif [ ! -z "$arg1" ] && [ -z "$arg2" ]; then - if [ ! -e $arg1/bcpkix-fips-$BCPKIX_FIPS_VERSION.jar ]; then + if [ ! -e $arg1/bc-fips-$BC_FIPS_VERSION.jar ]; then echo "Can not be found required bc-fips-$BC_FIPS_VERSION.jar in given file path : $arg1." else cp "$arg1/bc-fips-$BC_FIPS_VERSION.jar" "$CARBON_HOME/repository/components/lib" @@ -445,10 +447,10 @@ else echo "Downloading required bcpkix-fips jar : bcpkix-fips-$BCPKIX_FIPS_VERSION" curl $arg2/org/bouncycastle/bcpkix-fips/$BCPKIX_FIPS_VERSION/bcpkix-fips-$BCPKIX_FIPS_VERSION.jar -o $CARBON_HOME/repository/components/lib/bcpkix-fips-$BCPKIX_FIPS_VERSION.jar ACTUAL_CHECKSUM=$(sha1sucam $CARBON_HOME/repository/components/lib/bc-fips*.jar | cut -d' ' -f1) - if [ "$EXPECTED_BC_FIPS_CHECKSUM" = "$ACTUAL_CHECKSUM" ]; then - echo "Checksum verified: The downloaded bc-fips-$BC_FIPS_VERSION.jar is valid." + if [ "$EXPECTED_BCPKIX_FIPS_CHECKSUM" = "$ACTUAL_CHECKSUM" ]; then + echo "Checksum verified: The downloaded bcpkix-fips-$BCPKIX_FIPS_VERSION.jar is valid." else - echo "Checksum verification failed: The downloaded bc-fips-$BC_FIPS_VERSION.jar may be corrupted." + echo "Checksum verification failed: The downloaded bcpkix-fips-$BCPKIX_FIPS_VERSION.jar may be corrupted." fi fi fi