]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - config/urlfilter/makeconf.pl
Add aliases to backup and run setaliases at red start (if red=static only)
[people/pmueller/ipfire-2.x.git] / config / urlfilter / makeconf.pl
CommitLineData
10e4f239
MT
1#!/usr/bin/perl
2
3$swroot="/var/ipfire";
4$logdir="/var/log/squidGuard";
5$dbdir="/var/ipfire/urlfilter/blacklists";
6
10e4f239
MT
7print "Creating configuration file ";
8foreach $blacklist (<$dbdir/*>)
9{
10 if (-d $blacklist)
11 {
12 $lastslashpos = rindex($blacklist,"/");
13 $section = substr($blacklist,$lastslashpos+1);
14 push(@categories,$section);
15 }
16}
17open(FILE, ">$swroot/urlfilter/squidGuard.conf");
18print FILE "logdir $logdir\n";
19print FILE "dbhome $dbdir\n\n";
20foreach $category (@categories)
21{
22 print FILE "dest $category {\n";
23 if (-e "$dbdir/$category/domains") {
24 print FILE " domainlist $category\/domains\n";
25 }
26 if (-e "$dbdir/$category/urls") {
27 print FILE " urllist $category\/urls\n";
28 }
29 print FILE "}\n\n";
30}
31print FILE "acl {\n";
32print FILE " default {\n";
33print FILE " pass all\n";
34print FILE " }\n";
35print FILE "}\n";
36close FILE;
37print "\n";
38
10e4f239
MT
39print "Creating custom directories ";
40mkdir("$dbdir/custom");
41mkdir("$dbdir/custom/allowed");
42mkdir("$dbdir/custom/blocked");
43system("touch $dbdir/custom/allowed/domains");
44system("touch $dbdir/custom/allowed/urls");
45system("touch $dbdir/custom/blocked/domains");
46system("touch $dbdir/custom/blocked/urls");
47print "\n";
48
3fbe7122
AF
49print "Building blacklist databases ";
50system("$swroot/urlfilter/bin/prebuild.pl");
51print "\n";
52
10e4f239 53exit