HTTP

How To Install And Setup TinyProxy On Your Linux Server

Tinyproxy is an HTTP/HTTPS Proxy. It is lightweight, fast, very easy to configure, and an open-source proxy service. Tinyproxy is configurable as a reverse proxy as well. It is good to be used as a small proxy with fewer system resources because it is very lightweight.

Features

  • Tinyproxy is easy to configure and modify.
  • A small memory footprint means it occupies a very little amount of space on operating systems. Its memory footprint is almost about 2MB.
  • The anonymous mode allows authorization of individual HTTP headers that should be allowed and those which should not be.
  • Access control by blocking an unauthorized user.
  • Filtering allows the user to block or allow a certain domain by creating a blacklist and whitelist.
  • Privacy features control both incoming and outgoing data from the HTTPS/HTTP servers.

Install TinyProxy

Update system packages by typing the following command.

[email protected]:~$ sudo  apt-get  update
[email protected]:~$ sudo  apt-get  upgrade -y

Once the update completes, Install Tinyproxy by typing this command.

[email protected]:~$ sudo apt-get -y install tinyproxy

Tinyproxy will be installed. To start and check the status of Tinyproxy, type these commands.

[email protected]:~$ sudo systemctl tinyproxy start
[email protected]:~$ sudo systemctl tinyproxy status

Configure Web Browser

To make your Tinyproxy work, you have to change some settings in your web browser. To do so, go into your web browser network settings and click on the manual proxy configuration, and in the HTTP proxy bar, write your public IP_Address on which you want to run the Tinyproxy. And the port number (by default tinyproxy port no. is 8888).

You can also use foxyproxy to configure your web browser. It is a proxy management tool that is much better than the limited ability of firefox proxy configuration. It is an extension for the Firefox and Chrome web browsers and can be downloaded from their stores.

Tinyproxy Configuration

The Tinyproxy configuration file is located in the following path “etc/tinyproxy/tinyproxy.conf”.

To access it, type the following command.

[email protected]:~$ cd  etc/tinyproxy/tinyproxy.conf

To make changes in the Tinyproxy configuration file, open it using vim.

[email protected]:~$ sudo vim  etc/tinyproxy/tinyproxy.conf

Go to the line Allow 127.0.0.1 and change it with your public IP Address.

Now go to line #Listen 192.168.0.1 . Comment out this line and write your IP_Address in it.

Allow and Block Range of User IPs

Tinyproxy allows you to add or block a user IP or a range of IPs from using tinyproxy. To allow or block user IP, go to the line Allow 127.0.0.1, and below this line, add the IP addresses you want Allow [IP_Address]. For allowing a range of IP address just below the line Allow 192.168.0.0 add a line

Allow [IP_Address/range]

For blocking a user IP or range of IPs, just comment out the IP_Address you want to block. In tinyproxy, by default, all the IPs are blocked.

Authorization

In tinyproxy, you can setup authorization so that only those users can access the tinyproxy who are authorized. For setting up the authorization credentials, go to the line #BasicAuth user password. Uncomment this line and write your password at the end of this line.

BasicAuth user password [Your Password]

Adding Filter

You can also add a traffic filter by blocking websites using tinyproxy. Follow the instructions for adding traffic filters.

Go to the line Filter “/etc/tinyproxy/filter”. Comment out this line. You can put the filter on URL or domains. Also, below this line, comment out another line, “FilterExtanded On”. And “FilterDefaultDeny Yes”.

Save the changes and add domains of the websites you want to block in the filter file. You can access the filter file in the “/etc/tinyproxy/filter” path. So open it using vim.

[email protected]:~$ sudo vim etc/tinyproxy/filter

Add the domains line by line. You can add any and as many domains as you want to block.

Any time you make any changes in the filter list or tinyproxy configuration file, you must restart the tinyproxy service. To restart the tinyproxy service type command.

[email protected]:~$ service tinyproxy restart

Now allow the firewall by typing the command.

[email protected]:~$ sudo iptables -A INPUT -j ACCEPT -m comment --comment “tinyproxy” -s 192.163.28.73/24 -p tcp --dport 8888

Regulate TinyProxy Using Cron Job

If you want to schedule the timing of your tinyproxy, like when you want to start, restart or stop the tinyproxy. You can do it with a special feature of the Linux cron job. It follows this pattern time (minute, hour, day of the month, month, day of the week) path command. To edit the cron job type command crontab -e

To schedule the starting time of tinyproxy, type the following commands.

0 6 * * * etc/init.d/tinyproxy start

To schedule the stopping time of tinyproxy, type the following commands.

0 23 * * * etc/init.d/tinyproxy stop

This means the tinyproxy service will automatically start at 6 am and stop at 11 pm every day.

Conclusion

Tinyproxy is a useful and easy tool to set the HTTP/HTTPS Proxy. It is for small servers, but if you want to have a proxy server running for larger networks, you might need to go to the squid proxy. We have shared only some tips here, but they are good enough. Using this simple guide on how to install, configure, and use tinyproxy, you will be able to set up your tinyproxy.

About the author

Usama Azad

Usama Azad

A security enthusiast who loves Terminal and Open Source. My area of expertise is Python, Linux (Debian), Bash, Penetration testing, and Firewalls. I’m born and raised in Wazirabad, Pakistan and currently doing Undergraduation from National University of Science and Technology (NUST). On Twitter i go by @UsamaAzad14