Last active
June 17, 2018 16:42
-
-
Save mborodov/59174597af9a07561272e98b16f5c74b to your computer and use it in GitHub Desktop.
Script for install OpenSSH Server and Ngrok tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
YELLOW='\033[0;33m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color | |
# Install OpenSSH Server and Ngrok tool | |
printf "${GREEN}Install OpenSSH Server${NC}\n" | |
yum install -y openssh-server | |
# Generate certs | |
printf "${GREEN}Generate server certs${NC}\n" | |
yes y |ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key | |
yes y |ssh-keygen -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key | |
yes y |ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_ecdsa_key | |
yes y |ssh-keygen -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key | |
# Run sshd server | |
printf "${GREEN}Run sshd server${NC}\n" | |
/usr/sbin/sshd -f /etc/ssh/sshd_config -E /tmp/sshd.log | |
# Create authorized_keys file | |
touch /root/.ssh/authorized_keys | |
printf "${GREEN}Installing Ngrok${NC}\n" | |
yum install -y unzip | |
cd /tmp | |
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip | |
unzip ngrok-stable-linux-amd64.zip | |
mv ngrok /usr/bin/ | |
printf "${GREEN}Next Steps:${NC}\n" | |
printf "${YELLOW}1. Add key in authorized_keys with 'echo YOUR_PUBLIC_SSH_KEY >> ~/.ssh/authorized_keys'${NC}\n" | |
printf "${YELLOW}2. Auth in Ngrok with 'ngrok authtoken YOUR_TOKEN_HERE'${NC}\n" | |
printf "${YELLOW}3. Run tunnel Ngrok with 'ngrok tcp 22'${NC}\n" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment