Aravind Prabhakar

Systems Engineer | Networking | Security | PreSales | Cloud | Devops | AIOps

View on GitHub Linkedin Blogs Tags
15 January 2022

Proxy apt connections from ubuntu server/vm to your macbook

By Aravind

Proxy HTTP and HTTPS Connections

sometimes you may want to proxy connections from your ubuntu server to another machine. lets say you want to proxy connections from a device (a server in your lab) to your laptop so that apt-packages can resolve. one can do that by installing squidman on MAC to run it as a proxy server. follow the below steps to try it out!

Proxy the connections from ubuntu server on VPN

Install Squidman to run MAC as a proxy server . you can download from here

Export env variables to proxy http and https connections to the laptop/new proxy server

Ensure, the client device (lab server) can reach the proxy server IP (your VPN interface or your wired/wireless interface in case of no VPN) and export the ENV variables.

HTTPS_PROXY="http://<IP>:<PORT>"
HTTP_PROXY="http://<IP>:<PORT>"

Here the IP is w.x.y.z which is the IP we retrieved earlier and PORT is 8080 which is the default port used in squidman

Edit apt configs

Edit/add the apt.conf to reflect the changes.

Note: In case the configs dont exist, create the file

root@ubuntu:/ more /etc/apt/apt.conf
Acquire::socks::proxy "socks5://w.x.y.z:8080";

Note that w.x.y.z is the interface IP (VPN or wired/wireless) of the proxy server.

Once the above is done, try doing a apt update or apt install <PACKAGE NAME> to see if every http/https request for apt is proxyd though your new proxy server

[ linux  ] tags: linux