]>
Commit | Line | Data |
---|---|---|
d9b7aa33 | 1 | #!/usr/bin/perl |
70df8302 MT |
2 | ############################################################################### |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007 Michael Tremer & Christian Schmidt # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
d9b7aa33 MT |
21 | |
22 | use strict; | |
23 | # enable only the following on debugging purpose | |
cb5e9c6c CS |
24 | #use warnings; |
25 | #use CGI::Carp 'fatalsToBrowser'; | |
d9b7aa33 MT |
26 | |
27 | require '/var/ipfire/general-functions.pl'; | |
28 | require "${General::swroot}/lang.pl"; | |
29 | require "${General::swroot}/header.pl"; | |
30 | ||
31 | my %outfwsettings = (); | |
32 | my %checked = (); | |
33 | my %selected= () ; | |
34 | my %netsettings = (); | |
35 | my $errormessage = ""; | |
36 | my $configentry = ""; | |
37 | my @configs = (); | |
38 | my @configline = (); | |
39 | my $p2pentry = ""; | |
40 | my @p2ps = (); | |
41 | my @p2pline = (); | |
42 | ||
43 | my $configfile = "/var/ipfire/outgoing/rules"; | |
44 | my $p2pfile = "/var/ipfire/outgoing/p2protocols"; | |
f2fdd0c1 CS |
45 | my $servicefile = "/var/ipfire/outgoing/defaultservices"; |
46 | ||
47 | my %color = (); | |
48 | my %mainsettings = (); | |
49 | &General::readhash("${General::swroot}/main/settings", \%mainsettings); | |
50 | &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); | |
d9b7aa33 MT |
51 | |
52 | &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); | |
53 | ||
54 | &Header::showhttpheaders(); | |
55 | ||
56 | ### Values that have to be initialized | |
57 | $outfwsettings{'ACTION'} = ''; | |
58 | $outfwsettings{'VALID'} = 'yes'; | |
59 | $outfwsettings{'EDIT'} = 'no'; | |
60 | $outfwsettings{'NAME'} = ''; | |
61 | $outfwsettings{'SNET'} = ''; | |
62 | $outfwsettings{'SIP'} = ''; | |
63 | $outfwsettings{'SPORT'} = ''; | |
64 | $outfwsettings{'SMAC'} = ''; | |
65 | $outfwsettings{'DIP'} = ''; | |
66 | $outfwsettings{'DPORT'} = ''; | |
67 | $outfwsettings{'PROT'} = ''; | |
68 | $outfwsettings{'STATE'} = ''; | |
69 | $outfwsettings{'DISPLAY_DIP'} = ''; | |
70 | $outfwsettings{'DISPLAY_DPORT'} = ''; | |
71 | $outfwsettings{'DISPLAY_SMAC'} = ''; | |
72 | $outfwsettings{'DISPLAY_SIP'} = ''; | |
1fde937c | 73 | $outfwsettings{'POLICY'} = 'MODE0'; |
d9b7aa33 MT |
74 | |
75 | &General::readhash("${General::swroot}/outgoing/settings", \%outfwsettings); | |
76 | &Header::getcgihash(\%outfwsettings); | |
77 | ||
78 | if ($outfwsettings{'POLICY'} eq 'MODE0'){ $selected{'POLICY'}{'MODE0'} = 'selected'; } else { $selected{'POLICY'}{'MODE0'} = ''; } | |
79 | if ($outfwsettings{'POLICY'} eq 'MODE1'){ $selected{'POLICY'}{'MODE1'} = 'selected'; } else { $selected{'POLICY'}{'MODE1'} = ''; } | |
80 | if ($outfwsettings{'POLICY'} eq 'MODE2'){ $selected{'POLICY'}{'MODE2'} = 'selected'; } else { $selected{'POLICY'}{'MODE2'} = ''; } | |
81 | ||
82 | &Header::openpage('Ausgehende Firewall', 1, ''); | |
d9b7aa33 MT |
83 | &Header::openbigbox('100%', 'left', '', $errormessage); |
84 | ||
85 | ############################################################################################################################ | |
86 | ############################################################################################################################ | |
87 | ||
88 | if ($outfwsettings{'ACTION'} eq $Lang::tr{'reset'}) | |
89 | { | |
90 | $outfwsettings{'POLICY'}='MODE0'; | |
91 | unlink $configfile; | |
9833e7d8 | 92 | system("/usr/bin/touch $configfile"); |
9141bd34 CS |
93 | my $MODE = $outfwsettings{'POLICY'}; |
94 | %outfwsettings = (); | |
95 | $outfwsettings{'POLICY'} = "$MODE"; | |
d9b7aa33 MT |
96 | &General::writehash("${General::swroot}/outgoing/settings", \%outfwsettings); |
97 | } | |
98 | if ($outfwsettings{'ACTION'} eq $Lang::tr{'save'}) | |
99 | { | |
9141bd34 CS |
100 | my $MODE = $outfwsettings{'POLICY'}; |
101 | %outfwsettings = (); | |
102 | $outfwsettings{'POLICY'} = "$MODE"; | |
d9b7aa33 | 103 | &General::writehash("${General::swroot}/outgoing/settings", \%outfwsettings); |
9141bd34 | 104 | system("/usr/local/bin/outgoingfwctrl"); |
d9b7aa33 MT |
105 | } |
106 | if ($outfwsettings{'ACTION'} eq 'enable') | |
107 | { | |
108 | open( FILE, "< $p2pfile" ) or die "Unable to read $p2pfile"; | |
109 | @p2ps = <FILE>; | |
110 | close FILE; | |
111 | open( FILE, "> $p2pfile" ) or die "Unable to write $p2pfile"; | |
112 | foreach $p2pentry (sort @p2ps) | |
113 | { | |
114 | @p2pline = split( /\;/, $p2pentry ); | |
115 | if ($p2pline[1] eq $outfwsettings{'P2PROT'}) { | |
116 | print FILE "$p2pline[0];$p2pline[1];on;\n"; | |
117 | } else { | |
118 | print FILE "$p2pline[0];$p2pline[1];$p2pline[2];\n"; | |
119 | } | |
120 | } | |
121 | close FILE; | |
9141bd34 | 122 | system("/usr/local/bin/outgoingfwctrl"); |
d9b7aa33 MT |
123 | } |
124 | if ($outfwsettings{'ACTION'} eq 'disable') | |
125 | { | |
126 | open( FILE, "< $p2pfile" ) or die "Unable to read $p2pfile"; | |
127 | @p2ps = <FILE>; | |
128 | close FILE; | |
129 | open( FILE, "> $p2pfile" ) or die "Unable to write $p2pfile"; | |
130 | foreach $p2pentry (sort @p2ps) | |
131 | { | |
132 | @p2pline = split( /\;/, $p2pentry ); | |
133 | if ($p2pline[1] eq $outfwsettings{'P2PROT'}) { | |
134 | print FILE "$p2pline[0];$p2pline[1];off;\n"; | |
135 | } else { | |
136 | print FILE "$p2pline[0];$p2pline[1];$p2pline[2];\n"; | |
137 | } | |
138 | } | |
139 | close FILE; | |
9141bd34 | 140 | system("/usr/local/bin/outgoingfwctrl"); |
d9b7aa33 MT |
141 | } |
142 | if ($outfwsettings{'ACTION'} eq $Lang::tr{'edit'}) | |
143 | { | |
144 | open( FILE, "< $configfile" ) or die "Unable to read $configfile"; | |
145 | @configs = <FILE>; | |
146 | close FILE; | |
147 | open( FILE, "> $configfile" ) or die "Unable to write $configfile"; | |
148 | foreach $configentry (sort @configs) | |
149 | { | |
150 | @configline = split( /\;/, $configentry ); | |
151 | unless (($configline[0] eq $outfwsettings{'STATE'}) && | |
152 | ($configline[1] eq $outfwsettings{'ENABLED'}) && | |
153 | ($configline[2] eq $outfwsettings{'SNET'}) && | |
154 | ($configline[3] eq $outfwsettings{'PROT'}) && | |
155 | ($configline[4] eq $outfwsettings{'NAME'}) && | |
156 | ($configline[5] eq $outfwsettings{'SIP'}) && | |
157 | ($configline[6] eq $outfwsettings{'SMAC'}) && | |
9141bd34 CS |
158 | ($configline[7] eq $outfwsettings{'DIP'}) && |
159 | ($configline[9] eq $outfwsettings{'LOG'}) && | |
d9b7aa33 MT |
160 | ($configline[8] eq $outfwsettings{'DPORT'})) |
161 | { | |
162 | print FILE $configentry; | |
163 | } | |
164 | } | |
165 | close FILE; | |
ebb9187c MT |
166 | $selected{'SNET'}{"$outfwsettings{'SNET'}"} = 'selected'; |
167 | $selected{'PROT'}{"$outfwsettings{'PROT'}"} = 'selected'; | |
9141bd34 | 168 | $selected{'LOG'}{"$outfwsettings{'LOG'}"} = 'selected'; |
d9b7aa33 MT |
169 | &addrule(); |
170 | &Header::closebigbox(); | |
171 | &Header::closepage(); | |
9141bd34 CS |
172 | exit |
173 | system("/usr/local/bin/outgoingfwctrl"); | |
d9b7aa33 MT |
174 | } |
175 | if ($outfwsettings{'ACTION'} eq $Lang::tr{'delete'}) | |
176 | { | |
177 | open( FILE, "< $configfile" ) or die "Unable to read $configfile"; | |
178 | @configs = <FILE>; | |
179 | close FILE; | |
180 | open( FILE, "> $configfile" ) or die "Unable to write $configfile"; | |
181 | foreach $configentry (sort @configs) | |
182 | { | |
183 | @configline = split( /\;/, $configentry ); | |
184 | unless (($configline[0] eq $outfwsettings{'STATE'}) && | |
185 | ($configline[1] eq $outfwsettings{'ENABLED'}) && | |
186 | ($configline[2] eq $outfwsettings{'SNET'}) && | |
187 | ($configline[3] eq $outfwsettings{'PROT'}) && | |
188 | ($configline[4] eq $outfwsettings{'NAME'}) && | |
189 | ($configline[5] eq $outfwsettings{'SIP'}) && | |
190 | ($configline[6] eq $outfwsettings{'SMAC'}) && | |
191 | ($configline[7] eq $outfwsettings{'DIP'}) && | |
9141bd34 | 192 | ($configline[9] eq $outfwsettings{'LOG'}) && |
d9b7aa33 MT |
193 | ($configline[8] eq $outfwsettings{'DPORT'})) |
194 | { | |
195 | print FILE $configentry; | |
196 | } | |
197 | } | |
198 | close FILE; | |
9141bd34 | 199 | system("/usr/local/bin/outgoingfwctrl"); |
d9b7aa33 MT |
200 | } |
201 | if ($outfwsettings{'ACTION'} eq $Lang::tr{'add'}) | |
202 | { | |
203 | if ( $outfwsettings{'VALID'} eq 'yes' ) { | |
204 | open( FILE, ">> $configfile" ) or die "Unable to write $configfile"; | |
205 | print FILE <<END | |
9141bd34 | 206 | $outfwsettings{'STATE'};$outfwsettings{'ENABLED'};$outfwsettings{'SNET'};$outfwsettings{'PROT'};$outfwsettings{'NAME'};$outfwsettings{'SIP'};$outfwsettings{'SMAC'};$outfwsettings{'DIP'};$outfwsettings{'DPORT'};$outfwsettings{'LOG'}; |
d9b7aa33 MT |
207 | END |
208 | ; | |
209 | close FILE; | |
9141bd34 | 210 | system("/usr/local/bin/outgoingfwctrl"); |
d9b7aa33 | 211 | } else { |
ebb9187c | 212 | $outfwsettings{'ACTION'} = 'Add rule'; |
d9b7aa33 MT |
213 | } |
214 | } | |
ebb9187c | 215 | if ($outfwsettings{'ACTION'} eq 'Add rule') |
d9b7aa33 MT |
216 | { |
217 | &addrule(); | |
218 | exit | |
219 | } | |
220 | ||
221 | &General::readhash("${General::swroot}/outgoing/settings", \%outfwsettings); | |
222 | ||
223 | if ($errormessage) { | |
224 | &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); | |
225 | print "<class name='base'>$errormessage\n"; | |
226 | print " </class>\n"; | |
227 | &Header::closebox(); | |
228 | } | |
229 | ||
230 | ############################################################################################################################ | |
231 | ############################################################################################################################ | |
232 | ||
233 | if ($outfwsettings{'POLICY'} ne 'MODE0'){ | |
234 | &Header::openbox('100%', 'center', 'Rules'); | |
235 | print <<END | |
236 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
c41c2eb4 | 237 | <input type='submit' name='ACTION' value='Add rule' /> |
ebb9187c | 238 | </form> |
d9b7aa33 MT |
239 | END |
240 | ; | |
241 | open( FILE, "< $configfile" ) or die "Unable to read $configfile"; | |
242 | @configs = <FILE>; | |
243 | close FILE; | |
244 | if (@configs) { | |
245 | print <<END | |
c41c2eb4 | 246 | <hr /> |
d9b7aa33 | 247 | <table border='0' width='100%' cellspacing='0'> |
f2fdd0c1 CS |
248 | <tr bgcolor='$color{'color22'}'> |
249 | <td width='14%' align='center'><b>Protokoll</b> | |
250 | <td width='14%' align='center'><b>Netzwerk</b> | |
251 | <td width='14%' align='center'><b>Ziel</b> | |
252 | <td width='14%' align='center'><b>Anmerkung</b> | |
253 | <td width='14%' align='center'><b>Politik</b> | |
9141bd34 CS |
254 | <td width='16%' align='center'><b>Logging</b> |
255 | <td width='14%' align='center'><b>Aktionen</b> | |
d9b7aa33 MT |
256 | END |
257 | ; | |
258 | foreach $configentry (sort @configs) | |
259 | { | |
260 | @configline = split( /\;/, $configentry ); | |
261 | $outfwsettings{'STATE'} = $configline[0]; | |
262 | $outfwsettings{'ENABLED'} = $configline[1]; | |
263 | $outfwsettings{'SNET'} = $configline[2]; | |
264 | $outfwsettings{'PROT'} = $configline[3]; | |
265 | $outfwsettings{'NAME'} = $configline[4]; | |
266 | $outfwsettings{'SIP'} = $configline[5]; | |
267 | $outfwsettings{'SMAC'} = $configline[6]; | |
268 | $outfwsettings{'DIP'} = $configline[7]; | |
269 | $outfwsettings{'DPORT'} = $configline[8]; | |
9141bd34 | 270 | $outfwsettings{'LOG'} = $configline[9]; |
d9b7aa33 MT |
271 | if ($outfwsettings{'DIP'} eq ''){ $outfwsettings{'DISPLAY_DIP'} = 'ALL'; } else { $outfwsettings{'DISPLAY_DIP'} = $outfwsettings{'DIP'}; } |
272 | if ($outfwsettings{'DPORT'} eq ''){ $outfwsettings{'DISPLAY_DPORT'} = 'ALL'; } else { $outfwsettings{'DISPLAY_DPORT'} = $outfwsettings{'DPORT'}; } | |
9141bd34 CS |
273 | if ($outfwsettings{'STATE'} eq 'DENY'){ $outfwsettings{'DISPLAY_STATE'} = "<img src='/images/stock_stop.png' alt='DENY' />"; } |
274 | if ($outfwsettings{'STATE'} eq 'ALLOW'){ $outfwsettings{'DISPLAY_STATE'} = "<img src='/images/stock_ok.png' alt='ALLOW' />"; } | |
d9b7aa33 MT |
275 | if ((($outfwsettings{'POLICY'} eq 'MODE1') && ($outfwsettings{'STATE'} eq 'ALLOW')) || (($outfwsettings{'POLICY'} eq 'MODE2') && ($outfwsettings{'STATE'} eq 'DENY'))){ |
276 | print <<END | |
f2fdd0c1 | 277 | <tr bgcolor='$color{'color20'}'> |
ebb9187c MT |
278 | <td align='center'>$outfwsettings{'PROT'} |
279 | <td align='center'>$outfwsettings{'SNET'} | |
280 | <td align='center'>$outfwsettings{'DISPLAY_DIP'}:$outfwsettings{'DISPLAY_DPORT'} | |
281 | <td align='center'>$outfwsettings{'NAME'} | |
282 | <td align='center'>$outfwsettings{'DISPLAY_STATE'} | |
9141bd34 CS |
283 | <td align='center'>$outfwsettings{'LOG'} |
284 | <td align='center'> | |
ebb9187c MT |
285 | <table border='0' cellpadding='0' cellspacing='0'><tr> |
286 | <td><form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
9141bd34 CS |
287 | <input type='hidden' name='PROT' value='$outfwsettings{'PROT'}' /> |
288 | <input type='hidden' name='STATE' value='$outfwsettings{'STATE'}' /> | |
289 | <input type='hidden' name='SNET' value='$outfwsettings{'SNET'}' /> | |
290 | <input type='hidden' name='DPORT' value='$outfwsettings{'DPORT'}' /> | |
291 | <input type='hidden' name='DIP' value='$outfwsettings{'DIP'}' /> | |
292 | <input type='hidden' name='SIP' value='$outfwsettings{'SIP'}' /> | |
293 | <input type='hidden' name='NAME' value='$outfwsettings{'NAME'}' /> | |
294 | <input type='hidden' name='SMAC' value='$outfwsettings{'SMAC'}' /> | |
295 | <input type='hidden' name='ENABLED' value='$outfwsettings{'ENABLED'}' /> | |
296 | <input type='hidden' name='LOG' value='$outfwsettings{'LOG'}' /> | |
297 | <input type='hidden' name='ACTION' value=$Lang::tr{'edit'} /> | |
298 | <input type='image' src='/images/edit.gif' width="20" height="20" alt=$Lang::tr{'edit'} /> | |
ebb9187c MT |
299 | </form> |
300 | <td><form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
9141bd34 CS |
301 | <input type='hidden' name='PROT' value='$outfwsettings{'PROT'}' /> |
302 | <input type='hidden' name='STATE' value='$outfwsettings{'STATE'}' /> | |
303 | <input type='hidden' name='SNET' value='$outfwsettings{'SNET'}' /> | |
304 | <input type='hidden' name='DPORT' value='$outfwsettings{'DPORT'}' /> | |
305 | <input type='hidden' name='DIP' value='$outfwsettings{'DIP'}' /> | |
306 | <input type='hidden' name='SIP' value='$outfwsettings{'SIP'}' /> | |
307 | <input type='hidden' name='NAME' value='$outfwsettings{'NAME'}' /> | |
308 | <input type='hidden' name='SMAC' value='$outfwsettings{'SMAC'}' /> | |
309 | <input type='hidden' name='ENABLED' value='$outfwsettings{'ENABLED'}' /> | |
310 | <input type='hidden' name='LOG' value='$outfwsettings{'LOG'}' /> | |
311 | <input type='hidden' name='ACTION' value=$Lang::tr{'delete'} /> | |
312 | <input type='image' src='/images/delete.gif' width="20" height="20" alt=$Lang::tr{'delete'} /> | |
ebb9187c | 313 | </form></table> |
d9b7aa33 MT |
314 | END |
315 | ; | |
316 | if (($outfwsettings{'SIP'}) || ($outfwsettings{'SMAC'})) { | |
ebb9187c MT |
317 | unless ($outfwsettings{'SIP'}) { $outfwsettings{'DISPLAY_SIP'} = 'ALL'; } else { $outfwsettings{'DISPLAY_SIP'} = $outfwsettings{'SIP'}; } |
318 | unless ($outfwsettings{'SMAC'}) { $outfwsettings{'DISPLAY_SMAC'} = 'ALL'; } else { $outfwsettings{'DISPLAY_SMAC'} = $outfwsettings{'SMAC'}; } | |
d9b7aa33 | 319 | print <<END |
ebb9187c MT |
320 | <tr><td width='14%' align='right'>Quell-IP-Adresse: |
321 | <td width='14%' align='left'>$outfwsettings{'DISPLAY_SIP'} | |
322 | <td width='14%' align='right'>Quell-MAC-Adresse: | |
323 | <td width='14%' align='left'>$outfwsettings{'DISPLAY_SMAC'} | |
324 | <td width='44%' colspan='2' align='center'> | |
d9b7aa33 MT |
325 | END |
326 | ; | |
327 | } | |
328 | print <<END | |
329 | </form> | |
330 | END | |
331 | ; | |
332 | } | |
333 | } | |
334 | print <<END | |
335 | </table> | |
336 | END | |
337 | ; | |
338 | ||
339 | } | |
d9b7aa33 MT |
340 | &Header::closebox(); |
341 | } | |
342 | ||
9141bd34 | 343 | if ($outfwsettings{'POLICY'} ne 'MODE0'){ |
d9b7aa33 MT |
344 | open( FILE, "< $p2pfile" ) or die "Unable to read $p2pfile"; |
345 | @p2ps = <FILE>; | |
346 | close FILE; | |
347 | &Header::openbox('100%', 'center', 'P2P-Block'); | |
348 | print <<END | |
349 | <table width='40%'> | |
9141bd34 CS |
350 | <tr bgcolor='$color{'color22'}'><td width='66%' align=center><b>Protokoll</b> |
351 | <td width='33%' align=center><b>Status</b> | |
d9b7aa33 MT |
352 | END |
353 | ; | |
ebb9187c | 354 | my $id = 1; |
d9b7aa33 MT |
355 | foreach $p2pentry (sort @p2ps) |
356 | { | |
357 | @p2pline = split( /\;/, $p2pentry ); | |
358 | print <<END | |
359 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
ebb9187c MT |
360 | END |
361 | ; | |
9141bd34 | 362 | print "\t\t\t<tr bgcolor='$color{'color20'}'>\n"; |
f2fdd0c1 | 363 | print <<END |
ebb9187c | 364 | <td width='66%' align='center'>$p2pline[0]: |
9141bd34 | 365 | <td width='33%' align='center'><input type='hidden' name='P2PROT' value='$p2pline[1]' /> |
d9b7aa33 MT |
366 | END |
367 | ; | |
368 | if ($p2pline[2] eq 'on') { | |
369 | print <<END | |
9141bd34 CS |
370 | <input type='hidden' name='ACTION' value='disable' /> |
371 | <input type='image' name='submit' src='/images/stock_ok.png' alt='' /> | |
d9b7aa33 MT |
372 | END |
373 | ; | |
374 | } else { | |
375 | print <<END | |
9141bd34 CS |
376 | <input type='hidden' name='ACTION' value='enable' /> |
377 | <input type='image' name='submit' src='/images/stock_stop.png' alt='' /> | |
d9b7aa33 MT |
378 | END |
379 | ; | |
380 | } | |
381 | print <<END | |
382 | </form> | |
383 | END | |
384 | ; | |
385 | } | |
386 | print <<END | |
d9b7aa33 | 387 | </table> |
9141bd34 | 388 | <br />Klicken Sie auf die Symbole um das entsprechende iptables P2P-Blockmodul zu (de-)aktivieren. |
d9b7aa33 MT |
389 | END |
390 | ; | |
391 | &Header::closebox(); | |
392 | } | |
393 | ||
394 | &Header::openbox('100%', 'center', 'Policy'); | |
395 | print <<END | |
396 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
397 | <table width='100%'> | |
9141bd34 CS |
398 | <tr><td width='10%' align='left'><b>Modus 0:</b><td width='90%' align='left' colspan='2'>In diesem Modus ist es allen Rechnern im Netzwerk uneingeschraenkt moeglich Verbindungen ins Internet aufzubauen.</td></tr> |
399 | <tr><td width='10%' align='left'><b>Modus 1:</b><td width='90%' align='left' colspan='2'>In diesem Modus werden nur Verbindungen nach den oben definierten Regeln zugelassen.</td></tr> | |
400 | <tr><td width='10%' align='left'><b>Modus 2:</b><td width='90%' align='left' colspan='2'>In diesem Modus werden saemtliche Verbindungen erlaubt, bis auf die oben definierten Block-Regeln.</td></tr> | |
401 | <tr><td colspan='3'><hr /></td></tr> | |
115340d2 | 402 | <tr><td width='10%' align='left'> <select name='POLICY' style="width: 85px"><option value='MODE0' $selected{'POLICY'}{'MODE0'}>Modus 0</option><option value='MODE1' $selected{'POLICY'}{'MODE1'}>Modus 1</option><option value='MODE2' $selected{'POLICY'}{'MODE2'}>Modus 2</option></select> |
c41c2eb4 | 403 | <td width='45%' align='left'><input type='submit' name='ACTION' value=$Lang::tr{'save'} /> |
115340d2 | 404 | <td width='45%' align='left'> |
d9b7aa33 MT |
405 | END |
406 | ; | |
407 | if ($outfwsettings{'POLICY'} ne 'MODE0') { | |
408 | print <<END | |
c41c2eb4 | 409 | Alle Regeln loeschen: <input type='submit' name='ACTION' value=$Lang::tr{'reset'} /> |
d9b7aa33 MT |
410 | END |
411 | ; | |
412 | } | |
413 | print <<END | |
414 | </table> | |
415 | </form> | |
416 | END | |
417 | ; | |
418 | &Header::closebox(); | |
419 | ||
420 | &Header::closebigbox(); | |
421 | &Header::closepage(); | |
422 | ||
423 | ############################################################################################################################ | |
424 | ############################################################################################################################ | |
425 | ||
426 | sub addrule | |
427 | { | |
428 | &Header::openbox('100%', 'center', 'Rules hinzufuegen'); | |
429 | if ($outfwsettings{'EDIT'} eq 'no') { $selected{'ENABLED'} = 'checked'; } | |
430 | print <<END | |
431 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
432 | <table width='80%'> | |
9141bd34 CS |
433 | <tr><td width='20%' align='right'>Anmerkung: <img src='/blob.gif' /> |
434 | <td width='30%' align='left'><input type='text' name='NAME' maxlength='30' value='$outfwsettings{'NAME'}' /> | |
d9b7aa33 | 435 | <td width='20%' align='right'>Aktiviert: |
9141bd34 | 436 | <td width='30%' align='left'><input type='checkbox' name='ENABLED' $selected{'ENABLED'} /> |
d9b7aa33 | 437 | <tr><td width='20%' align='right'>Protokoll: |
ebb9187c | 438 | <td width='30%' align='left'><select name='PROT'><option value='tcp' $selected{'PROT'}{'tcp'}>TCP</option><option value='tcp&udp' $selected{'PROT'}{'tcp&udp'}>TCP & UDP</option><option value='udp' $selected{'PROT'}{'udp'}>UDP</option></select> |
d9b7aa33 MT |
439 | <td width='20%' align='right'>Sicherheitspolitik: |
440 | <td width='30%' align='left'> | |
441 | END | |
442 | ; | |
443 | if ($outfwsettings{'POLICY'} eq 'MODE1'){ | |
9141bd34 | 444 | print "\t\t\tALLOW<input type='hidden' name='STATE' value='ALLOW' />\n"; |
d9b7aa33 | 445 | } elsif ($outfwsettings{'POLICY'} eq 'MODE2'){ |
9141bd34 | 446 | print "\t\t\tDENY<input type='hidden' name='STATE' value='DENY' />\n"; |
d9b7aa33 MT |
447 | } |
448 | print <<END | |
449 | <tr><td width='20%' align='right'>Quellnetz: | |
450 | <td width='30%' align='left'><select name='SNET'> | |
451 | <option value='all' $selected{'SNET'}{'ALL'}>alle</option> | |
ebb9187c | 452 | <option value='ip' $selected{'SNET'}{'ip'}>Quell-IP/MAC benutzen</option> |
c41c2eb4 | 453 | <option value='green' $selected{'SNET'}{'green'}>$Lang::tr{'green'}</option> |
d9b7aa33 MT |
454 | END |
455 | ; | |
456 | if (&Header::blue_used()){ | |
c41c2eb4 | 457 | print "\t\t\t<option value='blue' $selected{'SNET'}{'blue'}>$Lang::tr{'wireless'}</option>\n"; |
d9b7aa33 MT |
458 | } |
459 | if (&Header::orange_used()){ | |
c41c2eb4 | 460 | print "\t\t\t<option value='orange' $selected{'SNET'}{'orange'}>$Lang::tr{'dmz'}</option>\n"; |
d9b7aa33 MT |
461 | } |
462 | print <<END | |
463 | </select> | |
9141bd34 CS |
464 | <td width='20%' align='right'>Quell-IP-Adresse: <img src='/blob.gif' /> |
465 | <td width='30%' align='left'><input type='text' name='SIP' maxlength='15' value='$outfwsettings{'SIP'}' /> | |
466 | <tr><td width='20%' align='right'>Logging: | |
467 | <td width='30%' align='left'><select name='LOG'><option value='$Lang::tr{'active'}' $selected{'LOG'}{$Lang::tr{'active'}}>$Lang::tr{'active'}</option><option value='$Lang::tr{'inactive'}' $selected{'LOG'}{$Lang::tr{'inactive'}}>$Lang::tr{'inactive'}</option></select></td> | |
468 | <td width='20%' align='right'>Quell-MAC-Adresse: <img src='/blob.gif' /> | |
469 | <td width='30%' align='left'><input type='text' name='SMAC' maxlength='23' value='$outfwsettings{'SMAC'}' /> | |
470 | <tr><td width='20%' align='right'>Ziel-IP-Adresse: <img src='/blob.gif' /> | |
471 | <td width='30%' align='left'><input type='text' name='DIP' maxlength='15' value='$outfwsettings{'DIP'}' /> | |
472 | <td width='20%' align='right'>Ziel-Port: <img src='/blob.gif' /> | |
473 | <td width='30%' align='left'><input type='text' name='DPORT' maxlength='11' value='$outfwsettings{'DPORT'}' /> | |
d9b7aa33 | 474 | <tr><td colspan='4'> |
9141bd34 CS |
475 | <tr><td width='40%' align='right' colspan='2'><img src='/blob.gif' />$Lang::tr{'this field may be blank'} |
476 | <td width='60%' align='left' colspan='2'><input type='submit' name='ACTION' value=$Lang::tr{'add'} /> | |
d9b7aa33 MT |
477 | </table></form> |
478 | END | |
479 | ; | |
480 | &Header::closebox(); | |
c41c2eb4 | 481 | |
afbda815 | 482 | if ($outfwsettings{'POLICY'} eq 'MODE1' || $outfwsettings{'POLICY'} eq 'MODE2') |
c41c2eb4 CS |
483 | { |
484 | &Header::openbox('100%', 'center', 'Quick Add'); | |
485 | ||
486 | open( FILE, "< /var/ipfire/outgoing/defaultservices" ) or die "Unable to read default services"; | |
487 | my @defservices = <FILE>; | |
488 | close FILE; | |
489 | ||
9141bd34 | 490 | print "<table width='100%'><tr bgcolor='$color{'color20'}'><td><b>$Lang::tr{'service'}</b></td><td><b>$Lang::tr{'description'}</b></td><td><b>$Lang::tr{'port'}</b></td><td><b>$Lang::tr{'protocol'}</b></td><td><b>$Lang::tr{'source net'}</b></td><td><b>$Lang::tr{'logging'}</b></td><td></td></tr>"; |
c41c2eb4 CS |
491 | foreach my $serviceline(@defservices) |
492 | { | |
493 | my @service = split(/,/,$serviceline); | |
494 | print <<END | |
495 | <tr><form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
496 | <td>$service[0]<input type='hidden' name='NAME' value='@service[0]' /></td> | |
497 | <td>$service[3]</td> | |
498 | <td><a href='http://isc.sans.org/port_details.php?port=$service[1]' target='top'>$service[1]</a><input type='hidden' name='DPORT' value='@service[1]' /></td> | |
499 | <td>$service[2]<input type='hidden' name='PROT' value='@service[2]' /></td> | |
500 | <td><select name='SNET'><option value='all' $selected{'SNET'}{'ALL'}>$Lang::tr{'all'}</option><option value='green' $selected{'SNET'}{'green'}>$Lang::tr{'green'}</option> | |
501 | END | |
502 | ; | |
503 | if (&Header::blue_used()){ | |
504 | print "<option value='blue' $selected{'SNET'}{'blue'}>$Lang::tr{'wireless'}</option>"; | |
505 | } | |
506 | if (&Header::orange_used()){ | |
507 | print "<option value='orange' $selected{'SNET'}{'orange'}>$Lang::tr{'dmz'}</option>"; | |
508 | } | |
509 | print <<END | |
9141bd34 CS |
510 | </select></td> |
511 | <td><select name='LOG'><option value='$Lang::tr{'active'}'>$Lang::tr{'active'}</option><option value='$Lang::tr{'inactive'}' 'selected'>$Lang::tr{'inactive'}</option></select></td><td> | |
c41c2eb4 CS |
512 | <input type='hidden' name='ACTION' value=$Lang::tr{'add'} /> |
513 | <input type='image' alt='$Lang::tr{'add'}' src='/images/add.gif' /> | |
514 | <input type='hidden' name='ENABLED' value='on' /> | |
c41c2eb4 CS |
515 | END |
516 | ; | |
9141bd34 CS |
517 | if ($outfwsettings{'POLICY'} eq 'MODE1'){ print "<input type='hidden' name='STATE' value='ALLOW' /></form></td></tr>";} |
518 | elsif ($outfwsettings{'POLICY'} eq 'MODE2'){print "<input type='hidden' name='STATE' value='DENY' /></form></td></tr>";} | |
c41c2eb4 | 519 | } |
9141bd34 | 520 | print "</table>"; |
c41c2eb4 | 521 | &Header::closebox(); |
9141bd34 | 522 | } |
c41c2eb4 | 523 | } |