Tinyproxy is a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems. Designed from the ground up to be fast and yet small, it is an ideal solution for use cases such as embedded deployments where a full featured HTTP proxy is required, but the system resources for a larger proxy are unavailable.
Tinyproxy is distributed using the GNU GPL license (version 2 or above).
Tinyproxy has a small footprint and requires very little in the way of system resources. The memory footprint tends to be around 2 MB with glibc, and the CPU load increases linearly with the number of simultaneous connections (depending on the speed of the connection). Thus, Tinyproxy can be run on an older machine, or on a network appliance such as a Linux-based broadband router, without any noticeable impact on performance.
Tinyproxy requires only a minimal POSIX environment to build and operate. It can use additional libraries to add functionality though.
Tinyproxy allows forwarding of HTTPS connections without modifying traffic in any way through the
CONNECT method (see the
Tinyproxy supports being configured as a transparent proxy, so that a proxy can be used without requiring any client-side configuration. You can also use it as a reverse proxy front-end to your websites.
AddHeader directive, you can add/insert HTTP headers to outgoing traffic.
If you’re looking to build a custom web proxy, Tinyproxy is easy to modify to your custom needs. The source is straightforward, adhering to the KISS principle. As such, it can be used as a foundation for anything you may need a web proxy to do.
Tinyproxy has privacy features which can let you configure which HTTP headers should be allowed through, and which should be blocked. This allows you to restrict both what data comes to your web browser from the HTTP server (e.g., cookies), and to restrict what data is allowed through from your web browser to the HTTP server (e.g., version information).
Using the remote monitoring facility, you can access proxy statistics from afar, letting you know exactly how busy the proxy is.
You can configure Tinyproxy to control access by only allowing requests from a certain subnet, or from a certain interface, thus ensuring that random, unauthorized people will not be using your proxy.
With a bit of configuration (specifically, making Tinyproxy created files owned by a non-root user and running it on a port greater than 1024), Tinyproxy can be made to run without any special privileges, thus minimizing the chance of system compromise. Furthermore, it was designed with an eye towards preventing buffer overflows. The simplicity of the code ensures it remains easy to spot such bugs.
1. Download & install tinyproxy
On Ubuntu/Debian, you can do this with the command “sudo apt-get install tinyproxy” or use the Synaptic package manager in Ubuntu. Other flavors of linux may have tinyproxy available via their own package system (rpm, yum), or you can download the source here:
2. Configure tinyproxy
Use a text editor (e.g. nano, vi) change these lines in the tinyproxy config file.
# Change loglevel to connect, or even Warning to limit log traffic LogLevel Connect # Port to listen on. Select a random 4-digit number. Well-known ports are being filtered. Port 7562 # Filter based on URLs rather than domains. FilterURLs On # Comment out any other Allow statements, replace with these below Allow 127.0.0.1 # The IP below should should be your computer's external IP Allow x.x.x.x # Allow these Iranian IPs. IP list from http://bit.ly/10f1ai Allow 126.96.36.199/17 Allow 188.8.131.52/19 Allow 184.108.40.206/19 Allow 220.127.116.11/17 Allow 18.104.22.168/18 Allow 22.214.171.124/18 Allow 126.96.36.199/19 Allow 188.8.131.52/19 Allow 184.108.40.206/20 Allow 220.127.116.11/15 Allow 18.104.22.168/20 Allow 22.214.171.124/20 Allow 126.96.36.199/20 Allow 188.8.131.52/19 Allow 184.108.40.206/19 Allow 220.127.116.11/19 Allow 18.104.22.168/17 Allow 22.214.171.124/19 Allow 126.96.36.199/21 Allow 188.8.131.52/18 Allow 184.108.40.206/20 Allow 220.127.116.11/20 Allow 18.104.22.168/20 Allow 22.214.171.124/20 Allow 126.96.36.199/16 Allow 188.8.131.52/20 Allow 184.108.40.206/20 Allow 220.127.116.11/20 Allow 18.104.22.168/17 Allow 22.214.171.124/20 Allow 126.96.36.199/20 Allow 188.8.131.52/20 Allow 184.108.40.206/20 Allow 220.127.116.11/20 Allow 18.104.22.168/20 Allow 22.214.171.124/20 Allow 126.96.36.199/18 Allow 188.8.131.52/19 Allow 184.108.40.206/18 Allow 220.127.116.11/18 Allow 18.104.22.168/18 Allow 22.214.171.124/18 Allow 126.96.36.199/18 Allow 188.8.131.52/17 Allow 184.108.40.206/16 Allow 220.127.116.11/18 Allow 18.104.22.168/19 Allow 22.214.171.124/16 Allow 126.96.36.199/19 Allow 188.8.131.52/19 Allow 184.108.40.206/18 Allow 220.127.116.11/17 Allow 18.104.22.168/20 Allow 22.214.171.124/18 Allow 126.96.36.199/15 Allow 188.8.131.52/19 Allow 184.108.40.206/19 Allow 220.127.116.11/23 Allow 18.104.22.168/24 Allow 22.214.171.124/24 Allow 126.96.36.199/24 Allow 188.8.131.52/24 Allow 184.108.40.206/24 Allow 220.127.116.11/21 Allow 18.104.22.168/18 Allow 22.214.171.124/20 Allow 126.96.36.199/20 Allow 188.8.131.52/19 Allow 184.108.40.206/16 Allow 220.127.116.11/21 Allow 18.104.22.168/18 Allow 22.214.171.124/20 Allow 126.96.36.199/20 Allow 188.8.131.52/20 Allow 184.108.40.206/19 Allow 220.127.116.11/15 Allow 18.104.22.168/17 Allow 22.214.171.124/21 Allow 126.96.36.199/18 Allow 188.8.131.52/16 Allow 184.108.40.206/18 Allow 220.127.116.11/18 Allow 18.104.22.168/18 Allow 22.214.171.124/18 Allow 126.96.36.199/21 Allow 188.8.131.52/21 Allow 184.108.40.206/16 Allow 220.127.116.11/21 Allow 18.104.22.168/19 Allow 22.214.171.124/19 Allow 126.96.36.199/17 Allow 188.8.131.52/15 Allow 184.108.40.206/23 Allow 220.127.116.11/16 Allow 18.104.22.168/19 Allow 22.214.171.124/19 Allow 126.96.36.199/19 Allow 188.8.131.52/19 Allow 184.108.40.206/19 Allow 220.127.116.11/19 Allow 18.104.22.168/19 Allow 22.214.171.124/19 Allow 126.96.36.199/19 Allow 188.8.131.52/18 Allow 184.108.40.206/18 Allow 220.127.116.11/18 Allow 18.104.22.168/19 Allow 22.214.171.124/19 Allow 126.96.36.199/20 Allow 188.8.131.52/20 Allow 184.108.40.206/20 Allow 220.127.116.11/20 Allow 18.104.22.168/20 Allow 22.214.171.124/20 Allow 126.96.36.199/20 Allow 188.8.131.52/19 Allow 184.108.40.206/20 Allow 220.127.116.11/15
Now create/edit the filter file, which will contain addresses to block for the proxy. This file may be blank, but I just added a well-known useless address for demonstration.
3. Set up a cron job to restart tinyproxy daily.
This is can help tinyproxy clear any memory leaks if it sees lots of heavy load. Note that I had to use separate start/stop jobs, since the restart script wouldn’t restart the proxy reliably.
Add these lines to /etc/tinyproxy/tinyproxy.conf
0 15 * * * root /etc/init.d/tinyproxy stop 1 15 * * * root /etc/init.d/tinyproxy start
You will want to change the hour value (15 in the example above, i.e. 3pm) to something that is sympathetic to Tehran’s timezone. I.e. don’t restart the proxy at 12pm Tehran time.
4. Restart tinyproxy to make the new settings take effect.
Do these 2 commands one after another at the shell prompt:
sudo /etc/init.d/tinyproxy stop sudo /etc/init.d/tinyproxy start
5. Pass only your new proxy address to where it’s needed.
The address for your new proxy to pass along will be…