diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-02-15 14:08:17 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-02-15 14:08:17 +0000 |
commit | 8fa9d4540df65eec3963ecd8a2f90347384a6de7 (patch) | |
tree | beeb4c363dacf0683a684f9ecc06f92a47a9b42b /rtadm | |
parent | 07231d95d29670458200d05b9a48a840ac688bc3 (diff) |
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
Diffstat (limited to 'rtadm')
-rwxr-xr-x | rtadm | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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 <connection-name>" echo " # disconnect connection" + echo " upload <connection-name>" + echo " # upload a copy of the key" echo " delete <connection-name>" 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 |