1

I have an HTTP and HTTPS proxy at my work. Though when I work from home (on the laptop from work) I would like to disable the proxy settings (connect directly to the Internet). Then, when I come back to work, bring back the proxy settings.

The problem is, only a few application recognize the system-wide proxy settings (set using the Linux Mint's network manager and through HTTPS_PROXY and HTTP_PROXY environment variables). For many other applications (IntelliJ, SBT, Maven, Synaptic, apt-get, git) I had to set them manually and editing the settings for each of them every time is tedious.

I could probably write a script or something that would edit settings files of all those applications, but I think it's error-prone (I could corrupt the files) and not really the easiest solution. What I thought about is intercepting the outgoing packets sent to the proxy, repackaging them somehow and sending them directly to the Internet. Would it be possible to do that using an iptables rule or something similar? I'm not really an expert when it comes to networks, proxies, etc. so I'm not even sure if it's doable, not to mention constructing the rule myself. Would be grateful for your help!

migrated from serverfault.com Jun 10 '16 at 17:21

This question came from our site for system and network administrators.

3

You could install a proxy on your laptop and configure all your apps to use it (on localhost). Then you could change the local proxy's config to either use a parent proxy or not, depending on your location.

Tinyproxy is probably ideal for this task. Here's the description from the Debian package of it:

Package: tinyproxy
Version: 1.8.3-3+b1
Installed-Size: 145
Description-en: A lightweight, non-caching, optionally anonymizing HTTP proxy
 An anonymizing HTTP proxy which is very light on system resources,
 ideal for smaller networks and similar situations where other proxies
 (such as Squid) may be overkill and/or a security risk. Tinyproxy can
 also be configured to anonymize HTTP requests (allowing for exceptions
 on a per-header basis).

Homepage: https://banu.com/tinyproxy/

  • BTW, tinyproxy supports being configured as a transparent proxy, so you could even have iptables REDIRECT rules to force all http traffic through tinyproxy, whether the app is configured to use it or not. – cas Jun 11 '16 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.