Ssh – apt-get maddeningly doesn’t work with tsocks proxy set up with ssh

aptssh

I have a machine that cannot access the internet, yet can connect to a machine that does. I don't want to use a proxy server, I've been told that I can just use ssh. So I've proceeded simply by

ssh -D 1080 me@xxx.xx.xx.xx

I've confirmed that this works by doing

curl -v --socks5-hostname localhost:1080 http://google.com

This command returns expected HTML so it must be working.

I have changed my /etc/tsocks.conf to simply read:

server = 127.0.0.1
server_port = 1080

However, apt-get is having none of it;

# tsocks apt-get update
Err http://security.debian.org wheezy/updates Release.gpg
Could not resolve 'security.debian.org'
etc

My /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

I've been googling for a while, I tried adding the following to /etc/apt/apt.conf

Acquire::http::Proxy "http://localhost:1080/";

and not using tsocks at all, (I've tried it both ways), this makes it fail even faster.

I'm out of ideas, this should really work but doesn't. Any help?

Best Answer

The problem was with DNS.

Apparently, tsocks can't or won't resolve domain names.

I added to /etc/hosts the IP addresses of each of the domain names apt-get was trying to look for and tsocks magically worked.