Search squid archive

Re: limiting connections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 22, 2012 at 10:00 PM, Amos Jeffries <squid3@xxxxxxxxxxxxx> wrote:
> On 23/03/2012 5:42 a.m., Carlos Manuel Trepeu Pupo wrote:
>>
>> I need to block each user to make just one connection to download
>> specific extension files, but I dont know how to tell that can make
>> just one connection to each file and not just one connection to every
>> file with this extension.
>>
>> i.e:
>> www.google.com #All connection that required
>> www.any.domain.com/my_file.rar #just one connection to that file
>> www.other.domain.net/other_file.iso #just connection to this file
>> www.other_domain1.com/other_file1.rar #just one connection to that file
>>
>> I hope you understand me and can help me, I have my boss hurrying me !!!
>
>
> There is no easy way to test this in Squid.
>
> You need an external_acl_type helper which gets given the URI and decides
> whether it is permitted or not. That decision can be made by querying Squid
> cache manager for the list of active_requests and seeing if the URL appears
> more than once.

Hello Amos, following your instructions I make this external_acl_type helper:

#!/bin/bash
result=`squidclient -h 192.168.19.19 mgr:active_requests | grep -c "$1"`
if [ $result -eq 0 ]
then
echo 'OK'
else
echo 'ERR'
fi

# If I have the same URI then I denied. I make a few test and it work
for me. The problem is when I add the rule to the squid. I make this:

acl extensions url_regex "/etc/squid3/extensions"
external_acl_type one_conn %URI /home/carlos/script
acl limit external one_conn

# where extensions have:
\.(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)$

http_access deny extensions limit


So when I make squid3 -k reconfigure the squid stop working

What can be happening ???

This is my log of squid:
Mar 24 09:25:04 test squid[28075]: helperHandleRead: unexpected read
from one_conn #1, 3 bytes 'OK '
Mar 24 09:25:04 test squid[28075]: helperHandleRead: unexpected read
from one_conn #2, 3 bytes 'OK '
Mar 24 09:25:04 test squid[28075]: WARNING: one_conn #1 (FD 15) exited
Mar 24 09:25:04 test squid[28075]: WARNING: one_conn #2 (FD 16) exited
Mar 24 09:25:04 test squid[28075]: CACHEMGR: <unknown>@192.168.19.19
requesting 'active_requests'
Mar 24 09:25:04 test squid[28075]: helperHandleRead: unexpected read
from one_conn #3, 3 bytes 'OK '
Mar 24 09:25:04 test squid[28075]: WARNING: one_conn #3 (FD 24) exited
Mar 24 09:25:04 test squid[28075]: helperHandleRead: unexpected read
from one_conn #4, 4 bytes 'ERR '
Mar 24 09:25:04 test squid[28075]: WARNING: one_conn #4 (FD 27) exited
Mar 24 09:25:04 test squid[28075]: Too few one_conn processes are running
Mar 24 09:25:04 test squid[28075]: storeDirWriteCleanLogs: Starting...
Mar 24 09:25:04 test squid[28075]: WARNING: Closing open FD   12
Mar 24 09:25:04 test squid[28075]:   Finished.  Wrote 25613 entries.
Mar 24 09:25:04 test squid[28075]:   Took 0.00 seconds (7740404.96 entries/sec).
Mar 24 09:25:04 test squid[28075]: The one_conn helpers are crashing
too rapidly, need help!


>
> Amos
>


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux