Monday, June 30, 2008

Restricting downloads with squid!

Many times you may want to deny users from downloading huge files
using the proxy server. This blog will help you do that with squid
in GNU/Linux.

To Readers: All those starting with # are run by root user and ;'s are comments inside the configuration files

Here we are using reply_body_max_size TAG in squid.conf

#vim /etc/squid/squid.conf

acl limitme src 10.0.0.1-10.0.0.50
reply_body_max_size 2097152 allow limitme
reply_body_max_size 0 allow all

By default, there is no restriction on the maximum
file that can be downloaded.

Here limitme acl is allowed only a maximum
of 2 MB download.

2097152 bytes = 2097152/1024 Kbytes => 2048 KB => 2 MB

~mj0vy (sreejith dot anujan at gmail dot com)