Skip to content

Instantly share code, notes, and snippets.

@patik
Created November 13, 2015 13:24
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save patik/84c0cbbcb65d5b9633c3 to your computer and use it in GitHub Desktop.
Save patik/84c0cbbcb65d5b9633c3 to your computer and use it in GitHub Desktop.
Git and Node with Zscaler proxy
#!/bin/sh
# Git proxy settings
echo "Configuring Git..."
git config --global http.proxy http://gateway.zscaler.net:80/
git config --system http.proxy http://gateway.zscaler.net:80/
git config --global http.sslVerify false
git config --system http.sslVerify false
git config --global --unset http.sslcainfo
git config --system --unset http.sslcainfo
#!/bin/sh
echo "Be sure to install NodeJS from http://nodejs.org before continuing"
read -p "Press enter to continue"
# NPM proxy settings
echo "Configuring NodeJS..."
mkdir /c/Users/$USERNAME/npm/
touch /c/Users/$USERNAME/npm/.npmrc
echo "proxy=http://gateway.zscaler.net:80/" >> /c/Users/$USERNAME/npm/.npmrc
echo "strict-ssl=false" >> /c/Users/$USERNAME/npm/.npmrc
# Tell NPM to use a local directory for installations and caching because user profile folders that are mapped to network shares cause many problems
mkdir /c/apps
mkdir /c/apps/npm
mkdir /c/Program\ Files/nodejs/node_modules/npm/
touch /c/Program\ Files/nodejs/node_modules/npm/.npmrc
cp /c/Program\ Files/nodejs/node_modules/npm/.npmrc /c/Program\ Files/nodejs/node_modules/npm/.npmrc.backup
echo "prefix=C:\apps\npm" > /c/Program\ Files/nodejs/node_modules/npm/.npmrc
# Node modules
echo "Installing Grunt..."
npm install -g grunt-cli
@peternann
Copy link

Thanks man. Was trying to figure this out. There it is.
Much appreciated. Corporate Zscaler - Pfft.

@rdundon
Copy link

rdundon commented May 5, 2017

Thanks for sharing!

I didn't run this per se, as I don't use Grunt and did not want to disable SSL verification. I made a fork and installed the ZScaler certificates that were on my work PC

@SpencerDawson
Copy link

use https://ip.zscaler.com/ to determine if you are on a different gateway as well.

@Dan-Wuensch
Copy link

This script disables SSL verification globally for git and npm, which can expose you and your company to supply chain attacks and malware in your code. Instead, you or the zscaler admin(s) could change the zscaler config to have SSL inspection bypass entries for the domains needed for the desired npm packages.

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