]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/optionsfw.cgi
5 # This code is distributed under the terms of the GPL
7 # (c) The SmoothWall Team
9 # Copyright (C) 01-02-2002 Graham Smith <grhm@grhm.co.uk>
11 # $Id: optionsfw.cgi,v 1.1.2.10 2005/10/03 00:34:10 gespinasse Exp $
14 # enable only the following on debugging purpose
16 #use CGI::Carp 'fatalsToBrowser';
18 require '/var/ipfire/general-functions.pl';
19 require "${General::swroot}/lang.pl";
20 require "${General::swroot}/header.pl";
23 my %checked =(); # Checkbox manipulations
27 my %configoutgoingfw=();
29 my $configfwdfw = "${General::swroot}/firewall/config";
30 my $configoutgoing = "${General::swroot}/firewall/outgoing";
31 my $errormessage = '';
33 my $filename = "${General::swroot}/optionsfw/settings";
35 &General
::readhash
("${General::swroot}/firewall/settings", \
%fwdfwsettings);
36 &Header
::showhttpheaders
();
39 &Header
::getcgihash
(\
%settings);
40 if ($settings{'ACTION'} eq $Lang::tr
{'save'}) {
41 if ($settings{'defpol'} ne '1'){
42 $errormessage .= $Lang::tr
{'new optionsfw later'};
43 &General
::writehash
($filename, \
%settings); # Save good settings
44 system("/usr/local/bin/firewallctrl");
46 if ($settings{'POLICY'} ne ''){
47 $fwdfwsettings{'POLICY'} = $settings{'POLICY'};
49 if ($settings{'POLICY1'} ne ''){
50 $fwdfwsettings{'POLICY1'} = $settings{'POLICY1'};
52 my $MODE = $fwdfwsettings{'POLICY'};
53 my $MODE1 = $fwdfwsettings{'POLICY1'};
55 $fwdfwsettings{'POLICY'} = "$MODE";
56 $fwdfwsettings{'POLICY1'} = "$MODE1";
57 &General
::writehash
("${General::swroot}/firewall/settings", \
%fwdfwsettings);
58 &General
::readhash
("${General::swroot}/firewall/settings", \
%fwdfwsettings);
59 system("/usr/local/bin/firewallctrl");
61 &General
::readhash
($filename, \
%settings); # Load good settings
64 &Header
::openpage
($Lang::tr
{'options fw'}, 1, '');
65 &Header
::openbigbox
('100%', 'left', '', $errormessage);
66 &General
::readhash
($filename, \
%settings);
68 &Header
::openbox
('100%', 'left', $Lang::tr
{'warning messages'});
69 print "<font color='red'>$errormessage </font>";
74 if (!$settings{'MASQUERADE_GREEN'}) {
75 $settings{'MASQUERADE_GREEN'} = 'on';
77 if (!$settings{'MASQUERADE_ORANGE'}) {
78 $settings{'MASQUERADE_ORANGE'} = 'on';
80 if (!$settings{'MASQUERADE_BLUE'}) {
81 $settings{'MASQUERADE_BLUE'} = 'on';
84 $checked{'DROPNEWNOTSYN'}{'off'} = '';
85 $checked{'DROPNEWNOTSYN'}{'on'} = '';
86 $checked{'DROPNEWNOTSYN'}{$settings{'DROPNEWNOTSYN'}} = "checked='checked'";
87 $checked{'DROPINPUT'}{'off'} = '';
88 $checked{'DROPINPUT'}{'on'} = '';
89 $checked{'DROPINPUT'}{$settings{'DROPINPUT'}} = "checked='checked'";
90 $checked{'DROPFORWARD'}{'off'} = '';
91 $checked{'DROPFORWARD'}{'on'} = '';
92 $checked{'DROPFORWARD'}{$settings{'DROPFORWARD'}} = "checked='checked'";
93 $checked{'DROPOUTGOING'}{'off'} = '';
94 $checked{'DROPOUTGOING'}{'on'} = '';
95 $checked{'DROPOUTGOING'}{$settings{'DROPOUTGOING'}} = "checked='checked'";
96 $checked{'DROPPORTSCAN'}{'off'} = '';
97 $checked{'DROPPORTSCAN'}{'on'} = '';
98 $checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'";
99 $checked{'DROPWIRELESSINPUT'}{'off'} = '';
100 $checked{'DROPWIRELESSINPUT'}{'on'} = '';
101 $checked{'DROPWIRELESSINPUT'}{$settings{'DROPWIRELESSINPUT'}} = "checked='checked'";
102 $checked{'DROPWIRELESSFORWARD'}{'off'} = '';
103 $checked{'DROPWIRELESSFORWARD'}{'on'} = '';
104 $checked{'DROPWIRELESSFORWARD'}{$settings{'DROPWIRELESSFORWARD'}} = "checked='checked'";
105 $checked{'DROPPROXY'}{'off'} = '';
106 $checked{'DROPPROXY'}{'on'} = '';
107 $checked{'DROPPROXY'}{$settings{'DROPPROXY'}} = "checked='checked'";
108 $checked{'DROPSAMBA'}{'off'} = '';
109 $checked{'DROPSAMBA'}{'on'} = '';
110 $checked{'DROPSAMBA'}{$settings{'DROPSAMBA'}} = "checked='checked'";
111 $checked{'SHOWCOLORS'}{'off'} = '';
112 $checked{'SHOWCOLORS'}{'on'} = '';
113 $checked{'SHOWCOLORS'}{$settings{'SHOWCOLORS'}} = "checked='checked'";
114 $checked{'SHOWREMARK'}{'off'} = '';
115 $checked{'SHOWREMARK'}{'on'} = '';
116 $checked{'SHOWREMARK'}{$settings{'SHOWREMARK'}} = "checked='checked'";
117 $checked{'SHOWTABLES'}{'off'} = '';
118 $checked{'SHOWTABLES'}{'on'} = '';
119 $checked{'SHOWTABLES'}{$settings{'SHOWTABLES'}} = "checked='checked'";
120 $checked{'SHOWDROPDOWN'}{'off'} = '';
121 $checked{'SHOWDROPDOWN'}{'on'} = '';
122 $checked{'SHOWDROPDOWN'}{$settings{'SHOWDROPDOWN'}} = "checked='checked'";
123 $checked{'CONNTRACK_FTP'}{'off'} = '';
124 $checked{'CONNTRACK_FTP'}{'on'} = '';
125 $checked{'CONNTRACK_FTP'}{$settings{'CONNTRACK_FTP'}} = "checked='checked'";
126 $checked{'CONNTRACK_H323'}{'off'} = '';
127 $checked{'CONNTRACK_H323'}{'on'} = '';
128 $checked{'CONNTRACK_H323'}{$settings{'CONNTRACK_H323'}} = "checked='checked'";
129 $checked{'CONNTRACK_IRC'}{'off'} = '';
130 $checked{'CONNTRACK_IRC'}{'on'} = '';
131 $checked{'CONNTRACK_IRC'}{$settings{'CONNTRACK_IRC'}} = "checked='checked'";
132 $checked{'CONNTRACK_PPTP'}{'off'} = '';
133 $checked{'CONNTRACK_PPTP'}{'on'} = '';
134 $checked{'CONNTRACK_PPTP'}{$settings{'CONNTRACK_PPTP'}} = "checked='checked'";
135 $checked{'CONNTRACK_SIP'}{'off'} = '';
136 $checked{'CONNTRACK_SIP'}{'on'} = '';
137 $checked{'CONNTRACK_SIP'}{$settings{'CONNTRACK_SIP'}} = "checked='checked'";
138 $checked{'CONNTRACK_TFTP'}{'off'} = '';
139 $checked{'CONNTRACK_TFTP'}{'on'} = '';
140 $checked{'CONNTRACK_TFTP'}{$settings{'CONNTRACK_TFTP'}} = "checked='checked'";
141 $selected{'FWPOLICY'}{$settings{'FWPOLICY'}}= 'selected';
142 $selected{'FWPOLICY1'}{$settings{'FWPOLICY1'}}= 'selected';
143 $selected{'FWPOLICY2'}{$settings{'FWPOLICY2'}}= 'selected';
144 $selected{'MASQUERADE_GREEN'}{'off'} = '';
145 $selected{'MASQUERADE_GREEN'}{'on'} = '';
146 $selected{'MASQUERADE_GREEN'}{$settings{'MASQUERADE_GREEN'}} = 'selected="selected"';
147 $selected{'MASQUERADE_ORANGE'}{'off'} = '';
148 $selected{'MASQUERADE_ORANGE'}{'on'} = '';
149 $selected{'MASQUERADE_ORANGE'}{$settings{'MASQUERADE_ORANGE'}} = 'selected="selected"';
150 $selected{'MASQUERADE_BLUE'}{'off'} = '';
151 $selected{'MASQUERADE_BLUE'}{'on'} = '';
152 $selected{'MASQUERADE_BLUE'}{$settings{'MASQUERADE_BLUE'}} = 'selected="selected"';
154 &Header
::openbox
('100%', 'center',);
155 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
158 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
159 <table width='95%' cellspacing='0'>
160 <tr bgcolor='$color{'color20'}'>
161 <td colspan='2' align='left'><b>$Lang::tr{'masquerading'}</b></td>
164 <td align='left' width='60%'>$Lang::tr{'masquerade green'}</td>
166 <select name='MASQUERADE_GREEN'>
167 <option value='on' $selected{'MASQUERADE_GREEN'}{'on'}>$Lang::tr{'masquerading enabled'}</option>
168 <option value='off' $selected{'MASQUERADE_GREEN'}{'off'}>$Lang::tr{'masquerading disabled'}</option>
174 if (&Header
::orange_used
()) {
177 <td align='left' width='60%'>$Lang::tr{'masquerade orange'}</td>
179 <select name='MASQUERADE_ORANGE'>
180 <option value='on' $selected{'MASQUERADE_ORANGE'}{'on'}>$Lang::tr{'masquerading enabled'}</option>
181 <option value='off' $selected{'MASQUERADE_ORANGE'}{'off'}>$Lang::tr{'masquerading disabled'}</option>
188 if (&Header
::blue_used
()) {
191 <td align='left' width='60%'>$Lang::tr{'masquerade blue'}</td>
193 <select name='MASQUERADE_BLUE'>
194 <option value='on' $selected{'MASQUERADE_BLUE'}{'on'}>$Lang::tr{'masquerading enabled'}</option>
195 <option value='off' $selected{'MASQUERADE_BLUE'}{'off'}>$Lang::tr{'masquerading disabled'}</option>
207 <table width='95%' cellspacing='0'>
208 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw logging'}</b></td></tr>
209 <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'} />/
210 <input type='radio' name='DROPNEWNOTSYN' value='off' $checked{'DROPNEWNOTSYN'}{'off'} /> off</td></tr>
211 <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'} />/
212 <input type='radio' name='DROPINPUT' value='off' $checked{'DROPINPUT'}{'off'} /> off</td></tr>
213 <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'} />/
214 <input type='radio' name='DROPFORWARD' value='off' $checked{'DROPFORWARD'}{'off'} /> off</td></tr>
215 <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'} />/
216 <input type='radio' name='DROPOUTGOING' value='off' $checked{'DROPOUTGOING'}{'off'} /> off</td></tr>
217 <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'} />/
218 <input type='radio' name='DROPPORTSCAN' value='off' $checked{'DROPPORTSCAN'}{'off'} /> off</td></tr>
219 <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'} />/
220 <input type='radio' name='DROPWIRELESSINPUT' value='off' $checked{'DROPWIRELESSINPUT'}{'off'} /> off</td></tr>
221 <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'} />/
222 <input type='radio' name='DROPWIRELESSFORWARD' value='off' $checked{'DROPWIRELESSFORWARD'}{'off'} /> off</td></tr>
226 <table width='95%' cellspacing='0'>
227 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw blue'}</b></td></tr>
228 <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'} />/
229 <input type='radio' name='DROPPROXY' value='off' $checked{'DROPPROXY'}{'off'} /> off</td></tr>
230 <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'} />/
231 <input type='radio' name='DROPSAMBA' value='off' $checked{'DROPSAMBA'}{'off'} /> off</td></tr>
234 <table width='95%' cellspacing='0'>
235 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw settings'}</b></td></tr>
236 <tr><td align='left' width='60%'>$Lang::tr{'fw settings color'}</td><td align='left'>on <input type='radio' name='SHOWCOLORS' value='on' $checked{'SHOWCOLORS'}{'on'} />/
237 <input type='radio' name='SHOWCOLORS' value='off' $checked{'SHOWCOLORS'}{'off'} /> off</td></tr>
238 <tr><td align='left' width='60%'>$Lang::tr{'fw settings remark'}</td><td align='left'>on <input type='radio' name='SHOWREMARK' value='on' $checked{'SHOWREMARK'}{'on'} />/
239 <input type='radio' name='SHOWREMARK' value='off' $checked{'SHOWREMARK'}{'off'} /> off</td></tr>
240 <tr><td align='left' width='60%'>$Lang::tr{'fw settings ruletable'}</td><td align='left'>on <input type='radio' name='SHOWTABLES' value='on' $checked{'SHOWTABLES'}{'on'} />/
241 <input type='radio' name='SHOWTABLES' value='off' $checked{'SHOWTABLES'}{'off'} /> off</td></tr>
242 <tr><td align='left' width='60%'>$Lang::tr{'fw settings dropdown'}</td><td align='left'>on <input type='radio' name='SHOWDROPDOWN' value='on' $checked{'SHOWDROPDOWN'}{'on'} />/
243 <input type='radio' name='SHOWDROPDOWN' value='off' $checked{'SHOWDROPDOWN'}{'off'} /> off</td></tr>
248 <table width='95%' cellspacing='0'>
249 <tr bgcolor='$color{'color20'}'>
250 <td colspan='2' align='left'>
251 <b>$Lang::tr{'application layer gateways'}</b>
255 <td align='left' width='60%'>FTP</td>
257 $Lang::tr{'on'} <input type='radio' name='CONNTRACK_FTP' value='on' $checked{'CONNTRACK_FTP'}{'on'} /> /
258 <input type='radio' name='CONNTRACK_FTP' value='off' $checked{'CONNTRACK_FTP'}{'off'} /> $Lang::tr{'off'}
262 <td align='left' width='60%'>H.323</td>
264 $Lang::tr{'on'} <input type='radio' name='CONNTRACK_H323' value='on' $checked{'CONNTRACK_H323'}{'on'} /> /
265 <input type='radio' name='CONNTRACK_H323' value='off' $checked{'CONNTRACK_H323'}{'off'} /> $Lang::tr{'off'}
269 <td align='left' width='60%'>IRC</td>
271 $Lang::tr{'on'} <input type='radio' name='CONNTRACK_IRC' value='on' $checked{'CONNTRACK_IRC'}{'on'} /> /
272 <input type='radio' name='CONNTRACK_IRC' value='off' $checked{'CONNTRACK_IRC'}{'off'} /> $Lang::tr{'off'}
276 <td align='left' width='60%'>PPTP</td>
278 $Lang::tr{'on'} <input type='radio' name='CONNTRACK_PPTP' value='on' $checked{'CONNTRACK_PPTP'}{'on'} /> /
279 <input type='radio' name='CONNTRACK_PPTP' value='off' $checked{'CONNTRACK_PPTP'}{'off'} /> $Lang::tr{'off'}
283 <td align='left' width='60%'>SIP</td>
285 $Lang::tr{'on'} <input type='radio' name='CONNTRACK_SIP' value='on' $checked{'CONNTRACK_SIP'}{'on'} /> /
286 <input type='radio' name='CONNTRACK_SIP' value='off' $checked{'CONNTRACK_SIP'}{'off'} /> $Lang::tr{'off'}
290 <td align='left' width='60%'>TFTP</td>
292 $Lang::tr{'on'} <input type='radio' name='CONNTRACK_TFTP' value='on' $checked{'CONNTRACK_TFTP'}{'on'} /> /
293 <input type='radio' name='CONNTRACK_TFTP' value='off' $checked{'CONNTRACK_TFTP'}{'off'} /> $Lang::tr{'off'}
299 <table width='95%' cellspacing='0'>
300 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw default drop'}</b></td></tr>
301 <tr><td align='left' width='60%'>$Lang::tr{'drop action'}</td><td><select name='FWPOLICY'>
302 <option value='DROP' $selected{'FWPOLICY'}{'DROP'}>DROP</option>
303 <option value='REJECT' $selected{'FWPOLICY'}{'REJECT'}>REJECT</option></select>
305 <tr><td align='left' width='60%'>$Lang::tr{'drop action1'}</td><td><select name='FWPOLICY1'>
306 <option value='DROP' $selected{'FWPOLICY1'}{'DROP'}>DROP</option>
307 <option value='REJECT' $selected{'FWPOLICY1'}{'REJECT'}>REJECT</option></select>
309 <tr><td align='left' width='60%'>$Lang::tr{'drop action2'}</td><td><select name='FWPOLICY2'>
310 <option value='DROP' $selected{'FWPOLICY2'}{'DROP'}>DROP</option>
311 <option value='REJECT' $selected{'FWPOLICY2'}{'REJECT'}>REJECT</option></select>
316 <table width='100%' cellspacing='0'>
317 <tr><td align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
318 <input type='submit' name='ACTION' value=$Lang::tr{'save'} />
326 &Header
::openbox
('100%', 'center', $Lang::tr
{'fwdfw pol title'});
327 if ($fwdfwsettings{'POLICY'} eq 'MODE1'){ $selected{'POLICY'}{'MODE1'} = 'selected'; } else { $selected{'POLICY'}{'MODE1'} = ''; }
328 if ($fwdfwsettings{'POLICY'} eq 'MODE2'){ $selected{'POLICY'}{'MODE2'} = 'selected'; } else { $selected{'POLICY'}{'MODE2'} = ''; }
329 if ($fwdfwsettings{'POLICY1'} eq 'MODE1'){ $selected{'POLICY1'}{'MODE1'} = 'selected'; } else { $selected{'POLICY1'}{'MODE1'} = ''; }
330 if ($fwdfwsettings{'POLICY1'} eq 'MODE2'){ $selected{'POLICY1'}{'MODE2'} = 'selected'; } else { $selected{'POLICY1'}{'MODE2'} = ''; }
332 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
333 <table width='100%' border='0'>
334 <tr><td colspan='3' style='font-weight:bold;color:red;' align='left'>FORWARD </td></tr>
335 <tr><td colspan='3' align='left'>$Lang::tr{'fwdfw pol text'}</td></tr>
336 <tr><td colspan='3'><hr /></td></tr>
337 <tr><td width='15%' align='left'> <select name='POLICY' style="width: 100px">
338 <option value='MODE1' $selected{'POLICY'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
339 <option value='MODE2' $selected{'POLICY'}{'MODE2'}>$Lang::tr{'fwdfw pol allow'}</option></select>
340 <input type='submit' name='ACTION' value=$Lang::tr{'save'} /><input type='hidden' name='defpol' value='1'></td>
342 print "</tr></table></form>";
345 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
346 <table width='100%' border='0'>
347 <tr><td colspan='3' style='font-weight:bold;color:red;' align='left'>OUTGOING </td></tr>
348 <tr><td colspan='3' align='left'>$Lang::tr{'fwdfw pol text1'}</td></tr>
349 <tr><td colspan='3'><hr /></td></tr>
350 <tr><td width='15%' align='left'> <select name='POLICY1' style="width: 100px">
351 <option value='MODE1' $selected{'POLICY1'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
352 <option value='MODE2' $selected{'POLICY1'}{'MODE2'}>$Lang::tr{'fwdfw pol allow'}</option></select>
353 <input type='submit' name='ACTION' value='$Lang::tr{'save'}' /><input type='hidden' name='defpol' value='1'></td>
355 print "</tr></table></form>";
358 &Header
::closebigbox
();
359 &Header
::closepage
();