Re: [squid-users] limiting connections

From: Carlos Manuel Trepeu Pupo <charlie.mtp_at_gmail.com>
Date: Sat, 31 Mar 2012 15:58:59 -0400

On Sat, Mar 31, 2012 at 4:18 AM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> On 31/03/2012 3:07 a.m., Carlos Manuel Trepeu Pupo wrote:
>>
>>
>> Now I have the following question:
>> The possible error to return are 'OK' or 'ERR', if I assume like
>> Boolean answer, "OK"->TRUE&  "ERR"->FALSE. Is this right ?
>
>
> Equivalent, yes. Specifically it means success / failure or match /
> non-match on the ACL.
>
>
>> So, if I deny my acl:
>> http_access deny external_helper_acl
>>
>> work like this (with the http_access below):
>> If return "OK" ->  I denied
>> If return "ERR" ->  I do not denied
>>
>> It's right this ??? Tanks again for the help !!!
>
>
> Correct.

OK, following the idea of this thread that's what I have:

#!/bin/bash
while read line; do
        # -> This it for debug (Testing i saw that not always save to
file, maybe not always pass from this ACL)
        echo $line >> /home/carlos/guarda &

        result=`squidclient -h 10.11.10.18 mgr:active_requests | grep
-c "$line"`

  if [ $result == 1 ]
        then
        echo 'OK'
        echo 'OK'>>/home/carlos/guarda &
  else
        echo 'ERR'
        echo 'ERR'>>/home/carlos/guarda &
  fi
done

In the squid.conf this is the configuration:

acl test src 10.11.10.12/32
acl test src 10.11.10.11/32

acl extensions url_regex "/etc/squid3/extensions"
# extensions contains:
\.(iso|avi|wav|mp3|mp4|mpeg|swf|flv|mpg|wma|ogg|wmv|asx|asf|deb|rpm|exe|zip|tar|tgz|rar|ppt|doc|tiff|pdf)$
external_acl_type one_conn %URI /home/carlos/contain
acl limit external one_conn

http_access allow localhost
http_access deny extensions !limit
deny_info ERR_LIMIT limit
http_access allow test

I start to download from:
10.11.10.12 -> http://ch.releases.ubuntu.com//oneiric/ubuntu-11.10-desktop-i386.iso
then start from:
10.11.10.11 -> http://ch.releases.ubuntu.com//oneiric/ubuntu-11.10-desktop-i386.iso

And let me download. What I'm missing ???

# -----------------

http_access deny all

>
> Amos
>
Received on Sat Mar 31 2012 - 19:59:07 MDT

This archive was generated by hypermail 2.2.0 : Sun Apr 01 2012 - 12:00:04 MDT