I've got two things working, but I'd like to do a third thing: I'd like to use a remote Raspberry Pi (running Raspbian), which has a dynamic IP, as a SOCKS proxy for surfing. But I can only access this Rpi through a reverse tunnel.
So I have:
- my local desktop (behind a dynamic IP)
- a Raspberry Pi in another country (behind a dynamic IP)
- a dedicated server with a fixed IP
I've got full control of all these machines, but not of the routers in front of my local desktop and remote Raspberry Pi.
The following works fine:
ssh -D 5222 email@example.com -N firstname.lastname@example.org
This allows to surf using, say, Firefox or Chromium, as if I was surfing from my server at the IP aaa.bbb.ccc.ddd (all I need to do is configure SOCKS to use localhost with port 5222).
The following also works fine:
ssh -t email@example.com "ssh rspi@localhost -p 32402"
The Raspberry Pi use
autossh to always establish a reverse tunnel to the server with a fixed IP (in this case I know it's on port 32402: it tells me about which port it's using when the port changes so no issue there).
So with that "double ssh command" I can control my Rapsberry Pi from a terminal from my local desktop, by transiting through the server with a fixed IP.
So far so good. Now knowing that these two work fine, I'd like to know what's the magic incantation to allow me surf using the remote Raspberry Pi as a SOCKS proxy (keeping in mind I always know the port on which the Raspberry Pi establishes the reverse SSH tunnel on)?
Is there any modification/configuration I should do on either the remote Raspberry Pi or the dedicated server or is it just a matter of setting things up correctly from my local desktop?