ssh into aws EC2 instance when ssh is blocked by admin
-
31-05-2021 - |
문제
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.
해결책
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!
다른 팁
The port 22 which is used for SSH must be blocked. You need to take permission from university admin to open it on you machine.