summaryrefslogtreecommitdiff
path: root/rtadm
diff options
context:
space:
mode:
Diffstat (limited to 'rtadm')
-rwxr-xr-xrtadm20
1 files changed, 20 insertions, 0 deletions
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 <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