Mercurial > index.cgi > dotfiles
comparison .bash_aliases @ 207:7fc7d82cce6d
I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
| author | Steve Huston <huston@astro.princeton.edu> |
|---|---|
| date | Wed, 25 Nov 2020 14:54:48 -0500 |
| parents | 3b8b613c4d7a |
| children | 78b05f62ebbc |
comparison
equal
deleted
inserted
replaced
| 206:3b8b613c4d7a | 207:7fc7d82cce6d |
|---|---|
| 77 fi | 77 fi |
| 78 ssh -t $T_HOST "ssh $1" | 78 ssh -t $T_HOST "ssh $1" |
| 79 } | 79 } |
| 80 alias x='ssh xanadu.astro.princeton.edu' | 80 alias x='ssh xanadu.astro.princeton.edu' |
| 81 | 81 |
| 82 # Notes for the process: | |
| 83 # * Do I want $1 to specify which proxy I'm trying to load? Or have it check | |
| 84 # some things and try to determine automatically what to do? Latter could | |
| 85 # be nice but will make it more complex, maybe starting with the explicit | |
| 86 # first would be wise... | |
| 87 | |
| 88 # Proxying/tunneling - predominantly for my Mac laptop | 82 # Proxying/tunneling - predominantly for my Mac laptop |
| 89 proxy() { | 83 proxy() { |
| 90 case $1 in | 84 case $1 in |
| 91 home) | 85 home) |
| 86 if [ "$HOST" != "gallifrey" ] ; then | |
| 87 echo "Not on gallifrey, no need for this" | |
| 88 return | |
| 89 fi | |
| 92 PROXY_HOST=${PROXY_HOST:-joshua.srhuston.net} | 90 PROXY_HOST=${PROXY_HOST:-joshua.srhuston.net} |
| 93 PROXY_PORT=${PROXY_PORT:-8889} | 91 PROXY_PORT=${PROXY_PORT:-8889} |
| 94 PROXY_PATH="/Volumes/Chrome-Personal" | 92 PROXY_PATH="/Volumes/Chrome-Personal" |
| 95 PROXY_UMOUNT="hdiutil detach -quiet ${PROXY_PATH}" | 93 PROXY_UMOUNT="hdiutil detach -quiet ${PROXY_PATH}" |
| 96 if [ ! -e ${PROXY_PATH}/.profile-exists ] ; then | 94 if [ ! -e ${PROXY_PATH}/.profile-exists ] ; then |
| 102 fi | 100 fi |
| 103 ;; | 101 ;; |
| 104 work) | 102 work) |
| 105 PROXY_HOST=${PROXY_HOST:-xanadu.astro.princeton.edu} | 103 PROXY_HOST=${PROXY_HOST:-xanadu.astro.princeton.edu} |
| 106 PROXY_PORT=${PROXY_PORT:-8888} | 104 PROXY_PORT=${PROXY_PORT:-8888} |
| 107 PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome" | 105 if [ "$HOST" == "gallifrey" ] ; then |
| 106 PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome" | |
| 107 else | |
| 108 PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome_Work" | |
| 109 fi | |
| 108 ;; | 110 ;; |
| 109 rc) | 111 rc) |
| 110 PROXY_HOST=${PROXY_HOST:-csesbh2.princeton.edu} | 112 PROXY_HOST=${PROXY_HOST:-csesbh2.princeton.edu} |
| 111 PROXY_PORT=${PROXY_PORT:-8887} | 113 PROXY_PORT=${PROXY_PORT:-8887} |
| 112 PROXY_PATH="/Users/huston/Library/Application Support/Google/Proxied_Chrome" | 114 PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome_RC" |
| 113 ;; | 115 ;; |
| 114 *) | 116 *) |
| 117 echo "Proxy needs one argument: home, work, or rc" | |
| 118 return | |
| 115 ;; | 119 ;; |
| 116 esac | 120 esac |
| 121 # In theory you need to have a job stay on the remote host for the | |
| 122 # forwarding to stay open. However if you're using persistent/shared | |
| 123 # connections then the port stays open anyway. We still need a command | |
| 124 # though, and 'hostname' returns quickly as well as giving a visual output | |
| 125 # that you connected to the right place. | |
| 117 ssh -D $PROXY_PORT -f -C -q $PROXY_HOST 'hostname' | 126 ssh -D $PROXY_PORT -f -C -q $PROXY_HOST 'hostname' |
| 118 ( | 127 ( |
| 119 /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ | 128 /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ |
| 120 --proxy-server="socks5://127.0.0.1:$PROXY_PORT" \ | 129 --proxy-server="socks5://127.0.0.1:$PROXY_PORT" \ |
| 121 --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" \ | 130 --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" \ |
