Platinum Partner

Reverse SSH Tunnel

Create a Reverse SSH Tunnel back to you development application from a public facing server.

In config/tunnel.yml 


development:
  public_host_username: SSH_USERNAME
  public_host_password: SSH_PASSWORD
  public_host: SSH_SERVER_HOST_NAME
  public_port: 8868
  local_port: 3000




In lib/tasks/tunnel.rake


namespace :tunnel do
  desc "Start a ssh tunnel"
  task :start => :environment do
    SSH_TUNNEL = YAML.load_file("#{RAILS_ROOT}/config/tunnel.yml")[RAILS_ENV]
    
    public_host_username = SSH_TUNNEL['public_host_username']
    public_host = SSH_TUNNEL['public_host']
    public_port = SSH_TUNNEL['public_port']
    
    local_port = SSH_TUNNEL['local_port']
    
    puts "Starting tunnel #{public_host}:#{public_port} \
          to 0.0.0.0:#{local_port}"
    
    exec "ssh -nNT -g -R *:#{public_port}:0.0.0.0:#{local_port} \
                           #{public_host_username}@#{public_host}"
  end
end

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}