Microproxy
Microproxy is my tiny FTP/HTTP/HTTPS proxy that I use in conjuction with
Crossroads. Anyway, it's small and fast and does
the job that I designed it for. If you are interested in a
minimalistic proxy, try it out.
Update: Version 1.11 (November 2012) now logs HTTP request
lines together with the requestor's IP address, for easy monitoring.
As per request of Marcin K ;-)
The distribution archive can be downloaded
as
microproxy.tar.gz.
From the README (also included in the archive):
MICROPROXY
Introduction
This is microproxy - a minimalistic HTTP proxy written in C++. I
wrote microproxy to scratch my own itch:
- It needs to be fast and small,
- It needs to reset the DNS subsystem when DNS queries fail, e.g.
after my laptop awakes from sleep and is on a new network.
- It needs to cache known DNS entries to speed up my browser.
- It doesn't have its own logging mechanism, it just sends all
output to stdout or stderr. Thus, microproxy can be run under a
standard console, but also can be invoked to log to the system log
when its output is piped to "logger".
What microproxy doesn't do, and what it's never been designed for,
is caching of files. If you want such functionality, check out e.g.
squid. Also, microproxy doesn't allow or block access, neither does
it filter or shape its passing traffic. Last, microproxy handles
only the basic protocols - http, https and ftp. Microproxy is just
what the name says - small and suited for this task.
How to obtain, install or uninstall microproxy
Microproxy's home page is at http://www.kubat.nl/pages/microproxy.
From there you can download an archive named microproxy.tar.gz,
containing the sources. Once you have downloaded the archive, cd to
a "sources" directory on your system, and type
tar xvzf microproxy.tar.gz
The archive spills its contents into a subdirectory microproxy/. Cd
into this directory.
You will need a C++ environment to make the installation work.
Additionally you will need the "libcurl" development package
(curl/curl.h and other include files, and libcurl.a for linkage). Just
type "make install" and a new program microproxy will get installed
into your /usr/local/bin/ directory. (Normally this needs to be done
by user "root" since non-root users can't write /usr/local/bin).
If you encounter errors during compliation, please let me know at
karel@kubat.nl.
If you want to uninstall microproxy, simply remove the file
/usr/local/bin/microproxy - et voila. As simple as that.
How to test microproxy
If you want to try it out, start up a console window and type
microproxy -v
The flag -v is optional, it increases verbosity so that you see
what's happening. Already you should see some output, resembling:
0xa015f720 This is Microproxy V1.03
0xa015f720 Copyright (c) Karel Kubat <karel@kubat.nl>
0xa015f720 Visit http://www.kubat.nl/ for information.
0xa015f720 Microproxy listening on port 3128
The leading number is a thread ID, which may be used for debugging.
Now microproxy is ready to accept connections on port 3128, its
default listening port (same as Squid's). If you need a different
port, e.g. 3129, supply a flag -p to the commandline with the
required port (e.g., -p 3129). If you want to see all possible
command line flags, try "microproxy -h".
Leave the microproxy window running. Now in a new window, type
export http_proxy=http://localhost:3128/
and then type
curl http://www.kubat.nl/
The curl command should fetch the topmost index off my site and show
the HTML on your screen. The microproxy window should now show that
it processed a request, with a line like:
0xb0103000 0.072271 GET http://www.kubat.nl/ HTTP/1.1 --> HTTP/1.0 200 OK
Besides the thread ID, microproxy also reports the time it took to
finish the request, plus the request itself, and the result.
Now for the real thing. Fire up your browser and configure the
browser proxy, which should be on server localhost and on port 3128
(or a different port if you have configured so).
Start browsing. The requests will show up in the console
window where microproxy is running.
In general, to find out what flags microproxy supports, type
microproxy -h
This shows a full overview of all options.
How to run microproxy
Once you have tested microproxy, you can fire it up "for real" using
a simple command such as:
nohup microproxy &
If you need to specify a specific port, the command becomes:
nohup microproxy -t 3129 &
If you want more verbosity, add a flag -v. If you have the program
"logger" to send any output of the command to the system log, use:
nohup sh -c 'microproxy -t 3129 | logger -t microproxy' &
There are many possibilities, figure out what works best for you.
Such a command can be run from e.g. the startscripts at /etc/rc* so
that microproxy is started at boot time. Your mileage will vary -
depending on the Unix flavor you are using.
Contact and Copyright
Microproxy is copyright (c) by me, Karel Kubat, karel@kubat.nl.
Contact me for any info or feedback. Microproxy is distributed under
GPLV3, which basically means that you can use it as you see fit, you
are allowed to modify and redistribute it as you see fit, as long as
you always redistribute microproxy in source code, and don't modify
the licensing terms. Please read http://gplv3.fsf.org/ for more
info.
However, as a courtesy, I would appreciate hearing about your
experiences with microproxy. If you modify the sources, drop me a
note - and I'll include your changes with full credits, if your
changes improve microproxy.
Have fun with microproxy!