How to Secure Tunnels to Localhost

Install Golang 1.4

  1. tar -C /usr/local -xzf go1.4.3.linux-amd64.tar.gz 
  2. mkdir $HOME/go
  3. echo 'export GOROOT=/usr/local/go'>> ~/.bashrc
  4. echo 'export GOPATH=$HOME/go'>> ~/.bashrc 
  5. echo 'export PATH=$PATH:$GOROOT/bin'>> ~/.bashrc 
  6. source /root/.bashrc

Install Git

  1. yum install mercurial git bzr subversion -y

Install Ngrok

  1. cd /usr/local/src/
  2. git clone https://github.com/inconshreveable/ngrok.git

Generate CERT

  1. export NGROK_DOMAIN="qinuu.com"
  2.  
  3. cd ngrok/
  4. openssl genrsa -out rootCA.key 2048
  5. openssl req -x509 -new -nodes -key rootCA.key -subj "/CN=$NGROK_DOMAIN" -days 5000 -out rootCA.pem
  6. openssl genrsa -out device.key 2048
  7. openssl req -new -key device.key -subj "/CN=$NGROK_DOMAIN" -out device.csr
  8. openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 5000
  9.  
  10. cp rootCA.pem assets/client/tls/ngrokroot.crt
  11. cp device.crt assets/server/tls/snakeoil.crt
  12. cp device.key assets/server/tls/snakeoil.key

Make Linux Server

  1. GOOS=linux GOARCH=amd64
  2. make release-server release-client

Make Windows Client

  1. cd /usr/local/go/src
  2. GOOS=windows GOARCH=amd64 CGO_ENABLED=0 ./make.bash
  3. cd  /usr/local/src/ngrok/
  4. GOOS=windows GOARCH=amd64 make release-server release-client

Start Ngrok Service

  1. nohup bin/ngrokd -domain="qinuu.com" -httpAddr=":8080" -httpsAddr=":8443" &

Download Windows Client

  1. ls -al bin/windows_amd64/

Configure CLient CFG File

Start Windows Client

Leave a Reply

Your email address will not be published. Required fields are marked *