Tunnel YUM traffic through an SSH proxy connection

My work environment has heavily restricted access to the outside from any of our machines.  I am often spinning up new Linux machines for testing purposes and getting temporary firewall access to a specific IP is a process I do not enjoy.  As a work around, I have tunneled my YUM updates and Repos through machines that do have Repo access.

From the  machine with restricted access edit your /etc/yum.conf file adding the following line.  xxxx = the unused high port of your choice.

proxy=socks5h://localhost:xxxx

From a separate terminal type the following at the prompt.

ssh -ND xxxx username@server-with-access

This will leave you with what appears to be a hung session with an unresponsive prompt.  a simple Ctrl-c will kill the tunnel.  As long as the session is live, you can run your yum update from a separate session.

jhudgins has written 34 articles

Leave a Reply