Posts Tagged ‘QoS’

Blocking downloading of files using SQUID

Wednesday, February 24th, 2010

Blocking downloading of files using SQUID

We can use ACL to block the download
Step 1
add following lines in to the ACL  ection
acl blockfiles urlpath_regex “/etc/squid/blocks.files.acl”

and to display cusotm error message when users try to download
add

# Deny all blocked extension
deny_info ERR_BLOCKED_FILES blockfiles
http_access deny blockfiles

Step 2
After editing and closing the file . Create custom error message file called “ERR_BLOCKED_FILES” in /etc/squid/error/ directory or /usr/share/squid/errors/English directory.

<HTML>
<HEAD>
<TITLE>ERROR: Blocked file content</TITLE>
</HEAD>
<BODY>
<H1>File is blocked due to new IT policy</H1>
<p>Downloading files causes network trafic</p>

Step 3
nano /etc/squid/blocks.files.acl
add the follwing text

\.[Ee][Xx][Ee]$
\.[Aa][Vv][Ii]$
\.[Mm][Pp][Gg]$
\.[Mm][Pp][Ee][Gg]$
\.[Mm][Pp]3$

A restart of squid will do the trick