From 8fa9d4540df65eec3963ecd8a2f90347384a6de7 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 15 Feb 2012 14:08:17 +0000 Subject: rtadm: integrate "upload" 'upload' is now a subcommand of rtadm git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@10398 283159da-0705-0410-b60c-f2062b4bb6ad --- rtadm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'rtadm') diff --git a/rtadm b/rtadm index dd16cb7..e161e48 100755 --- a/rtadm +++ b/rtadm @@ -2,6 +2,7 @@ USERNAME=support FROM_REMOTE_COMMAND=/usr/share/rapid-tunneling/bin/rt-from-remote +UPLOAD_TARGET="xorcom@updates.xorcom.com" CFG_FILE=/etc/rapid-tunneling/rtadm @@ -70,6 +71,18 @@ disable() sed -i "s|.*ra-[0-9]\+-$comment-[0-9]\+\$|#DISABLED#&|" ~/.ssh/authorized_keys } +upload() +{ + comment="$1" + tarball="$HOME/tar/remote-access-$comment.tar.gz" + if [ ! -r "$tarball" ]; then + echo >&2 "Tarball for $comment ($tarball) missing. Not uploading." + exit 1 + fi + cat "$tarball" | ssh -T $UPLOAD_TARGET \ + | tee -a "$HOME/upload.log" +} + delete() { comment="$1" @@ -123,6 +136,8 @@ usage() echo " # enable/disable future connections" echo " disconnect " echo " # disconnect connection" + echo " upload " + echo " # upload a copy of the key" echo " delete " echo " # disconnect, disable and delete any trace of the connection" exit 1 @@ -159,6 +174,11 @@ case "$1" in [ -z "$1" -o -n "$2" ] && usage disconnect "$1" ;; + upload) + shift + [ -z "$1" -o -n "$2" ] && usage + upload "$1" + ;; delete) shift [ -z "$1" -o -n "$2" ] && usage -- cgit v1.2.3