Re: [squid-users] bad regex is blocking the wrong sites

From: John Hardin <jhardin_at_impsec.org>
Date: Mon, 3 Oct 2011 17:08:29 -0700 (PDT)

On Mon, 3 Oct 2011, devadmin wrote:

> heres the contents of the bad regex blacklist im using, just a single
> line.
>
> .*porn*.*
>
> one entry. and this single entry causes all those sites/services and
> more to be blocked. What am I doing wrong?

The key is: regex != fileglob.

In regular expressions, "*" means "the preceding atom repeated zero or
more times", _not_ "a string of any characters". Also, "." is an atom that
matches any single character (if it's used outside square brackets).

So, ".*porn*.*" means:

Zero or more of anything, followed by "por", followed by zero or more "n",
followed by zero or more of anything.

If you're trying to match dot-anything-porn-anything-dot, try this:

   \.[^.]*porn[^.]*\.

which means:

A period, followed by zero or more not-periods, followed by "porn",
followed by zero or more not-periods, followed by a period.

-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin_at_impsec.org    FALaholic #11174     pgpk -a jhardin_at_impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   Look at the people at the top of both efforts. Linus Torvalds is a
   university graduate with a CS degree. Bill Gates is a university
   dropout who bragged about dumpster-diving and using other peoples'
   garbage code as the basis for his code. Maybe that has something to
   do with the difference in quality/security between Linux and
   Windows.                           -- anytwofiveelevenis on Y! SCOX
-----------------------------------------------------------------------
  Tomorrow: the 7th anniversary of SpaceshipOne winning the X-prize
Received on Tue Oct 04 2011 - 00:08:36 MDT

This archive was generated by hypermail 2.2.0 : Tue Oct 04 2011 - 12:00:03 MDT