Search code examples
sshamazon-web-servicesstunnel

ssh into aws EC2 instance when ssh is blocked by admin


I have a new aws EC2 instance, everything worked fine from home. Now the ssh access is blocked in university! I wanted to know how I can bypass that and ssh into my ec2 instance. What ways i can do it? Also, How can I use stunnel to do this? A short explanation is appreciated along with the solution.


Solution

  • I would try the following:

    • Move the SSH listener on the EC2 instance to a port other than 22/tcp, like 2222/tcp. They may just be blocking that specified port number on the firewall.
    • If they're using deep packet inspection, moving the port won't help as the firewall will still detect an SSH handshake and block it. In that case you'll need an stunnel-style solution to encrypt the handshake itself.

    If they are using deep packet inspection I would recommend following these instructions: http://www.terranpro.org/Tunnel%20SSH%20over%20SSL%20or%20HTTPS.html

    An stunnel solution has a lot of moving parts:

    • RSA key generation (using openssl)
    • Stunnel server configuration (on EC2 side)
    • Proxytunnel installation (on SSH client)

    Plus you're also double-encrypting everything, so performance will suffer. Best of luck!