Skip to content

Instantly share code, notes, and snippets.

@opragel
Created December 16, 2015 19:57
Show Gist options
  • Save opragel/bead3f48b6e69074ef6b to your computer and use it in GitHub Desktop.
Save opragel/bead3f48b6e69074ef6b to your computer and use it in GitHub Desktop.
reinstall_checkpoint_endpoint_vpn_osx.sh
#!/bin/bash
# Completely stops & unloads Checkpoint, then uninstalls.
#/Library/Application\ Support/Checkpoint/Endpoint\ Connect/uninstall --uninstall
VPN_SITE_ADDRESS="secure.contoso.com"
# !!! Script expects a flat DMG file, such as one created using JAMF's Composer!
CHECKPOINT_INSTALLER_URL="https://s3-us-west-2.amazonaws.com/my-cool-bucket/checkpoint-endpointVPN-versionDERP.dmg"
CHECKPOINT_INSTALLER_VOLUME="endpointVPN-835017303"
REMOVE_PATHS=( "/Applications/Endpoint Security VPN.app" \
"/Library/Application Support/Checkpoint/" \
"/Library/LaunchDaemons/com.checkpoint.epc.service.plist" \
"/Library/LaunchAgents/com.checkpoint.eps.upgrader.plist" \
"/Library/LaunchAgents/com.checkpoint.eps.gui.plist" \
"/System/Library/Extensions/cpfw.kext" \
"/usr/local/lib/libTrAPI.dylib" )
checkpointInstallerFilename=$(printf "%s" "$CHECKPOINT_INSTALLER_URL" | sed 's@.*/@@')
# Ends VPN connection if currently active
/Library/Application\ Support/Checkpoint/Endpoint\ Connect/./command_line disconnect
killall Endpoint_Security_VPN TrGui TrGUI > /dev/null 2>&1
launchctl unload /Library/LaunchDaemons/com.checkpoint.epc.service.plist
osVersion=$(sw_vers -productVersion | awk -F "." '{print $2}')
if [[ "$osVersion" -lt 11 ]]; then
kextunload /System/Library/Extensions/cpfw.kext
fi
for path in "${REMOVE_PATHS[@]}"
do
if [ -e "$path" ]; then
echo -e "Deleting: $path"
rm -rf "$path"
else
echo "Not found: $path"
fi
done
curl "$CHECKPOINT_INSTALLER_URL" -o "/tmp/$checkpointInstallerFilename" -L
hdiutil attach -nobrowse -quiet "/tmp/$checkpointInstallerFilename"
ditto -rsrc "/Volumes/$CHECKPOINT_INSTALLER_VOLUME/" /
hdiutil detach -quiet "/Volumes/$CHECKPOINT_INSTALLER_VOLUME"
launchctl load /Library/LaunchDaemons/com.checkpoint.epc.service.plist
currentUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
launchctl asuser "$currentUser" open /Applications/Endpoint\ Security\ VPN.app > /dev/null 2>&1
/Library/Application\ Support/Checkpoint/Endpoint\ Connect/command_line create -s "$VPN_SITE_ADDRESS" -a username-password
exit 0
@PunkSage
Copy link

Thanks, that is the most frustrating program to have. Finally I have got rid of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment