Re: [squid-users] Limiting upload for a subnet

From: Henrik Nordstrom <henrik_at_henriknordstrom.net>
Date: Fri, 28 Aug 2009 17:36:25 +0200

fre 2009-08-28 klockan 11:35 +0100 skrev Dayo Adewunmi:
> Henrik Nordstrom wrote:
> > fre 2009-08-28 klockan 09:44 +0100 skrev Dayo Adewunmi:
> >
> >> users? Is there a way to make an ACL that would limit the upload of just
> >> a subset
> >> of my network?
> >>
> >
> > It can be done as an external acl based on the source IP and
> > Content-Length request header.
> >
> > Regards
> > Henrik
> >
> >
> >
> Can you give me an example of this, please?

squid.conf:

external_acl_type %{SRC} %>{Content-Length} /path/to/your/helper

Example helper:

#!/bin/sh
while read ip length; do
   maxlength="-"
   case $ip in
   192.168.1.*)
        maxlength=1000000
        ;;
   192.168.2.*)
        maxlength=100000
        ;;
   esac

   if [ $length = "-" -o $maxlength = "-" ]; then
        echo OK
   elif [ $length -gt $maxlength ]; then
        echo ERR
   else
        echo OK
   fi
done

Note: completely untested, example intended to give you the idea how
this may work.

Regards
Henrik
Received on Fri Aug 28 2009 - 15:36:32 MDT

This archive was generated by hypermail 2.2.0 : Fri Aug 28 2009 - 12:00:03 MDT