CHAMELEONSOCKS provides containerized system-wide redsocks-based TCP redirector to generic SOCKS or HTTP proxies. There is a script to aid in the initial setup. This script pulls a tar.gz and loads it as a docker image. It then creates a persistent container that includes your specific proxy/exception information and that persistent container is what is run to provide redirection. Note: This requires root access since the containers need to be run in privileged mode.
NOTE: You will need Internet connectivity to run the installer/upgrade script
https_proxy=https://myproxy.mycomp.com:<port> wget https://raw.githubusercontent.com/mcastelino/chameleonsocks/master/chameleonsocks.sh && chmod 755 chameleonsocks.sh
https_proxy=https://myproxy.mycomp.com:<port> PROXY=mysocksproxy.mycomp.com PORT=<socksproxyport> PAC_URL=http://wpad.mycomp.com/wpad.dat ./chameleonsocks.sh --install
Install Docker by following the official instructions for your distribution
https://docs.docker.com/engine/installation/#on-linux
- Set https_proxy environment variable so you can download the installer
export https_proxy=https://my.proxy.com:port_number
- Execute the following command to download the script and to make it executable
wget https://raw.githubusercontent.com/mcastelino/chameleonsocks/master/chameleonsocks.sh && chmod 755 chameleonsocks.sh
-
**Open chameleonsocks.sh in your favourite text editor and enter your proxy server (PROXY), proxy server port (PORT) and proxy server type (PROXY_TYPE). supported PROXY_TYPE values are: socks4, socks5, http-connect, http-relay **
Example:
PROXY=my.proxy.com
PORT=1080
PROXY_TYPE=socks5NOTE: The installer provides the following proxy exception rules by default. Requests sent to the following subnets will not be redirected to the proxy.
0.0.0.0/8
127.0.0.0/8
169.254.0.0/16
224.0.0.0/4
240.0.0.0/4
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16**Chameleonsocks provides support for standard PAC or WPAD (Web Proxy Auto Discovery) files. Set the PAC_URL variable in chameleonsocks.sh to the URL of your PAC file or WPAD file and the subnet exceptions from the PAC file will be extracted and applied to the chameleonsocks ruleset. Note: ONLY exceptions will be pulled from the PAC_URL file, not the proxy itself. **
Example:
PAC_URL=http://my.pacfile-server.com
-or-
PAC_URL=http://my.wpad-server.com/wpad.dat -
To add your own proxy exception rules, please append your subnets or individual ip addresses to the default exceptions file and add its absolute path to the EXCEPTIONS variable in chameleonsocks.sh.
The default execeptions file can be found here: https://github.com/mcastelino/chameleonsocks/blob/master/confs/chameleonsocks.exceptions
Example:
EXCEPTIONS=/path/to/my/exceptions/chameleonsocks.exceptions
./chameleonsocks.sh --install
OR
./chameleonsocks.sh --upgrade
-
By using the chameleonsocks.sh script from the command line
Start chameleonsocks
./chameleonsocks.sh --start
Stop chameleonsocks
./chameleonsocks.sh --stop
-
By using the Docker UI interface
Install Docker UI
./chameleonsocks.sh --install-ui
Open the following URL in your web browser
http://localhost:7777
Click the "containers" tab -> Select the "chameleonsocks" container -> Start/Stop the container to enable/disable the proxy
Uninstall Docker UI
./chameleonsocks.sh --uninstall-ui
./chameleonsocks.sh --version
./chameleonsocks.sh --uninstall
-
Download the installer script with your favourte web browser
-
Download the chameleonsocks image with your favourte web browser
-
Launch Docker Quickstart Terminal and navige to the directory where the installer and the image were downloaded
-
Install chameleonsocks with the following command
./chameleonsocks.sh --install_local chameleonsocks-1.2.tar.gz
If you want to try different combinations because your proxy got moved
or because you discover that the XXX proxy is much faster for you,
you can quickly do the following:
To get the initial image (where myproxy.com:8080 is your https proxy):
https_proxy=https://myproxy.com:8080 ./chameleonsocks.sh --install
You can tell if you have the initial docker image by doing
docker images | grep chameleon
and you should see something like: mcastelino/chameleonsocks VERSION (1.X)...
To try different settings you can either edit the chameleonsocks.sh file or prepend environment variables to the call.
PROXY=myproxy.com PAC_URL=http://autoproxy.mycomp.com ./chameleonsocks.sh --start
To retry do:
./chameleonsocks.sh --stop && docker rm chameleonsocks
PROXY=myproxy2.com PAC_URL=http://autoproxy.mycomp.com ./chameleonsocks.sh --start
If you want to stop and start chameleonsocks without using the script after having made the container the first time (which DOES need the script), do:
docker stop chameleonsocks
docker start chameleonsocks
To see what may be wrong, you can do:
docker logs chameleonsocks
Note: if you are using a proxy.pac type autoconfig for your exceptions, it can take some time (?30 seconds?) to get the file and have the container start routing. If you're autoproxy breaks, you need to redo the install and not set the autoproxy (PAC_URL). This will give you just the default exceptions.