Skip to content

Instantly share code, notes, and snippets.

@pangyuteng
Forked from guillochon/ssh-airplane-wifi.md
Last active October 20, 2019 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pangyuteng/b8501304389584a067dddb5b84642c4f to your computer and use it in GitHub Desktop.
Save pangyuteng/b8501304389584a067dddb5b84642c4f to your computer and use it in GitHub Desktop.
Instructions on how to SSH on airplane WiFi that blocks port 22

Using SSH through airplane WiFi that blocks port 22 (via GCP and Ubuntu)

SUMMARY

Open WIFI often allow only traffic via http and https ports. This gist contains steps to allow you to ssh to a machine by first creating a VM, switching the ssh port to listen to port 80. So now, you can ssh (port 80) into the VM, in order to ssh (port 22) into your desired machine.

original gist by guillochon, this Fork contains reformatted steps, and I switched OS from CentOs to Ubuntu... just as an exercise to get famaliarized with GCP.

https://gist.github.com/guillochon/eeaa54b328952d260472c14c559f698a

Estimated time to complete the below steps is 5 to 10 minutes (assuming the internet connection is good, and GCP is operating smoothly).
STEPS
  • goto to GCP console.cloud.google.com

  • in GCP, select an existing project or create a project ssh-via-https

  • create VM via - Navigation Menu (top-left corner) --> Compute Engine --> VM instance, then click Create button.

  • in Create an instance page, configure the below.

    name (whatever you want): ssh-https-instance
    
    Machine configuration:
    
      Machine family: General-purpose
      Generation: First (???)
      Machine type: f1-micro (1 vCPU, 614 MB memory)
      
    Boot disk:
    
      OS images: Ubuntu 18.04 LTS Minimal
      Boot disk type: Standard persistent disk
      Size: 10GB
      
    Identity and API access: 
      just leave as is... (???)
      
    Firewall
    
      Allow HTTP traffic: CHECK!
      Allow HTTPS traffic: CHECK!
      
    
  • in Create an instance page, hit Create button.

  • in Compute Engine, VM instances page, you should see the created VM being prepared.

  • once VM is ready - there will be a green check icon, prepended in front of VM name. The pubic IP is now displayed in the External IP column.

  • click the SSH drop down (column Connect), and select Open in browser window.

  • in "browser-terminal", try to ssh in to your machine. If you can't ssh into the machine, then you are out of luck... please GOTO last step of this gist.

  • continue with the below if you want to use your computer's terminal.

  • in Compute Engine, VM instances page, click the VM name and verify Allow HTTP traffic and Allow HTTPS traffic is checked in Firewall section.

  • in your computer terminal, get public key ready.

    cat ~/.ssh/id_rsa.pub
    
  • in the "browser-terminal"

    • configure SSH to listen to port 80
    sudo echo "Port 80" >> /etc/ssh/sshd_config
    
    • add in your computer's public key to authorized_keys.
    echo "$MY_COMPUTER_PUBLIC_KEY" >> ~/.ssh/authorized_keys
    
    • restart SSH service
    sudo service ssh restart
    
  • in computer terminal, try to ssh to the Public IP of the newly created GCP VM instance with port 80.

    ssh $VM_PUBLIC_IP -p 80
    
  • fix whatever you need to fix, and remember to reimburse your airplane wifi fee.

  • shutdown/terminate VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment