]>
Commit | Line | Data |
---|---|---|
10e4f239 MT |
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 "Building blacklist databases "; | |
40 | system("$swroot/urlfilter/bin/prebuild.pl"); | |
41 | print "\n"; | |
42 | ||
43 | print "Creating custom directories "; | |
44 | mkdir("$dbdir/custom"); | |
45 | mkdir("$dbdir/custom/allowed"); | |
46 | mkdir("$dbdir/custom/blocked"); | |
47 | system("touch $dbdir/custom/allowed/domains"); | |
48 | system("touch $dbdir/custom/allowed/urls"); | |
49 | system("touch $dbdir/custom/blocked/domains"); | |
50 | system("touch $dbdir/custom/blocked/urls"); | |
51 | print "\n"; | |
52 | ||
53 | exit | |
54 | #!/usr/bin/perl | |
55 | ||
56 | $swroot="/var/ipfire"; | |
57 | $logdir="/var/log/squidGuard"; | |
58 | $dbdir="/var/ipfire/urlfilter/blacklists"; | |
59 | ||
60 | print "Creating configuration file "; | |
61 | foreach $blacklist (<$dbdir/*>) | |
62 | { | |
63 | if (-d $blacklist) | |
64 | { | |
65 | $lastslashpos = rindex($blacklist,"/"); | |
66 | $section = substr($blacklist,$lastslashpos+1); | |
67 | push(@categories,$section); | |
68 | } | |
69 | } | |
70 | open(FILE, ">$swroot/urlfilter/squidGuard.conf"); | |
71 | print FILE "logdir $logdir\n"; | |
72 | print FILE "dbhome $dbdir\n\n"; | |
73 | foreach $category (@categories) | |
74 | { | |
75 | print FILE "dest $category {\n"; | |
76 | if (-e "$dbdir/$category/domains") { | |
77 | print FILE " domainlist $category\/domains\n"; | |
78 | } | |
79 | if (-e "$dbdir/$category/urls") { | |
80 | print FILE " urllist $category\/urls\n"; | |
81 | } | |
82 | print FILE "}\n\n"; | |
83 | } | |
84 | print FILE "acl {\n"; | |
85 | print FILE " default {\n"; | |
86 | print FILE " pass all\n"; | |
87 | print FILE " }\n"; | |
88 | print FILE "}\n"; | |
89 | close FILE; | |
90 | print "\n"; | |
91 | ||
92 | print "Building blacklist databases "; | |
93 | system("$swroot/urlfilter/bin/prebuild.pl"); | |
94 | print "\n"; | |
95 | ||
96 | print "Creating custom directories "; | |
97 | mkdir("$dbdir/custom"); | |
98 | mkdir("$dbdir/custom/allowed"); | |
99 | mkdir("$dbdir/custom/blocked"); | |
100 | system("touch $dbdir/custom/allowed/domains"); | |
101 | system("touch $dbdir/custom/allowed/urls"); | |
102 | system("touch $dbdir/custom/blocked/domains"); | |
103 | system("touch $dbdir/custom/blocked/urls"); | |
104 | print "\n"; | |
105 | ||
106 | exit | |
107 | #!/usr/bin/perl | |
108 | ||
109 | $swroot="/var/ipfire"; | |
110 | $logdir="/var/log/squidGuard"; | |
111 | $dbdir="/var/ipfire/urlfilter/blacklists"; | |
112 | ||
113 | print "Creating configuration file "; | |
114 | foreach $blacklist (<$dbdir/*>) | |
115 | { | |
116 | if (-d $blacklist) | |
117 | { | |
118 | $lastslashpos = rindex($blacklist,"/"); | |
119 | $section = substr($blacklist,$lastslashpos+1); | |
120 | push(@categories,$section); | |
121 | } | |
122 | } | |
123 | open(FILE, ">$swroot/urlfilter/squidGuard.conf"); | |
124 | print FILE "logdir $logdir\n"; | |
125 | print FILE "dbhome $dbdir\n\n"; | |
126 | foreach $category (@categories) | |
127 | { | |
128 | print FILE "dest $category {\n"; | |
129 | if (-e "$dbdir/$category/domains") { | |
130 | print FILE " domainlist $category\/domains\n"; | |
131 | } | |
132 | if (-e "$dbdir/$category/urls") { | |
133 | print FILE " urllist $category\/urls\n"; | |
134 | } | |
135 | print FILE "}\n\n"; | |
136 | } | |
137 | print FILE "acl {\n"; | |
138 | print FILE " default {\n"; | |
139 | print FILE " pass all\n"; | |
140 | print FILE " }\n"; | |
141 | print FILE "}\n"; | |
142 | close FILE; | |
143 | print "\n"; | |
144 | ||
145 | print "Building blacklist databases "; | |
146 | system("$swroot/urlfilter/bin/prebuild.pl"); | |
147 | print "\n"; | |
148 | ||
149 | print "Creating custom directories "; | |
150 | mkdir("$dbdir/custom"); | |
151 | mkdir("$dbdir/custom/allowed"); | |
152 | mkdir("$dbdir/custom/blocked"); | |
153 | system("touch $dbdir/custom/allowed/domains"); | |
154 | system("touch $dbdir/custom/allowed/urls"); | |
155 | system("touch $dbdir/custom/blocked/domains"); | |
156 | system("touch $dbdir/custom/blocked/urls"); | |
157 | print "\n"; | |
158 | ||
159 | exit |