Wednesday, 1 July 2009

Proxy Server

Even at home a proxy server can be useful and is easy enough to setup: it helps keep track of downloads easily, can be used to limit access to content, and helps minimise download expenses across multiple machines for updates and other downloads.

The proxy server itself is squid. A useful reporting program is sarg.

sudo apt-get install squid sarg

Squid

You will need to edit the /etc/squid/squid.conf file (as superuser) to uncomment, and edit if necessary, down in the custom settings section the lines which read something like:

sudo nano /etc/squid/squid.conf

acl our_networks src 192.168.1.0/24
http_access allow our_networks

(and in my case the visiblehostname (visible_hostname laptop))

Sarg

Sarg is mostly automatic, however you may have to edit /etc/squid/sarg.conf to customise and correct some errors (spelling of "monthly").

sudo nano /etc/squid/sarg-reports.conf

DAILY=Daily
WEEKLY=Weekly
MONTHLY=Monthly

Log rotation for the squid files need to be changed to monthly:

sudo nano /etc/logrotate.d/squid

Reports will be found in /var/www/squid-reports/index.html

With a web server such as Apache installed: reports are available through a browser at: http://server.local/squid-reports or whatever name of the machine is instead of "server.local".

Set Proxy

To apply system-wide proxy edit .bashrc to add an export line:

nano .bashrc

export http_proxy="http://server.local:3128"

0 comments:

iantheteacher

Planet ILUG