Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i'm trying to open a web, but my squid is blocking that url, in squid.conf, i have this

acl neverallow url_regex -i "/usr/local/squid/etc/blacklist/neverallow"
http_access deny neverallow

if i comment the http_access line, i'm able to open the url, so, i open the file looking for the domain name, or something that looks like the url i'm trying to open, but, couldn't find nothing with my own eyes, so, i'm not an expert in linux, and i don't know how to google this, my question is, is there a way that i can manually( a command, program, etc.) test the url i'm trying to open with the ones saved in the file and know which one is the match??

I'm using Debian 6

share|improve this question
1  
well regex can be tricky !! it would be helpful if you had included "neverallow" files' content and the website you were trying to visit via proxy. –  kaji Jul 22 '12 at 14:55

2 Answers 2

up vote 0 down vote accepted

Have you tried the DEBUG_OPTIONS ?

debug_options ALL,1 33,2 28,9

And then take a look to cache.log

Don't forget comment the above line after debugging....

share|improve this answer

Try this script. It should be used in this manner:

$ cat your_url_regex_list_file | ./script.pl url_to_be_tested

so that,

$ cat blacklist.txt | ./script.pl playboy.com

will show the line number of the lines matching the string provided within the file.

Regards.

#!/usr/bin/perl

my $url = $ARGV[0];
chomp($url);
my $tst = 0;
my $lnb = 1;

print "Searching: [$url]...\n";
while (<STDIN>)
{
    my $item = $_;
    chomp($item);
    $lnb++;

    if ($url =~ /$item/)
    {
            print "! $lnb [$url] in |$item| \n";
            $tst++;
    }
}

if ($tst == 0) { print "no one found\n"; }
share|improve this answer
    
Your script is awesome, thanks, but one more thing, what about if i try with something like this (http://|www\.)in\.com, i get en error like this -bash: syntax error near unexpected token http://'` –  Kstro21 Mar 7 '13 at 17:03
    
It also doesn't work with url like this: http://translate.google.com.cu/?sl=es&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&eotf=1&‌​text=seguridad+inform%C3%A1tica&file=#submit –  Kstro21 Mar 7 '13 at 17:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.