I want to add SOCKS proxy settings to /etc/apt/apt.conf. What is the syntax for it? Is it same as http and ftp syntax?
Thanks.
I want to add SOCKS proxy settings to /etc/apt/apt.conf. What is the syntax for it? Is it same as http and ftp syntax?
Thanks.
This works for me on Ubuntu 18.04. As the man page says, socks5h, not socks5, is supported by apt, which means socks5 proxy with DNS resolving ability.
A possible solution can be to use
tsocks
, an application that can redirect the network traffic through a socks proxy. Installtsocks
package, modify/etc/tsocks.conf
to set address and port number of your socks proxy, and run:or
You can think to a number of options, to simplify and automate its use.
Don't forget the leading dot, the Manpage has more deatails on this.
Edit: a shorter way to use it:
Using the next config line works for me:
To keep
apt.conf
clean and avoid problems at Linux upgrade I created a new file (/etc/apt/apt.conf.d/12proxy
) and added the config file to it.I couldn't find anything on Acquire::socks::proxy in the apt.conf manual of Ubuntu Xenial. You could fix this by running a local http proxy that supports upstream socks proxy, for example Polipo. You need to configure Polipo as follows:
and then set the http proxy in your apt.conf file:
Or tou can put in your /etc/apt/apt.conf something like this:
In Debian, you can read the manpage
apt-transport-http(1)
and look for supported URI schemes. As was answered before, putin
You can read more about the APT-config in general in
apt.conf(5)
and read the examples in/usr/share/doc/apt/examples/configure-index.gz
mentioned at the end of the manpage.This can be combined with
ssh -D <LOCAL PORT> <USER>@<HOST>
to create a SOCKS proxy to a different system so that apt can then use the proxy as if everything originated on<HOST>
.If you use
ssh -D 0.0.0.0:<LOCAL PORT> <USER>@<HOST>
orssh -D [::]:<LOCAL PORT> <USER>@<HOST>
(for IPv6) to enable other systems to use the SOCKS proxy on all interfaces. This can be a security risk or breach of (corporate) policy. Make sure you know what you are doing.