Skip to content

Instantly share code, notes, and snippets.

@jamesperrin
Last active January 25, 2024 18:19
Show Gist options
  • Save jamesperrin/7f731d244b2757047c3875967c72b486 to your computer and use it in GitHub Desktop.
Save jamesperrin/7f731d244b2757047c3875967c72b486 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -m
##################################################################################
#
# Purpose: To registry proxy SSL certificate with Fortify Java.
# OS: Windows
# Terminal: Git Bash for Windows
#
# James Perrin, @jamesperrin | https://github.com/jamesperrin
# Licensed under CC0-1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
#
##################################################################################
##################################################################################
# Restrictions: Needs to be ran with elevated privileges
##################################################################################
# Download Root Certificate
# Uncomment if you have a location to download your company's Root Certificate
# curl https://URL/TO/ROOT/CERTIFICATE/Enterprirse-Root-Cert.cer --output ./Enterprirse-Root-Cert.cer
# Sets alias for the proxy SSL Certificate
Alias="enterpriseproxy"
# Sets password for Java Keytool
KeytoolPassword="changeit"
# Sets the path to the Fortify installation
# C:\Program Files\Fortify\Fortify_SCA_23.2.0\jre\bin
FortifyPath=$(find "/c/Program Files/Fortify" -type d -name "Fortify_SCA*")
# Sets the path to the Fortify Apps and Tools installation
# C:\Program Files\Fortify\Fortify_Apps_and_Tools_23.2.0\jre\bin
FortifyAppsPath=$(find "/c/Program Files/Fortify" -type d -name "Fortify_Apps*")
# Delete old Proxy Certificate - ONLY run if Alias already exists and you are updating the Root Certificate
# "$FortifyPath\jre\bin\keytool.exe" -delete -cacerts -alias $Alias -v -noprompt -storepass $KeytoolPassword
# Add Proxy Certificate
"$FortifyPath\jre\bin\keytool.exe" -import -v -cacerts -alias $Alias -file ./Enterprirse-Root-Cert.cer -noprompt -storepass $KeytoolPassword
"$FortifyAppsPath\jre\bin\keytool.exe" -import -v -cacerts -alias $Alias -file ./Enterprirse-Root-Cert.cer -noprompt -storepass $KeytoolPassword
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment