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