Skip to content

Instantly share code, notes, and snippets.

@mshytikov
Created January 29, 2019 21:27
Show Gist options
  • Save mshytikov/a162ad53db02ad3f3eb5d3ce9f9aedc1 to your computer and use it in GitHub Desktop.
Save mshytikov/a162ad53db02ad3f3eb5d3ce9f9aedc1 to your computer and use it in GitHub Desktop.
Shortcut script to bypass the firewall
#!/usr/bin/env bash -e
#
# Shortcut script to bypass the firewall
#
# It requires manual pre configuration of proxy in network settings.
# Or just run once:
# sudo networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 1985
# sudo networksetup -setsocksfirewallproxystate Wi-Fi off
disable_proxy_cmd="sudo networksetup -setsocksfirewallproxystate Wi-Fi off"
trap "$disable_proxy_cmd" EXIT
# Enable proxy
sudo networksetup -setsocksfirewallproxystate Wi-Fi on
# Run SOCKS proxy
# ssh -ND 1985 [user]@hostname
gcloud compute ssh proxy --zone europe-west1-b --ssh-flag='-ND 1985'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment