Instructions on how to share the connection of a Zscaler installed in a virtual machine can be found below.
Zscaler can be annoying if you're trying to stop it. Despite having administrative rights, usually it asks for a password.
Pick one of the following options to take back control.
People who prefer to use apps over command lines, can use
Kill Zscaler.app
which is a simple wrapper of the shell script described below.
Kill Zscaler.app
to kill Zscaler.Start Zscaler.app
.git clone https://github.com/bkahlert/kill-zscaler.git
cd kill-zscaler
to change into the newly cloned repository.chmod +x kill-zscaler.sh start-zscaler.sh
./kill-zscaler.sh
to kill Zscaler../start-zscaler.sh
.find /Library/LaunchAgents -name '*zscaler*' -exec launchctl unload {} \;;sudo find /Library/LaunchDaemons -name '*zscaler*' -exec launchctl unload {} \;
to kill Zscaler.open -a /Applications/Zscaler/Zscaler.app --hide; sudo find /Library/LaunchDaemons -name '*zscaler*' -exec launchctl load {} \;
.To kill Zscaler by typing kill-zscaler
(and to start it with start-zscaler
) do the following steps:
kill-zscaler.alias.txt
or the following lines to it:
alias start-zscaler="open -a /Applications/Zscaler/Zscaler.app --hide; sudo find /Library/LaunchDaemons -name '*zscaler*' -exec launchctl load {} \;"
alias kill-zscaler="find /Library/LaunchAgents -name '*zscaler*' -exec launchctl unload {} \;;sudo find /Library/LaunchDaemons -name '*zscaler*' -exec launchctl unload {} \;"
source ~/.bashrc
/ source ~/.zshrc
/ ā¦ to load your changes)kill-zscaler
to kill Zscalerstart-zscaler
.To share an existing Zscaler VPN tunnel you can use share-zscaler.v2.sh on the machine with Zscaler installed as follows:
./share-zscaler.sh \
--probe foo.bar.internal \
--domain internal
--prope
argument can be any hostname you want to connect to using the VPN tunnel.
It's used to determine the connection details of your VPN connection.--domain
arguments are used to
customize the DNS name resolution on your host.
This makes your host use your VPN client's name resolution for the specified domains (and sub-domains).If you prefer to have a one-liner without having to download anything you can use the following command at your own risk:
bash -c "$(curl -so- https://raw.githubusercontent.com/bkahlert/kill-zscaler/main/share-zscaler.v2.sh)" -- \
--probe foo.bar.internal \
--domain internal
If you only have a macOS client at hand you can set up a virtual macOS machine using Parallels.
declare -r PARALLELS=/Applications/Parallels\ Desktop.app
declare -r VMDIR=$HOME/Parallels
declare -r NAME=Zscaler
curl -LfSo "$VMDIR/macOS.ipsw" "$("$PARALLELS"/Contents/MacOS/prl_macvm_create --getipswurl)"
"$PARALLELS"/Contents/MacOS/prl_macvm_create "$VMDIR/macOS.ipsw" "$VMDIR/$NAME.macvm" --disksize 40000000000
cat <<CONFIG >"$VMDIR/$NAME.macvm/config.ini"
[Hardware]
vCPU.Count=1
Memory.Size=2147483648
Display.Width=1920
Display.Height=1080
Display.DPI=96
Sound.Enabled=0
Network.Type=1
CONFIG
open "$VMDIR"
open -a "$PARALLELS" "$VMDIR/$NAME.macvm"
Take the chance to customize the above settings to your requirements.
At the time of writing, the disk size cannot be altered later.
40GB disk space (see --disksize
argument) are recommended.
32GB disk space are the bare minimum.
You can now connect to all hosts you listed in step 2 š
Optionally, you can set the name of your VM in
This section describes the necessary steps to run share-zscaler.v2.sh
on your
local machine instead of the virtual Zscaler machine using SSH.
sysctl
and pfctl
without having to enter your password:
(
echo "$(whoami) ALL=NOPASSWD: /usr/sbin/sysctl *"
echo "$(whoami) ALL=NOPASSWD: /sbin/pfctl *"
) | sudo tee /etc/sudoers.d/zscaler
cat << 'LOCK_SCREEN' > ~/Desktop/lock-screen
#!/bin/bash
osascript -e 'tell application "System Events" to keystroke "q" using {command down,control down}'
LOCK_SCREEN
chmod +x ~/Desktop/lock-screen
and run it on login via System Preferences ā Choose your user ā Login items ā + ā Select your lock screen script
Don't forget to make it executable using chmod +x
and to run it once to provide it with sufficient permissions.
ipconfig getifaddr en0
in a script Geeklet. At least you now find out the current IP easily.ssh-copy-id -i ~/.ssh/id_rsa zscaler@Zscaler.local
This snippet assumes that your Zscaler host has the name Zscaler
and your user account on that machine is zscaler
.
ssh zscaler@Zscaler.local printenv
If the output shows the environment variables of your Zscaler host, all is fine.
The following command needs to be run on your working machine,
which then connects to the host Zscaler
with user zscaler
,
and finishes configuring your working machine using the returned configuration Bash script:
(
bash <<'SHARE_ZSCALER_V2'
ssh -4t zscaler@Zscaler.local '
bash -c "$(curl -so- https://raw.githubusercontent.com/bkahlert/kill-zscaler/main/share-zscaler.v2.sh)" -- \
--probe foo.bar.internal \
--domain internal
'
SHARE_ZSCALER_V2
) | bash
You get prompted for the password of user zscaler
(unless you did the optional sudoers configuration).
š” Users with a VPN host machine with dynamic IP can try to change the
ssh
command to:ssh -4t "zscaler@$(sudo nmap -n -p 22 192.168.206.2-254 -oG - | awk '/Up$/{print $2}')"
Be sure to change the
192.168.206
part to match the client's address range. The abovenmap
command looks for a machine with an open SSH port and pass the match to thessh
command.
Example output:
No ALTQ support in kernel
ALTQ related functions disabled
pfctl: pf not enabled
No ALTQ support in kernel
ALTQ related functions disabled
rules cleared
nat cleared
dummynet cleared
0 tables deleted.
0 states cleared
source tracking entries cleared
pf: statistics cleared
pf: interface flags reset
pfctl: Use of -f option, could result in flushing of rules
present in the main ruleset added by the system at startup.
See /etc/pf.conf for further details.
No ALTQ support in kernel
ALTQ related functions disabled
pf enabled
āāāāāāā SHARE ZSCALER HOST CONFIGURATION
Configuring route to 10Ć.200.0.0
route: writing to routing socket: not in table
delete net 100.200.0.0: not in table
add net 100.200.0.0: gateway 192.168.206.14
Configuring resolver for internal
Flushing DNS cache
Host configuration completed ā
SHARE_ZSCALER_SOURCE_ADDRESS
to the network used by your Parallels installation.
192.168.42.3
you'll have to use SHARE_ZSCALER_SOURCE_ADDRESS=192.168.42.0/24
share-zscaler.sh
call on the VM and (2) its output script on your local machine again.