Pi Proxy

I'm visiting a Linux users group tomorrow and part of their focus is the Raspberry Pi.  I've been working on my Pi recon device which I've called:  "consPire" but it's only half ready because I keep coming up with more ideas for what I want it to do.  Rather than bring a half baked project, I thought about other uses for the Pi.  One thing that came to mind, that's fairly simple to build, is a proxy server.  There are a number of uses for a proxy but at the very least, it's another layer between your browser and the Internet... so why not??

Scrounging around my desk, I found an extra MicroSD card and with balenaEtcher, I burned a Raspbian image to the card.  I used the lite version of Raspbian which lacks the GUI but it's a Pi and the GUI is S L O W.  Once the OS was installed and running, using raspi-config, I added SSH.  With SSH installed, I logged into the Pi and  I did everything else remotely.

First, I installed Tinyproxy:





The Tinyproxy configuration file can be found under:  /etc/tinyproxy/tinyproxy.conf:





By default, Tinyproxy uses port 8888 and I see no reason to change it.

Also by default, Tinyproxy only allows traffic from localhost:





Reading through the list of options, we see the Allow, Deny section:





So basically, if we comment everything Allow and Deny, we can proxy traffic from any address.  Which by the way, might not be a great idea depending on what you're doing and where you're doing it.  For the sake of this exercise, we're going to comment out all of it:





I'm using FoxyProxy to switch between my proxies but at the end of this post, I'll walk through setting up a proxy connection through Firefox which is not exactly the same across browsers but the terminology is similar and you should be able to figure it out.  And frankly, if you're reading this, you probably already know how to do it.  But you never know....





Prior to switching my browser to the proxy, I hit the web server.  Following that, I switched to the proxy:





First, we see the real IP and then we see the proxy IP address.  

What else can we change?  On the Pi side, by default, we're logging traffic.  Maybe I don't want to log traffic:

 




When we open up the configuration file, we see the entry for logging and we change to:





Playing around with Tinyproxy and the configuration options, something I didn't like is that I can't change the User-Agent.  Best I can do is the following:





Which doesn't change the User-Agent but it does add "Powered by Tinyproxy" which can see in the logs:





Although these options appear in different parts of the configuration file, they need to appear in that order which you see above.  It seems like it can only add the "Powered by..." once we have Anonymous in place. 

I did a little bit of hunting around and it's like you can't change the User-Agent altogether which limits the use of this proxy.  Honestly, I don't even want the "Powered by Tinyproxy" option to appear in the logs but it's sort of a way to show that it's working in addition to the IP address change.

As promised, once you get a proxy, any proxy, setup we're basically looking for the section in our browser that allows us to change the Network Proxy settings.  In Firebox, we choose the settings icon:





Scroll down to preferences and once we're at preferences scroll to the bottom:





We find Network Proxy and Settings.  Choose Settings:





We find the location for entering our proxy information. 

Browsers vary but typically, it's in the advanced section and usually near the bottom.