Is the IP address the same when logging in via SSH in GCP VM instance through the browser?

I have a VM instance on Google Cloud Platform running on a OpenLiteSpeed web server with a WordPress installation, the OS would be Ubuntu Server 20.04.

Generally, I login via the browser console. However since this can be done from any machine with access to my Google Account, I figured that I would like to set additional protection, therefore I executed the following two commands in the terminal:

sudo ufw deny 22
sudo ufw allow from [my_ip_here] proto tcp to any port 22

When I restarted the SSH browser terminal, the access was refused with a status code 4003, as if the IP I am logging in is not the same, which would not be the case.

In this scenario, am I doing something wrong, am I missing something or the methodology used to connect is different?

Generally, if I don't setup any SSH keys, would the security be enough so that only I can login to the connection via the browser only?


Solution 1:

If I'm understanding correctly, you want to be able to use browser SSH from your machine but disable it for everyone else.
Traffic for SSH from the browser doesn't come from your IP, take a look here and note the last point about IP addresses. It's either globally enabled or globally disabled.
If you need a restricted GUI logon then xrdp might work, assuming your VM has a GUI installed.