changeset 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
files .bash_aliases
diffstat 1 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.bash_aliases	Tue Nov 24 17:33:55 2020 -0500
+++ b/.bash_aliases	Wed Nov 25 14:54:48 2020 -0500
@@ -79,16 +79,14 @@
 }
 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() {
   case $1 in
     home)
+      if [ "$HOST" != "gallifrey" ] ; then
+        echo "Not on gallifrey, no need for this"
+        return
+      fi
       PROXY_HOST=${PROXY_HOST:-joshua.srhuston.net}
       PROXY_PORT=${PROXY_PORT:-8889}
       PROXY_PATH="/Volumes/Chrome-Personal"
@@ -104,16 +102,27 @@
     work)
       PROXY_HOST=${PROXY_HOST:-xanadu.astro.princeton.edu}
       PROXY_PORT=${PROXY_PORT:-8888}
-      PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome"
+      if [ "$HOST" == "gallifrey" ] ; then
+        PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome"
+      else
+        PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome_Work"
+      fi
       ;;
     rc)
       PROXY_HOST=${PROXY_HOST:-csesbh2.princeton.edu}
       PROXY_PORT=${PROXY_PORT:-8887}
-      PROXY_PATH="/Users/huston/Library/Application Support/Google/Proxied_Chrome"
+      PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome_RC"
       ;;
     *)
+      echo "Proxy needs one argument: home, work, or rc"
+      return
       ;;
   esac
+  # In theory you need to have a job stay on the remote host for the
+  # forwarding to stay open.  However if you're using persistent/shared
+  # connections then the port stays open anyway.  We still need a command
+  # though, and 'hostname' returns quickly as well as giving a visual output
+  # that you connected to the right place.
   ssh -D $PROXY_PORT -f -C -q $PROXY_HOST 'hostname'
   (
     /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \