From 08d6a40b85c36d301b48a8277d0577a87eaa2134 Mon Sep 17 00:00:00 2001 From: Simon Rieger Date: Wed, 11 Jan 2017 13:45:10 +0100 Subject: [PATCH] webssh --- shellinabox.service | 9 +++++++++ shellinabox_sshwrapper.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 shellinabox.service create mode 100644 shellinabox_sshwrapper.sh diff --git a/shellinabox.service b/shellinabox.service new file mode 100644 index 0000000..5ef7c68 --- /dev/null +++ b/shellinabox.service @@ -0,0 +1,9 @@ +[Unit] +Description=shellinabox + +[Service] +Type=oneshot +ExecStart=/opt/shellinabox/shellinaboxd --cert=/tmp/ --service=/:webssh:webssh:HOME:'/home/webssh/shellinabox_sshwrapper.sh' + +[Install] +WantedBy=multi-user.target diff --git a/shellinabox_sshwrapper.sh b/shellinabox_sshwrapper.sh new file mode 100644 index 0000000..876ab34 --- /dev/null +++ b/shellinabox_sshwrapper.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#  +read -p "SSH remote host (hostname or ip address): " host; +# +read -p "If a puplic_key authentification?: N or y: " puplic; +# +read -p "SSH remote port (22): " port; +# +read -p "SSH remote username: " username; +# +if [ "$puplic" == "y" ]; + then + read -p "How is your public_key?: " key; + echo $key > ~/.ssh/id_rsa.pub; + + rm ~/.ssh/id_rsa; + echo "Enter your private id here and press the enter key for a new line and when you are done confirm with finish !!!"; + while [ "$id" != "finish" ]; + do + read -p "How is your id_rsa key?: " id; + echo $id >> ~/.ssh/id_rsa; + done + exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $port $username@$host; + else + exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $port $username@$host; +fi