From 24bbb7371c52aa93d676104b36c35be87ef5c8b6 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Sun, 3 Oct 2010 21:34:07 +0000 Subject: place files under $HOME/.rapid-tunneling Switch to using $HOME/.rapid-tunneling as the base directory for files we need to keep (instead of simply using $HOME). git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@8399 283159da-0705-0410-b60c-f2062b4bb6ad --- rapid-tunneling | 8 +++++--- rapid-tunneling-status | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rapid-tunneling b/rapid-tunneling index cf1b277..8146948 100755 --- a/rapid-tunneling +++ b/rapid-tunneling @@ -9,6 +9,7 @@ fi if [ -r /etc/rapid-tunneling/client ]; then . /etc/rapid-tunneling/client; fi +base_dir="$HOME/.rapid-tunneling" tmpdir=`mktemp -d rapid-tunneling.XXXXXX` mkdir $tmpdir/recv $tmpdir/send tar xzf "$1" -C $tmpdir/recv @@ -20,8 +21,9 @@ tunnelport=`cat $tmpdir/recv/tunnelport` ssh-keygen -q -t rsa -C rapid-tunneling -N "" -f $tmpdir/send/key # public will be in key.pub cp $tmpdir/recv/key $tmpdir/send/origkey -cp $tmpdir/recv/key $HOME/key -tar czf $HOME/ra-params.tar.gz -C $tmpdir/send key origkey +mkdir -p $base_dir +cp $tmpdir/recv/key $base_dir/key +tar czf $base_dir/ra-params.tar.gz -C $tmpdir/send key origkey mkdir -p -m 700 $HOME/.ssh awk '$NF != "rapid-tunneling" {print}' $HOME/.ssh/authorized_keys > $HOME/.ssh/authorized_keys.new 2>/dev/null || true @@ -38,4 +40,4 @@ else SSD="/sbin/busybox start-stop-daemon" fi -$SSD -S -b -m -p $HOME/pid -x /bin/sh -- -c "exec ssh -o 'StrictHostKeyChecking no' -o 'BatchMode yes' -o 'ServerAliveInterval 60' -T -p $port -i $HOME/key -R $tunnelport:127.0.0.1:22 -l $user $host < $HOME/ra-params.tar.gz" +$SSD -S -b -m -p $base_dir/pid -x /bin/sh -- -c "exec ssh -o 'StrictHostKeyChecking no' -o 'BatchMode yes' -o 'ServerAliveInterval 60' -T -p $port -i $base_dir/key -R $tunnelport:127.0.0.1:22 -l $user $host < $base_dir/ra-params.tar.gz" diff --git a/rapid-tunneling-status b/rapid-tunneling-status index e270ea1..8040616 100755 --- a/rapid-tunneling-status +++ b/rapid-tunneling-status @@ -1,5 +1,7 @@ #!/bin/sh +base_dir="$HOME/.rapid-tunneling" + if [ "$1" = "--help" ]; then echo "Usage: $0 [-p] []" 1>&2 echo " -p: Print only pid of SSH process (if connecting or connected)." 1>&2 @@ -18,7 +20,7 @@ elif [ "$1" = "-s" ]; then shift fi pidfile="$1" -[ -z "$pidfile" ] && pidfile="$HOME/pid" +[ -z "$pidfile" ] && pidfile="$base_dir/pid" connected() { -- cgit v1.2.3