Mercurial > index.cgi > dotfiles
changeset 205:16fdb3931af6
Many changes to proxy setup, probably more to come eventually
author | Steve Huston <huston@astro.princeton.edu> |
---|---|
date | Tue, 24 Nov 2020 17:30:54 -0500 |
parents | 49ce64b810a2 |
children | 3b8b613c4d7a |
files | .bash_aliases |
diffstat | 1 files changed, 43 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/.bash_aliases Tue Nov 24 11:25:28 2020 -0500 +++ b/.bash_aliases Tue Nov 24 17:30:54 2020 -0500 @@ -79,18 +79,53 @@ } alias x='ssh xanadu.astro.princeton.edu' +# Notes for the process: +# * Do I want $1 to specify which proxy I'm trying to load? Or have it check +# some things and try to determine automatically what to do? Latter could +# be nice but will make it more complex, maybe starting with the explicit +# first would be wise... # Proxying/tunneling - predominantly for my Mac laptop proxy() { - PROXY_HOST=${PROXY_HOST:-xanadu.astro.princeton.edu} - PROXY_PORT=${PROXY_PORT:-8888} + case $1 in + home) + PROXY_HOST=${PROXY_HOST:-joshua.srhuston.net} + PROXY_PORT=${PROXY_PORT:-8889} + PROXY_PATH="/Volumes/Chrome-Personal" + PROXY_UMOUNT="hdiutil detach -quiet ${PROXY_PATH}" + if [ ! -e ${PROXY_PATH}/.profile-exists ] ; then + hdiutil attach -stdinpass -nobrowse -quiet ~/Documents/Chrome-Personal.dmg + if [ ! $? ] ; then + echo Disk image failed to mount, aborting + return + fi + fi + ;; + work) + PROXY_HOST=${PROXY_HOST:-xanadu.astro.princeton.edu} + PROXY_PORT=${PROXY_PORT:-8888} + PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome" + ;; + rc) + PROXY_HOST=${PROXY_HOST:-csesbh2.princeton.edu} + PROXY_PORT=${PROXY_PORT:-8887} + PROXY_PATH="/Users/huston/Library/Application Support/Google/Proxied_Chrome" + ;; + *) + ;; + esac ssh -D $PROXY_PORT -f -C -q $PROXY_HOST 'hostname' - /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ - --proxy-server="socks5://127.0.0.1:$PROXY_PORT" \ - --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" \ - --user-data-dir="/Users/huston/Library/Application Support/Google/Chrome/ProxiedProfile" > /dev/null 2>&1 & - history -s ssh -O cancel -D $PROXY_PORT $PROXY_HOST - echo Cancel command added to history + ( + /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ + --proxy-server="socks5://127.0.0.1:$PROXY_PORT" \ + --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" \ + --user-data-dir="${PROXY_PATH}" > /dev/null 2>&1 + $PROXY_UMOUNT + # Maybe leave this off, so what if the port is left open if there's no + # conflicts... + # ssh -O cancel -D $PROXY_PORT $PROXY_HOST + ) & + disown %+ } # Remote desktop/VNC