summaryrefslogtreecommitdiff
path: root/create-invitation
diff options
context:
space:
mode:
Diffstat (limited to 'create-invitation')
-rwxr-xr-xcreate-invitation24
1 files changed, 24 insertions, 0 deletions
diff --git a/create-invitation b/create-invitation
new file mode 100755
index 0000000..c2a5faa
--- /dev/null
+++ b/create-invitation
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 <tunnel-port> <comment>" 1>&2
+ exit 1
+fi
+
+KEY=tmp/key
+TUNNEL_PORT=$1
+COMMENT=$2
+
+rm -rf tmp
+mkdir tmp
+ssh-keygen -q -t rsa -b 1024 -f tmp/key -N "" -C ra-$TUNNEL_PORT-$COMMENT-`date '+%Y%m%d%H%M%S'`
+sed -i 's|^|no-X11-forwarding,no-agent-forwarding,no-pty,permitopen="127.0.0.1:65534",command="~/bin/from-remote '$TUNNEL_PORT'" |' tmp/key.pub
+echo "post" > tmp/host
+echo "22" > tmp/port
+echo "alex" > tmp/user
+echo $TUNNEL_PORT > tmp/tunnelport
+tar -czf remote-access.tar.gz -C tmp host port user tunnelport key --owner root --group root
+echo "Run the following command to allow login with the newly-generated key." 1>&2
+echo "cat `realpath tmp/key.pub` >> ~/.ssh/authorized_keys"