I am assuming your connection is clear, from localhost
to $VPS:4000
.
To make an SSH tunnel, you will open a port in localhost
that will tunnel the traffic to the port 4000 on the server $VPS
.
The following command-line does that:
ssh -L9000:localhost:4000 user@$VPS
where 9000 is the local port I chose.
Then, you have to change your application to no longer connect to $VPS:4000
but to connect instead to localhost:9000
.
This works by connecting to user@$VPS
, and then creating a secure connection between localhost:9000
on the local host and localhost:4000
on the remote host.
This way, the encryption is transparent to you, and you don't have to fall on the caveat of trying to implement any encryption algorithm. Or worse - make your own.
You do have to make sure the SSH connection is always available when you need it. It might be useful to use public key authentication, in case you aren't familiar with it :)
Rewrite the apps to encrypt and decrypt the data on send/receive. – Ƭᴇcʜιᴇ007 – 2014-07-14T20:11:05.000
If you are connected to a VPS over a secure connection its already being transmitted in a secure fashion on your end. You would have to modify the program to use https if you wanted both ends to be secure. – Ramhound – 2014-07-14T21:58:42.830