]> git.ipfire.org Git - ipfire-2.x.git/blob - config/urlfilter/makeconf.pl
suricata: Change midstream policy to "pass-flow"
[ipfire-2.x.git] / config / urlfilter / makeconf.pl
1 #!/usr/bin/perl
2
3 $swroot="/var/ipfire";
4 $logdir="/var/log/squidGuard";
5 $dbdir="/var/ipfire/urlfilter/blacklists";
6
7 print "Creating configuration file ";
8 foreach $blacklist (<$dbdir/*>)
9 {
10 if (-d $blacklist)
11 {
12 $lastslashpos = rindex($blacklist,"/");
13 $section = substr($blacklist,$lastslashpos+1);
14 push(@categories,$section);
15 }
16 }
17 open(FILE, ">$swroot/urlfilter/squidGuard.conf");
18 print FILE "logdir $logdir\n";
19 print FILE "dbhome $dbdir\n\n";
20 foreach $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 }
31 print FILE "acl {\n";
32 print FILE " default {\n";
33 print FILE " pass all\n";
34 print FILE " }\n";
35 print FILE "}\n";
36 close FILE;
37 print "\n";
38
39 print "Creating custom directories ";
40 mkdir("$dbdir/custom");
41 mkdir("$dbdir/custom/allowed");
42 mkdir("$dbdir/custom/blocked");
43 system("touch $dbdir/custom/allowed/domains");
44 system("touch $dbdir/custom/allowed/urls");
45 system("touch $dbdir/custom/blocked/domains");
46 system("touch $dbdir/custom/blocked/urls");
47 print "\n";
48
49 print "Building blacklist databases ";
50 system("$swroot/urlfilter/bin/prebuild.pl");
51 print "\n";
52
53 exit