LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   ssh tunnel (https://www.linuxquestions.org/questions/linux-security-4/ssh-tunnel-4175535617/)

Paul! 03-03-2015 06:52 AM

ssh tunnel
 
Essentially I want to set up a VPN. There is a lot of information online, which tends to get vague when I need hard details.

So, this is what I want to do.

On my remote computer I want to tunnel to my server, which then transfers to the internet - I'm only interested in http traffic here. In other words, on my browser, on the remote machine, if I attempt to connect to linuxquestions.org, this will be transferred to my server which will transfer the information. In the same way as a 'proper' VPN, the request will appear to have come from the server. I think many of the examples out there are of secure connections to the server itself, and not onwards to the net. I don't just want to connect to a single site - another common example out there, but to have total freedom.

One complication, I would prefer to connect to port 3128, rather than port 80, in order to use the squid cache.

Some articles suggest local tunneling and others dynamic.

Cheers
Paul

Paul! 03-03-2015 06:53 AM

Sorry I'd better add that ssh is up and working.

sundialsvcs 03-03-2015 07:40 AM

(Shrug ...) What I'd do, instead, is to just "set up a VPN." :)

Yes, you can tunnel using ssh. But then, you always have to "think about it." Always have to make sure that what you're sending is really going through that tunnel. Always have to be sure that your apps know how to do it, and that they do "do it" properly.

With VPN, you have none of these concerns: certain ranges of IP-addresses and port-numbers go through the tunnel, automagically. You can forget that the tunnel is there.

agentbuzz 03-03-2015 08:35 AM

SSH tunnel to your server
 
Paul,
The command to tunnel browser traffic to your server is this:

Code:

[user ~]$ ssh -D 8080 yourusername@server.atyourhome.com
Then you have to go into your browser's proxy settings. In Firefox, you'd bullet "Manual proxy configuration", for "SOCKS Host", you'd type "localhost", port 8080, and bullet SOCKS v5. You can send your DNS queries through the tunnel, as well, by using the instruction in this article. She also has instructions in that article for tunneling to a squid.

Paul! 03-03-2015 10:11 AM

Thanks for that, is there anything I need to do at the server end? Other than the normal ssh stuff?

Paul! 03-03-2015 10:26 AM

That's a really useful site, and I hadn't seen it before. Thanks very much - now to find out what all those switches do to ssh!

agentbuzz 03-03-2015 10:38 AM

Don't know what your normal ssh stuff is, but consider doing this:

Code:

vi /etc/ssh/sshd_config
Find this section and ensure that PermitRootLogin is set to no:

Code:

#LoginGraceTime 2m
PermitRootLogin no
StrictModes yes
MaxAuthTries 3
#MaxSessions 10
AllowUsers user1 user2

Then, either...
Code:

/etc/init.d/sshd restart
Code:

service sshd restart


All times are GMT -5. The time now is 06:57 AM.