Forward Firewall: First part of adding OUTGOING to th efirewall
[people/teissler/ipfire-2.x.git] / html / cgi-bin / optionsfw.cgi
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
19 require '/var/ipfire/general-functions.pl';
20 require "${General::swroot}/lang.pl";
21 require "${General::swroot}/header.pl";
22
23
24 my %checked =(); # Checkbox manipulations
25
26 # File used
27 my $filename = "${General::swroot}/optionsfw/settings";
28
29 our %settings=();
30 $settings{'DISABLEPING'} = 'NO';
31 $settings{'DROPNEWNOTSYN'} = 'on';
32 $settings{'DROPINPUT'} = 'on';
33 $settings{'DROPFORWARD'} = 'on';
34 $settings{'DROPOUTGOING'} = 'on';
35 $settings{'DROPPORTSCAN'} = 'on';
36 $settings{'DROPWIRELESSINPUT'} = 'on';
37 $settings{'DROPWIRELESSFORWARD'} = 'on';
38
39 my $errormessage = '';
40 my $warnmessage = '';
41
42 &Header::showhttpheaders();
43
44 #Get GUI values
45 &Header::getcgihash(\%settings);
46
47 if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
48
49 $errormessage = $Lang::tr{'new optionsfw later'};
50 delete $settings{'__CGI__'};
51 delete $settings{'x'};
52 delete $settings{'y'};
53 &General::writehash($filename, \%settings); # Save good settings
54 }else {
55 &General::readhash($filename, \%settings); # Get saved settings and reset to good if needed
56 }
57 system("/usr/local/bin/forwardfwctrl");
58 &Header::openpage($Lang::tr{'options fw'}, 1, '');
59 &Header::openbigbox('100%', 'left', '', $errormessage);
60
61 if ($errormessage) {
62 &Header::openbox('100%', 'left', $Lang::tr{'warning messages'});
63 print "<font color='red'>$errormessage&nbsp;</font>";
64 &Header::closebox();
65 }
66
67 $checked{'DROPNEWNOTSYN'}{'off'} = '';
68 $checked{'DROPNEWNOTSYN'}{'on'} = '';
69 $checked{'DROPNEWNOTSYN'}{$settings{'DROPNEWNOTSYN'}} = "checked='checked'";
70 $checked{'DROPINPUT'}{'off'} = '';
71 $checked{'DROPINPUT'}{'on'} = '';
72 $checked{'DROPINPUT'}{$settings{'DROPINPUT'}} = "checked='checked'";
73 $checked{'DROPFORWARD'}{'off'} = '';
74 $checked{'DROPFORWARD'}{'on'} = '';
75 $checked{'DROPFORWARD'}{$settings{'DROPFORWARD'}} = "checked='checked'";
76 $checked{'DROPOUTGOING'}{'off'} = '';
77 $checked{'DROPOUTGOING'}{'on'} = '';
78 $checked{'DROPOUTGOING'}{$settings{'DROPOUTGOING'}} = "checked='checked'";
79 $checked{'DROPPORTSCAN'}{'off'} = '';
80 $checked{'DROPPORTSCAN'}{'on'} = '';
81 $checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'";
82 $checked{'DROPWIRELESSINPUT'}{'off'} = '';
83 $checked{'DROPWIRELESSINPUT'}{'on'} = '';
84 $checked{'DROPWIRELESSINPUT'}{$settings{'DROPWIRELESSINPUT'}} = "checked='checked'";
85 $checked{'DROPWIRELESSFORWARD'}{'off'} = '';
86 $checked{'DROPWIRELESSFORWARD'}{'on'} = '';
87 $checked{'DROPWIRELESSFORWARD'}{$settings{'DROPWIRELESSFORWARD'}} = "checked='checked'";
88 $checked{'DROPPROXY'}{'off'} = '';
89 $checked{'DROPPROXY'}{'on'} = '';
90 $checked{'DROPPROXY'}{$settings{'DROPPROXY'}} = "checked='checked'";
91 $checked{'DROPSAMBA'}{'off'} = '';
92 $checked{'DROPSAMBA'}{'on'} = '';
93 $checked{'DROPSAMBA'}{$settings{'DROPSAMBA'}} = "checked='checked'";
94 $selected{'FWPOLICY'}{$settings{'FWPOLICY'}}= 'selected';
95
96 &Header::openbox('100%', 'center', $Lang::tr{'options fw'});
97 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
98
99 print <<END
100 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
101 <table width='95%' cellspacing='0'>
102 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw logging'}</b></td></tr>
103 <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'} />/
104 <input type='radio' name='DROPNEWNOTSYN' value='off' $checked{'DROPNEWNOTSYN'}{'off'} /> off</td></tr>
105 <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'} />/
106 <input type='radio' name='DROPINPUT' value='off' $checked{'DROPINPUT'}{'off'} /> off</td></tr>
107 <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'} />/
108 <input type='radio' name='DROPFORWARD' value='off' $checked{'DROPFORWARD'}{'off'} /> off</td></tr>
109 <tr><td align='left' width='60%'>$Lang::tr{'drop outgoing'}</td><td align='left'>on <input type='radio' name='DROPOUTGOING' value='on' $checked{'DROPOUTGOING'}{'on'} />/
110 <input type='radio' name='DROPOUTGOING' value='off' $checked{'DROPOUTGOING'}{'off'} /> off</td></tr>
111 <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'} />/
112 <input type='radio' name='DROPPORTSCAN' value='off' $checked{'DROPPORTSCAN'}{'off'} /> off</td></tr>
113 <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'} />/
114 <input type='radio' name='DROPWIRELESSINPUT' value='off' $checked{'DROPWIRELESSINPUT'}{'off'} /> off</td></tr>
115 <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'} />/
116 <input type='radio' name='DROPWIRELESSFORWARD' value='off' $checked{'DROPWIRELESSFORWARD'}{'off'} /> off</td></tr>
117 </table>
118 <br />
119 <table width='95%' cellspacing='0'>
120 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw blue'}</b></td></tr>
121 <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'} />/
122 <input type='radio' name='DROPPROXY' value='off' $checked{'DROPPROXY'}{'off'} /> off</td></tr>
123 <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'} />/
124 <input type='radio' name='DROPSAMBA' value='off' $checked{'DROPSAMBA'}{'off'} /> off</td></tr>
125 </table>
126 <br />
127 <table width='95%' cellspacing='0'>
128 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw default drop'}</b></td></tr>
129 <tr><td align='left' width='60%'>$Lang::tr{'drop action'}</td><td><select name='FWPOLICY'>
130 <option value='DROP' $selected{'FWPOLICY'}{'DROP'}>DROP</option>
131 <option value='REJECT' $selected{'FWPOLICY'}{'REJECT'}>REJECT</option></select>
132 </td></tr>
133 <tr><td align='left' width='60%'>$Lang::tr{'drop action1'}</td><td><select name='FWPOLICY1'>
134 <option value='DROP' $selected{'FWPOLICY1'}{'DROP'}>DROP</option>
135 <option value='REJECT' $selected{'FWPOLICY1'}{'REJECT'}>REJECT</option></select>
136 </td></tr>
137 </table>
138
139 <br />
140 <table width='10%' cellspacing='0'>
141 <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
142 <input type='submit' name='ACTION' value=$Lang::tr{'save'} />
143 </form></td></tr>
144 </table>
145 </form>
146 END
147 ;
148 &Header::closebox();
149 &Header::closebigbox();
150 &Header::closepage();