8.4. Squid redirector

8.4.1. Intro

This tiny set of tools allows you to display users their warning messages (and cut access to entire Web off, it needed) in very elegant way, namely using squid Proxy Server. Obviously to make this work, all users should be forced to use proxy (or transparent proxy should be setup).

Key component is redirector. It's responsible for user redirection to programmed message, when warn flag is set in database for his computers. URL to programmed message is not subject of redirection, which enables user's browser to download images. If computer has warn flag set, it's redirected to message, where he has a choice to mark this message as read. After that user is taken back to original (requested) URL. If given computer is disconnected (cutoff) it always redirects him to the message, without any possibility to "quit" to Web. For more information, please see README file.

8.4.2. Installation

Let's start from configuring squid (squid.conf):

# version 2.5
redirector_bypass on
redirect_program /path/to/lms-squid
# version 2.6
url_rewrite_program /path/to/lms-squid
That informs squid that it should use our redirector for each URL. Next step is to configure our redirector. Open lms-squid file in your favorite editor and change this line:
my $configfile = '/etc/lms/lms.ini';
...to reflect location of your lms.ini file. The rest of configuration is being set in actual lms.ini file, where we should add [redirector] section and define URL of our programmed message:
[redirector]
redirect        = http://net-komp.net.pl
At last, we copy files index.php, message.html to the directory that should serve a message to users and linking to lms images directory (img).