Connections.cgi neu geschrieben.

URL-Filter aktualisiert.


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@495 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-04-12 16:28:06 +00:00
parent 9fb25b1c17
commit 1465b12776
12 changed files with 558 additions and 403 deletions

View File

@@ -1,7 +1,10 @@
#!/usr/bin/perl
#
# $Id: autoupdate.pl,v 1.0 2005/06/15 00:00:00 marco Exp $
# This code is distributed under the terms of the GPL
#
# (c) 2004-2007 marco.s - http://www.urlfilter.net
#
# $Id: autoupdate.pl,v 1.1 2007/03/14 00:00:00 marco.s Exp $
#
use strict;
@@ -9,6 +12,7 @@ my $make_clean = 1;
my $swroot = "/var/ipfire";
my $target = "$swroot/urlfilter/download";
my $tempdb = "$target/blacklists";
my $dbdir = "$swroot/urlfilter/blacklists";
my $sourceurlfile = "$swroot/urlfilter/autoupdate/autoupdate.urls";
@@ -23,6 +27,7 @@ my $source_url;
my $source_name;
my @source_urllist;
my @categories;
my $blacklist;
my $category;
@@ -72,24 +77,32 @@ unless ($blacklist_url eq '')
if (-e $blacklist)
{
system("/bin/tar --no-same-owner -xzf $blacklist -C $target");
if (-d "$target/blacklists")
if (-d "$target/BL") { system ("mv $target/BL $target/blacklists"); }
if (-d "$tempdb")
{
undef(@categories);
&getblockcategory ($tempdb);
foreach (@categories) { $_ = substr($_,length($tempdb)+1); }
open(FILE, ">$target/update.conf");
flock FILE, 2;
print FILE "logdir $target\n";
print FILE "dbhome $target/blacklists\n\n";
print FILE "dbhome $tempdb\n\n";
foreach (<$target/blacklists/*>)
{
if ((-d $_) && ((-s "$_/domains") || (-s "$_/urls")))
{
$category=substr($_,rindex($_,"/")+1);
print FILE "dest $category {\n";
if (-s "$_/domains") { print FILE " domainlist $category/domains\n"; }
if (-s "$_/urls") { print FILE " urllist $category/urls\n"; }
print FILE "}\n\n";
foreach $category (@categories) {
$blacklist = $category;
$category =~ s/\//_/g;
print FILE "dest $category {\n";
if (-s "$tempdb/$blacklist/domains") {
print FILE " domainlist $blacklist\/domains\n";
}
if (-s "$tempdb/$blacklist/urls") {
print FILE " urllist $blacklist\/urls\n";
}
print FILE "}\n\n";
$category = $blacklist;
}
print FILE "acl {\n";
print FILE " default {\n";
print FILE " pass none\n";
@@ -103,19 +116,7 @@ unless ($blacklist_url eq '')
system("chown -R nobody.nobody $dbdir");
foreach $category (<$dbdir/*>)
{
if (-d $category)
{
system("chmod 755 $category &> /dev/null");
foreach $blacklist (<$category/*>)
{
if (-f $blacklist){ system("chmod 644 $blacklist &> /dev/null"); }
if (-d $blacklist){ system("chmod 755 $blacklist &> /dev/null"); }
}
system("chmod 666 $category/*.db &> /dev/null");
}
}
&setpermissions ($dbdir);
system("touch $updflagfile");
system("chown nobody.nobody $updflagfile");
@@ -172,3 +173,41 @@ sub readhash
}
# -------------------------------------------------------------------
sub getblockcategory
{
foreach $category (<$_[0]/*>)
{
if (-d $category)
{
if ((-s "$category/domains") || (-s "$category/urls"))
{
unless ($category =~ /\bcustom\b/) { push(@categories,$category); }
}
&getblockcategory ($category);
}
}
}
# -------------------------------------------------------------------
sub setpermissions
{
my $bldir = $_[0];
foreach $category (<$bldir/*>)
{
if (-d $category){
system("chmod 755 $category &> /dev/null");
foreach $blacklist (<$category/*>)
{
if (-f $blacklist) { system("chmod 644 $blacklist &> /dev/null"); }
if (-d $blacklist) { system("chmod 755 $blacklist &> /dev/null"); }
}
system("chmod 666 $category/*.db &> /dev/null");
&setpermissions ($category);
}
}
}
# -------------------------------------------------------------------

View File

@@ -1,3 +1,3 @@
squidGuard,http://ftp.teledanmark.no/pub/www/proxy/squidGuard/contrib/blacklists.tar.gz
Shalla Secure Services,http://squidguard.shalla.de/Downloads/shallalist.tar.gz
MESD,http://squidguard.mesd.k12.or.us/blacklists.tgz
Univ. Toulouse,ftp://ftp.univ-tlse1.fr/pub/reseau/cache/squidguard_contrib/blacklists.tar.gz

View File

@@ -4,8 +4,6 @@
#
# (c) written from scratch
#
# $Id: prebuild.pl,v 0.3 2005/04/16 00:00:00 marco Exp $
#
$dbdir="/var/ipfire/urlfilter/blacklists";
@@ -18,15 +16,27 @@ if (-e "$dbdir/custom/blocked/urls.db") { unlink("$dbdir/custom/blocked/urls.
system("chown -R nobody.nobody $dbdir");
foreach $category (<$dbdir/*>)
&setpermissions ($dbdir);
# -------------------------------------------------------------------
sub setpermissions
{
if (-d $category){
system("chmod 755 $category &> /dev/null");
foreach $blacklist (<$category/*>)
{
if (-f $blacklist){ system("chmod 644 $blacklist &> /dev/null"); }
if (-d $blacklist){ system("chmod 755 $blacklist &> /dev/null"); }
my $bldir = $_[0];
foreach $category (<$bldir/*>)
{
if (-d $category){
system("chmod 755 $category &> /dev/null");
foreach $blacklist (<$category/*>)
{
if (-f $blacklist) { system("chmod 644 $blacklist &> /dev/null"); }
if (-d $blacklist) { system("chmod 755 $blacklist &> /dev/null"); }
}
system("chmod 666 $category/*.db &> /dev/null");
&setpermissions ($category);
}
system("chmod 666 $category/*.db &> /dev/null");
}
}
# -------------------------------------------------------------------

View File

@@ -1,5 +1,5 @@
logdir /var/log/squidGuard
dbhome /var/ipfire/urlfilter/blacklists
dbhome /var/ipcop/urlfilter/blacklists
acl {
default {