squid_redir is a program for rewriting URLs. It is used in conjunction with the Squid proxy and the PostgreSQL database. You can setup multiple redirections, for example one could say that any requests to http://www.a-really-bad-site.com goes to http://www.the-good-guys-site.org without any reconfiguration of your browsers or your proxy server.
First of all, you need to have a working setup of the Squid proxy and the PostgreSQL database. For security reasons, you should create a new database user and grant this user access to a new database, exclusively.
$ tar -xyf squid_redir.tar.bz2 $ make CFLAGS=-I<path-to-postgresql-header> LDFLAGS=-L<path-to-postgresql-libraries>
By default, the following directories will be used:
directory | Makefile parameter | what's installed there | description |
---|---|---|---|
/usr/sbin | SBINDIR | squid_redir | main program, will be invoked by squid |
/home/www | WWWDIR | nothing | document root of your webserver |
$(WWWDIR)/cgi-bin | CGIBINDIR | squid_redir_error | used by squid_redir for displaying errors and for redirecting |
$(CGIBINDIR)/admin | CGISBINDIR | squid_redir_conf | configuration utility (CGI script) |
$(WWWDIR)/htdocs/squid_redir | HTDOCSDIR | back.html deny.html reject.html |
|
/etc/squid | SYSCONFDIR | squid_redir.conf | configuration file, which contains database connection parameters (if you change its location, you have to edit defs.h in the source directory, too) |
DESTDIR | nothing | a placeholder for packaging |
Edit /etc/squid/squid_redir.conf (or wherever you put the configuration file) and put in the following lines:
user = <database user you created above> pass = <password for this user> db = <name of the database> error_url = http://<yourwebserver>/cgi-bin/squid_redir_error
That's it! Any tables will be created by squid_redir itself.
Basically, you just have to open http://<yourwebserver>/cgi-bin/squid_redir_error with your web browser. Although the interface is easily to understand, I have some screenshots which show you what can be done with squid_redir_conf:
There are no FAQs yet!