Sunday, October 15, 2017

HACKING NATO SERVERS Connecting to a RDS Server from a Local Computer Using SSH Tunneling on a Mac

Connecting to a RDS Server from a Local Computer Using SSH Tunneling on a Mac


Solution

If you scour the internet there appear to two main solutions.
  1. Add your IP address to a whitelist on rds, but could be problematic since your IP address will probably change.
  2. Connect to the RDS instance using SSH tunneling.
I had not set up SSH tunneling before and for some reason had a hard time tracking it down. I use sequl pro to inspect our database sometimes, and I realize I was able to connect using SSH tunneling via their gui interface.
So, what is the solution?
There are two steps:
  1. Set up the SSH Tunnel
ssh -N -L 3306:your.rds.endpoint.rds.amazonaws.com:3306 sshuser@yourserver.com
 -N   
only set up the tunnel
 -L   
set up the forwarding
 3306
that first number is the port on your local machine
your.rds.endpoint.amazonaws.com
The name of the rds endpoing
3306
the port on the remote computer
sshuser@yourserver.com
how you log in to your ec2 instance
2. Use the SSH Tunnel
mysql -u dbuser -p -h 127.0.0.1
This lets you connect to the remote rds instance. Note that you have to use the host here 127.0.0.1 explicitly and that it is not the host you set up earlier. This is because it is now forwarding all of the requests. That’s all.
To be clear on how the ports work, here is another example
ssh -N -L 1234:your.rds.endpoint.rds.amazonaws.com:3306 sshuser@yourserver.com
mysql -u dbuser -p -h 127.0.0.1 -P 1234
This says forward from port 1234 on my computer to port 3306 on the remote instance. I just used 3306 in both as the defaults.

No comments:

Portugal politics Intel ( Caso Gémeas) provas ( BACK2WAR Intelligence deliever to Russia part (excerpt) of the content of the son's email that proves Marcelo RSousa's favor in the "Case of the Twins" IT WILL HV A PRICE)

  https://www.cmjornal.pt/sociedade/detalhe/emails-comprovam-pedidos-de-nuno-rebelo-de-sousa-a-marcelo-no-caso-das-gemeas-luso-brasileiras