Showing posts with label dansguardian. Show all posts
Showing posts with label dansguardian. Show all posts

Friday, April 16, 2010

Replace Dansguardian 2.8.0.6 binary for SmoothWall Express 3

To fix the iTunes 9.1/dansguardian bug (at your own risk, though I don't think it should break anything. If it does, you have the dansguardian backup file, right?):

Assuming you have already installed http://smoothwallmods.googlecode.com/files/DGAV-SW3-2.8.0.6-6.4.4.2-i686-b012.tgz in SmoothWall Express 3.0
  1. Back up /usr/sbin/dansguardian
  2. obtain http://www.gwy.org/dansguardian
  3. replace /usr/sbin/dansguardian
  4. chmod +x /usr/sbin/dansguardian
  5. at the minimum, you could dansguardian -q; dansguardian
now the malformed URL issue won't show up and iTunes 9.1 will work with dansguardian 2.8.0.6.

If you want 2.10, you'll have to compile it yourself.

Wednesday, April 22, 2009

Dansguardian access.log summarizing, counting, unique

I have a dansguardian access.log file in smoothwall. I'd like to get a list of unique domains in use, and who'd be a sample IP address to check on.

This, my first effort, is good as far as it goes, which is to simply alphabetize the domains and give an IP address for *someone* who has accessed it:

awk "{ split (\$5,a,\"/\"); print \$4 \"\t\" a[3]; }" access.log | sort +1 -u


Of course, if I needed a date or time, I could add it in the print statement.


But now I think to myself, what about seeing how popular a domain (front part of url) is?

awk "{ split (\$5,a,\"/\"); print \$4 \"\t\" a[3]; }" access.log | sort +1 | awk '{a[$2] = $0; b[$2]++ } END {for(i in a){ print a[i] "\t" b[i]};}' | sort +1


This gives an IP address that has accessed the domain, and how many times that domain has been accessed. It DOES NOT mean that the IP address has accessed that domain that many times. If I wanted to do that ...


awk "{ split (\$5,a,\"/\"); print \$4 \"\t\" a[3]; }" access.log | sort | awk '{a[$0] = $0; b[$0]++ } END {for(i in a){ print a[i] "\t" b[i]};}' | sort


Further, you can use the above to see who "hogs" the web...
awk "{ split (\$5,a,\"/\"); print \$4 \"\t\" a[3]; }" access.log | sort | awk '{ a[$0] = $0; b[$0]++ } END {for(i in a){ print a[i] "\t" b[i]};}' | sort -r -n +2 -t " "

Inside the " " Linux users would use, in vi: ctrl-v, then Tab to put the real tab character. This puts the biggest numbers on top, so piping through more or head would be ideal.

I would argue that using these scripts is faster than most any other log analysis program, or use it in conjunction with your log analysis program.

Wednesday, March 25, 2009

Dansguardian schedule an exception during the day.

So, you're using dansguardian and would like to schedule an exception...

I created two scripts:
_start_.sh

cp /etc/dansguardian/exceptionsitenoon.noon /etc/dansguardian/exceptionsitenoon
/usr/sbin/dansguardian -g


_stop_.sh

cp /etc/dansguardian/exceptionsitenoon.normal /etc/dansguardian/exceptionsitenoon
/usr/sbin/dansguardian -g


And added this line in /etc/dansguardian/exceptionsitelist:

.Include </etc/dansguardian/exceptionsitenoon>


Then, crontab -e

min hr * * * /path/to/_start_.sh
min hr * * * /path/to/_stop_.sh


And, of course, made a file /etc/dansguardian/exceptionsitenoon.noon that had a list of the domains I wanted to allow (for my case, at noon) and another /etc/dansguardian/exceptionsitenoon.normal that was empty. The reason I used the .Include option was that I wanted to keep the permanent exceptions separate and manageable from the temporary exceptions -- If not, I'd have to make updates to both "noon" and "normal" lists every time I needed to make a permanent exclusion.

Blog Archive