Proxy-auto-discovery for command-line applications
Branch: master
Clone or download
tkluck Merge pull request #62 from tkluck/tkluck/fix-import-reactor
Fix merge conflict resulting in missing import
Latest commit 0f00a95 Feb 11, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
archlinux Create a Docker container with systemd Aug 16, 2018
bin Put all modules under a parent module pac4cli, and use setuptools to … Aug 11, 2018
launchd launchd.plist: use http://host:port/ format for proxy environment var… Oct 30, 2017
pac4cli Don't import reactor globally, get from WPAD object Feb 11, 2019
test Fixing PEP-8 and Flake8 linter messages Nov 12, 2018
.gitignore Add ctag tags file to .gitignore Oct 21, 2018
.gitmodules Add pacparser dependency as a submodule May 22, 2017
Makefile Add instructions for Apt to the readme Aug 11, 2018
pac4cli.config make install target installs the new modules and sample config file Jul 5, 2017
pac4cli.service systemd: make READY notifications work Nov 13, 2018 Revert resovling domain names Nov 12, 2018
requirements-check.txt Don't install `make check` requirements by default Jul 25, 2018
requirements.txt Making sure we don't try to install dbus-python on OSX. This fixes #27 Jul 27, 2018 Properly package app for archlinux Jun 9, 2017

Proxy-auto-discovery for command line applications (pac4cli)



On many corporate networks, applications need proxy-auto-discovery to know whether a certain URL is accessed either directly or through a web proxy. Browsers can typically handle this, but many command line applications (git, npm, apt, curl) rely on environment variable to hard-code a proxy regardless of the destination URL.

This little daemon enables these applications for auto-discovery by:

  • setting the http_proxy variable (and friends) to http://localhost:3128
  • providing a simple proxy at that port that does proxy-auto-discovery and connects accordingly.

System dependencies:

  • systemd
  • NetworkManager

Python library dependencies from PyPI can be installed through:

sudo pip3 install -r requirements.txt

Installation instructions


The latest builds are available through a PPA:

sudo add-apt-repository ppa:tkluck/pac4cli
sudo apt update
sudo apt install pac4cli

You'll need to restart your shell for the new environment variables to take effect.

This will install pac4cli for most of your command line tools. However, we don't ship configuration for Apt. If you want to use pac4cli for software updates, you'll need to run the following:

sudo tee /etc/apt/apt.conf.d/99pac4cli <<CONFIG
Acquire::http::proxy "http://localhost:3128/";
Acquire::https::proxy "http://localhost:3128/";
# The following are needed to work around limitations
# in pac4cli's support of http features:
Acquire::http::No-Cache true;
Acquire::http::Pipeline-Depth 0;

The reason why this is not included in the Ubuntu package is that if pac4cli ever breaks, we could not ship an update to unbreak it.


This package is available in AUR.

Other (Mac, other linuxes)

The dependencies can be installed through

pip3 install -r requirements.txt

Then, use

make install

Just python install is not sufficient. That will only install the pac4cli module, but not the binary or the configuration files.