Forward Firewall: fixed 12 Bugs from forum.
[people/teissler/ipfire-2.x.git] / html / cgi-bin / optionsfw.cgi
CommitLineData
5595bc03
CS
1#!/usr/bin/perl
2#
3# SmoothWall CGIs
4#
5# This code is distributed under the terms of the GPL
6#
7# (c) The SmoothWall Team
8#
9# Copyright (C) 01-02-2002 Graham Smith <grhm@grhm.co.uk>
10#
11# $Id: optionsfw.cgi,v 1.1.2.10 2005/10/03 00:34:10 gespinasse Exp $
12#
13#
14
15# enable only the following on debugging purpose
16#use warnings;
17#use CGI::Carp 'fatalsToBrowser';
18
19require '/var/ipfire/general-functions.pl';
20require "${General::swroot}/lang.pl";
21require "${General::swroot}/header.pl";
22
23
24my %checked =(); # Checkbox manipulations
25
26# File used
27my $filename = "${General::swroot}/optionsfw/settings";
28
29our %settings=();
30$settings{'DISABLEPING'} = 'NO';
31$settings{'DROPNEWNOTSYN'} = 'on';
32$settings{'DROPINPUT'} = 'on';
6be0579b 33$settings{'DROPFORWARD'} = 'on';
5595bc03 34$settings{'DROPPORTSCAN'} = 'on';
42dc0090
CS
35$settings{'DROPWIRELESSINPUT'} = 'on';
36$settings{'DROPWIRELESSFORWARD'} = 'on';
5595bc03
CS
37
38my $errormessage = '';
39my $warnmessage = '';
40
41&Header::showhttpheaders();
42
43#Get GUI values
44&Header::getcgihash(\%settings);
45
46if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
62fc8511 47
5595bc03 48 $errormessage = $Lang::tr{'new optionsfw later'};
62fc8511
AM
49 delete $settings{'__CGI__'};
50 delete $settings{'x'};
51 delete $settings{'y'};
5595bc03 52 &General::writehash($filename, \%settings); # Save good settings
62fc8511
AM
53 }else {
54 &General::readhash($filename, \%settings); # Get saved settings and reset to good if needed
55 }
56 system("/usr/local/bin/forwardfwctrl");
5595bc03
CS
57&Header::openpage($Lang::tr{'options fw'}, 1, '');
58&Header::openbigbox('100%', 'left', '', $errormessage);
59
60if ($errormessage) {
61 &Header::openbox('100%', 'left', $Lang::tr{'warning messages'});
62 print "<font color='red'>$errormessage&nbsp;</font>";
63 &Header::closebox();
64}
65
66$checked{'DROPNEWNOTSYN'}{'off'} = '';
67$checked{'DROPNEWNOTSYN'}{'on'} = '';
68$checked{'DROPNEWNOTSYN'}{$settings{'DROPNEWNOTSYN'}} = "checked='checked'";
69$checked{'DROPINPUT'}{'off'} = '';
70$checked{'DROPINPUT'}{'on'} = '';
71$checked{'DROPINPUT'}{$settings{'DROPINPUT'}} = "checked='checked'";
6be0579b
AM
72$checked{'DROPFORWARD'}{'off'} = '';
73$checked{'DROPFORWARD'}{'on'} = '';
74$checked{'DROPFORWARD'}{$settings{'DROPFORWARD'}} = "checked='checked'";
5595bc03
CS
75$checked{'DROPPORTSCAN'}{'off'} = '';
76$checked{'DROPPORTSCAN'}{'on'} = '';
77$checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'";
42dc0090
CS
78$checked{'DROPWIRELESSINPUT'}{'off'} = '';
79$checked{'DROPWIRELESSINPUT'}{'on'} = '';
80$checked{'DROPWIRELESSINPUT'}{$settings{'DROPWIRELESSINPUT'}} = "checked='checked'";
81$checked{'DROPWIRELESSFORWARD'}{'off'} = '';
82$checked{'DROPWIRELESSFORWARD'}{'on'} = '';
83$checked{'DROPWIRELESSFORWARD'}{$settings{'DROPWIRELESSFORWARD'}} = "checked='checked'";
0aaef8e9
CS
84$checked{'DROPPROXY'}{'off'} = '';
85$checked{'DROPPROXY'}{'on'} = '';
86$checked{'DROPPROXY'}{$settings{'DROPPROXY'}} = "checked='checked'";
87$checked{'DROPSAMBA'}{'off'} = '';
88$checked{'DROPSAMBA'}{'on'} = '';
89$checked{'DROPSAMBA'}{$settings{'DROPSAMBA'}} = "checked='checked'";
62fc8511 90$selected{'FWPOLICY'}{$settings{'FWPOLICY'}}= 'selected';
5595bc03
CS
91
92&Header::openbox('100%', 'center', $Lang::tr{'options fw'});
93print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
94
95print <<END
96<form method='post' action='$ENV{'SCRIPT_NAME'}'>
97<table width='95%' cellspacing='0'>
98<tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw logging'}</b></td></tr>
0b06ad05 99<tr><td align='left' width='60%'>$Lang::tr{'drop newnotsyn'}</td><td align='left'>on <input type='radio' name='DROPNEWNOTSYN' value='on' $checked{'DROPNEWNOTSYN'}{'on'} />/
5595bc03 100 <input type='radio' name='DROPNEWNOTSYN' value='off' $checked{'DROPNEWNOTSYN'}{'off'} /> off</td></tr>
0b06ad05 101<tr><td align='left' width='60%'>$Lang::tr{'drop input'}</td><td align='left'>on <input type='radio' name='DROPINPUT' value='on' $checked{'DROPINPUT'}{'on'} />/
5595bc03 102 <input type='radio' name='DROPINPUT' value='off' $checked{'DROPINPUT'}{'off'} /> off</td></tr>
6be0579b
AM
103<tr><td align='left' width='60%'>$Lang::tr{'drop forward'}</td><td align='left'>on <input type='radio' name='DROPFORWARD' value='on' $checked{'DROPFORWARD'}{'on'} />/
104 <input type='radio' name='DROPFORWARD' value='off' $checked{'DROPFORWARD'}{'off'} /> off</td></tr>
0b06ad05 105<tr><td align='left' width='60%'>$Lang::tr{'drop portscan'}</td><td align='left'>on <input type='radio' name='DROPPORTSCAN' value='on' $checked{'DROPPORTSCAN'}{'on'} />/
5595bc03 106 <input type='radio' name='DROPPORTSCAN' value='off' $checked{'DROPPORTSCAN'}{'off'} /> off</td></tr>
0b06ad05 107<tr><td align='left' width='60%'>$Lang::tr{'drop wirelessinput'}</td><td align='left'>on <input type='radio' name='DROPWIRELESSINPUT' value='on' $checked{'DROPWIRELESSINPUT'}{'on'} />/
42dc0090 108 <input type='radio' name='DROPWIRELESSINPUT' value='off' $checked{'DROPWIRELESSINPUT'}{'off'} /> off</td></tr>
0b06ad05 109<tr><td align='left' width='60%'>$Lang::tr{'drop wirelessforward'}</td><td align='left'>on <input type='radio' name='DROPWIRELESSFORWARD' value='on' $checked{'DROPWIRELESSFORWARD'}{'on'} />/
42dc0090 110 <input type='radio' name='DROPWIRELESSFORWARD' value='off' $checked{'DROPWIRELESSFORWARD'}{'off'} /> off</td></tr>
5595bc03
CS
111</table>
112<br />
0aaef8e9
CS
113<table width='95%' cellspacing='0'>
114<tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw blue'}</b></td></tr>
0b06ad05 115<tr><td align='left' width='60%'>$Lang::tr{'drop proxy'}</td><td align='left'>on <input type='radio' name='DROPPROXY' value='on' $checked{'DROPPROXY'}{'on'} />/
0aaef8e9 116 <input type='radio' name='DROPPROXY' value='off' $checked{'DROPPROXY'}{'off'} /> off</td></tr>
0b06ad05 117<tr><td align='left' width='60%'>$Lang::tr{'drop samba'}</td><td align='left'>on <input type='radio' name='DROPSAMBA' value='on' $checked{'DROPSAMBA'}{'on'} />/
0aaef8e9
CS
118 <input type='radio' name='DROPSAMBA' value='off' $checked{'DROPSAMBA'}{'off'} /> off</td></tr>
119</table>
62fc8511
AM
120<br />
121<table width='95%' cellspacing='0'>
122<tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw default drop'}</b></td></tr>
123<tr><td align='left' width='60%'>$Lang::tr{'drop action'}</td><td><select name='FWPOLICY'>
124<option value='DROP' $selected{'FWPOLICY'}{'DROP'}>DROP</option>
125<option value='REJECT' $selected{'FWPOLICY'}{'REJECT'}>REJECT</option></select>
126</td></tr>
127</table>
128
0aaef8e9 129<br />
5595bc03
CS
130<table width='10%' cellspacing='0'>
131<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
62fc8511
AM
132<input type='submit' name='ACTION' value=$Lang::tr{'save'} />
133</form></td></tr>
5595bc03
CS
134</table>
135</form>
136END
137;
138&Header::closebox();
139&Header::closebigbox();
140&Header::closepage();