![]() ![]() Remote port forwarding helps in situations when you have compromised a box that has a service running on a port bound to 127.0.0.1, but you want to access that service from outside. (I know I can use xdebug.remote_host to connect directly to my local machine's public IP, but I wanted to use tunneling so I can work at the office or at home under two different IPs)īut that only half worked (the -L tunnel worked, but the -R didn't). The above indeed shows that we got a reverse shell from 10.0.0.12 and the local tunnel worked. Therefore I use a reverse ssh tunneling like this ssh -R 9000:localhost:9000 officeīut that means I need to have 2 terminals open and I tried to combine the two commands into one like this ssh -L 5433:db:5432 -R 9000:localhost:9000 office I also use Xdebug for PHP debugging so my local machine is listening on port 9000. ![]() (And db is the resolved hostname of the database server on the office network) that makes it easier to define a reverse ssh port forwarding tunnel from the target server to the jump host. (I use port 5433 since I already have a local Postgres database installed on my machine) For establishing ssh tunnels, I always created a mostly non-priviledged tunnel user (without login shell), having a home directory, outside of the /home tree of. Reverse SSH tunneling works by forwarding traffic to a specific port on the local machine, which then forwards it back through an encrypted SSH tunnel. The public key /.ssh/keyrsa. Open new Port in SSH Server -> Other port. To connect to a remote office Postgres database, I need to SSH to the office server then jump to the office database, so I use ssh tunneling like this ssh -L 5433:db:5432 office It is recommended to use an SSH key for authentication, a key pair can be created as follows: ssh-keygen -f /.ssh/keyrsa -t rsa -b 4096. ssh/config to store my office's network: Host office ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |