-
-
Save piroux/69414c5af0b9bf9fd79e2df27be30b92 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 8181, but allow fallback if it's not running | |
if (isInNet(dnsResolve(host), "10.0.7.0", "255.255.255.0")) { | |
return "SOCKS localhost:8181; 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/piroux/69414c5af0b9bf9fd79e2df27be30b92/raw/cimc-proxy.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:8181 savbu-usnic | |
trap - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment