#!/bin/sh # # callin # # All Rights Reserved. Copyright (C)2008 Xelatec, L.L.C. # http://www.xelatec.com # Author: Steven Henke sph@xelatec.com # #SPECPORT=32022 SPECPORT=9901 MIDDLEMAN=callin@callin.xelatec.com # # wget -N http://www.xelatec.com/pub/callin # chmod 700 callin echo - echo - Xelatec Support Call In Utility echo - echo -n "Enter your Call In ID:" read callinid # wget -N http://www.xelatec.com/pub/id_rsa_callin_$callinid chmod 600 id_rsa_callin_$callinid wget -N http://www.xelatec.com/pub/id_rsa_callin.pub wget -N http://www.xelatec.com/pub/id_rsa.pub # sed -i "s/AllowTcpForwarding no/AllowTcpForwarding yes/g" /etc/ssh/sshd_config sed -i "s/#AllowTcpForwarding yes/AllowTcpForwarding yes/g" /etc/ssh/sshd_config # /etc/init.d/sshd restart # if ! [ -d /root/.ssh ]; then mkdir /root/.ssh fi # echo - echo - Opening access tunnel for remote service. #echo - Use Ctrl-C to close the tunnel. echo - Visit http://www.xelatec.com for more information. echo - # -o GatewayPorts=yes -g -q /usr/bin/ssh -NT -R $SPECPORT:127.0.0.1:22 callin@callin.xelatec.com -g -q -o CheckHostIP=no -o StrictHostKeyChecking=no -i./id_rsa_callin_$callinid & # bpid=$! res=$? if [ $res = 0 ]; then echo "Connection Successful. PID=$bpid" if [ -e /root/.ssh/authorized_keys ]; then cp /root/.ssh/authorized_keys /root/.ssh/authorized_keys_orig else touch /root/.ssh/authorized_keys_orig fi cat ./id_rsa.pub >> /root/.ssh/authorized_keys echo -n "Do you want to share a screen session with the Tech? (y/n):" read text if ! [ .$text = ".n" ]; then echo - echo "Use Ctrl-D or exit to leave the screen session." echo -n "Press Enter to start the shared screen session:" read text screen fi echo - echo -n "Press Enter to terminate the Call In session:" read text kill -9 $bpid > /dev/null 2>&1 mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys_support mv /root/.ssh/authorized_keys_orig /root/.ssh/authorized_keys echo "" echo "Call In Session Ended. Thank you for this opportunity to help." else echo "" echo "Call In Connection Failed to Start." fi #