-
-
Save goodell/117e7912dba40243f82d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FindProxyForURL(url, host) { | |
// access the CIMCs via the SSH-tunneled SOCKS proxy that is hopefully | |
// running on port 8080, but allow fallback if it's not running | |
if (isInNet(dnsResolve(host), "10.0.7.0", "255.255.255.0")) { | |
return "SOCKS localhost:8080; DIRECT"; | |
} | |
// Everything else directly! | |
return "DIRECT"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# PAC file that proxies via SOCKS on localhost:8080 for accesses to 10.0.7.0/24 | |
# addresses (i.e., the CIMCs for the savbu-usnic cluster) | |
pac_file=https://gist.githubusercontent.com/goodell/117e7912dba40243f82d/raw/9c956780ec1d6c7afcf0cb2812d574b17d92a603/proxy-kvm.pac | |
#interface="${1:=Ethernet 2}" | |
#interface="${1:=Wi-Fi}" | |
interface="${1:=Display Ethernet}" | |
set -x | |
function enable_proxy() { | |
sudo networksetup -setautoproxyurl "$interface" $pac_file | |
sudo networksetup -setautoproxystate "$interface" on | |
} | |
function disable_proxy() { | |
# setting state off seems to clear the URL too | |
#sudo networksetup -setautoproxyurl "$interface" '' | |
sudo networksetup -setautoproxystate "$interface" off | |
} | |
enable_proxy | |
trap disable_proxy 0 SIGHUP SIGINT SIGQUIT SIGTERM | |
ssh -T -N -v -D localhost:8080 savbu-usnic | |
trap - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment