]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/optionsfw.cgi
Forward Firewall: added GPL header to all files
[people/teissler/ipfire-2.x.git] / html / cgi-bin / optionsfw.cgi
index 39bd4195d815cec2d4cea62a024cc6c2b6e68a24..7d34feab0893d16bc4a9bc9c07f73d7c17d59ee1 100644 (file)
@@ -11,6 +11,9 @@
 # $Id: optionsfw.cgi,v 1.1.2.10 2005/10/03 00:34:10 gespinasse Exp $
 #
 #
+########################################################################
+#  Modifications for new Firewall (C) 2013 by amarx@ipfire.org
+########################################################################
 
 # enable only the following on debugging purpose
 #use warnings;
@@ -22,43 +25,49 @@ require "${General::swroot}/header.pl";
 
 
 my %checked =();     # Checkbox manipulations
-
-# File used
-my $filename = "${General::swroot}/optionsfw/settings";
-
 our %settings=();
-$settings{'DISABLEPING'} = 'NO';
-$settings{'DROPNEWNOTSYN'} = 'on';
-$settings{'DROPINPUT'} = 'on';
-$settings{'DROPFORWARD'} = 'on';
-$settings{'DROPOUTGOING'} = 'on';
-$settings{'DROPPORTSCAN'} = 'on';
-$settings{'DROPWIRELESSINPUT'} = 'on';
-$settings{'DROPWIRELESSFORWARD'} = 'on';
-$settings{'SHOWCOLORS'} = 'off';
+my %fwdfwsettings=();
+my %configfwdfw=();
+my %configoutgoingfw=();
 
+my $configfwdfw                = "${General::swroot}/forward/config";
+my $configoutgoing     = "${General::swroot}/forward/outgoing";
 my $errormessage = '';
 my $warnmessage = '';
+my $filename = "${General::swroot}/optionsfw/settings";
 
+&General::readhash("${General::swroot}/forward/settings", \%fwdfwsettings);
 &Header::showhttpheaders();
 
 #Get GUI values
 &Header::getcgihash(\%settings);
-
 if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
-       
-        $errormessage = $Lang::tr{'new optionsfw later'};
-        delete $settings{'__CGI__'};
-        delete $settings{'x'};
-        delete $settings{'y'};
-        &General::writehash($filename, \%settings);             # Save good settings
-   }else {
-               &General::readhash($filename, \%settings);                      # Get saved settings and reset to good if needed
+       if ($settings{'defpol'} ne '1'){
+               $errormessage .= $Lang::tr{'new optionsfw later'};
+               &General::writehash($filename, \%settings);             # Save good settings
+               system("/usr/local/bin/forwardfwctrl");
+       }else{
+               if ($settings{'POLICY'} ne ''){
+                       $fwdfwsettings{'POLICY'} = $settings{'POLICY'};
+               }
+               if ($settings{'POLICY1'} ne ''){
+                       $fwdfwsettings{'POLICY1'} = $settings{'POLICY1'};
+               }
+               my $MODE = $fwdfwsettings{'POLICY'};
+               my $MODE1 = $fwdfwsettings{'POLICY1'};
+               %fwdfwsettings = ();
+               $fwdfwsettings{'POLICY'} = "$MODE";
+               $fwdfwsettings{'POLICY1'} = "$MODE1";
+               &General::writehash("${General::swroot}/forward/settings", \%fwdfwsettings);
+               &General::readhash("${General::swroot}/forward/settings", \%fwdfwsettings);
+               system("/usr/local/bin/forwardfwctrl");
        }
-       system("/usr/local/bin/forwardfwctrl");
+       &General::readhash($filename, \%settings);             # Load good settings
+}
+
 &Header::openpage($Lang::tr{'options fw'}, 1, '');
 &Header::openbigbox('100%', 'left', '', $errormessage);
-
+&General::readhash($filename, \%settings);
 if ($errormessage) {
         &Header::openbox('100%', 'left', $Lang::tr{'warning messages'});
         print "<font color='red'>$errormessage&nbsp;</font>";
@@ -95,9 +104,18 @@ $checked{'DROPSAMBA'}{$settings{'DROPSAMBA'}} = "checked='checked'";
 $checked{'SHOWCOLORS'}{'off'} = '';
 $checked{'SHOWCOLORS'}{'on'} = '';
 $checked{'SHOWCOLORS'}{$settings{'SHOWCOLORS'}} = "checked='checked'";
+$checked{'SHOWREMARK'}{'off'} = '';
+$checked{'SHOWREMARK'}{'on'} = '';
+$checked{'SHOWREMARK'}{$settings{'SHOWREMARK'}} = "checked='checked'";
+$checked{'SHOWTABLES'}{'off'} = '';
+$checked{'SHOWTABLES'}{'on'} = '';
+$checked{'SHOWTABLES'}{$settings{'SHOWTABLES'}} = "checked='checked'";
+$checked{'SHOWDROPDOWN'}{'off'} = '';
+$checked{'SHOWDROPDOWN'}{'on'} = '';
+$checked{'SHOWDROPDOWN'}{$settings{'SHOWDROPDOWN'}} = "checked='checked'";
 $selected{'FWPOLICY'}{$settings{'FWPOLICY'}}= 'selected';
 $selected{'FWPOLICY1'}{$settings{'FWPOLICY1'}}= 'selected';
-
+$selected{'FWPOLICY2'}{$settings{'FWPOLICY2'}}= 'selected';
 
 &Header::openbox('100%', 'center', $Lang::tr{'options fw'});
 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
@@ -135,6 +153,12 @@ print <<END
 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw settings'}</b></td></tr>
 <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'} />/
                                                                                                                                                                                <input type='radio' name='SHOWCOLORS' value='off' $checked{'SHOWCOLORS'}{'off'} /> off</td></tr>
+<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'} />/
+                                                                                                                                                                               <input type='radio' name='SHOWREMARK' value='off' $checked{'SHOWREMARK'}{'off'} /> off</td></tr>                
+<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'} />/
+                                                                                                                                                                               <input type='radio' name='SHOWTABLES' value='off' $checked{'SHOWTABLES'}{'off'} /> off</td></tr>
+<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'} />/
+                                                                                                                                                                               <input type='radio' name='SHOWDROPDOWN' value='off' $checked{'SHOWDROPDOWN'}{'off'} /> off</td></tr>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
 </table>                                                                                                                                                                               
 <br />
 <table width='95%' cellspacing='0'>
@@ -147,6 +171,10 @@ print <<END
 <option value='DROP' $selected{'FWPOLICY1'}{'DROP'}>DROP</option>
 <option value='REJECT' $selected{'FWPOLICY1'}{'REJECT'}>REJECT</option></select>
 </td></tr>
+<tr><td align='left' width='60%'>$Lang::tr{'drop action2'}</td><td><select name='FWPOLICY2'>
+<option value='DROP' $selected{'FWPOLICY2'}{'DROP'}>DROP</option>
+<option value='REJECT' $selected{'FWPOLICY2'}{'REJECT'}>REJECT</option></select>
+</td></tr>
 </table>
 
 <br />
@@ -159,5 +187,38 @@ print <<END
 END
 ;
 &Header::closebox();
+
+&Header::openbox('100%', 'center', $Lang::tr{'fwdfw pol title'});
+       if ($fwdfwsettings{'POLICY'} eq 'MODE1'){ $selected{'POLICY'}{'MODE1'} = 'selected'; } else { $selected{'POLICY'}{'MODE1'} = ''; }
+       if ($fwdfwsettings{'POLICY'} eq 'MODE2'){ $selected{'POLICY'}{'MODE2'} = 'selected'; } else { $selected{'POLICY'}{'MODE2'} = ''; }
+       if ($fwdfwsettings{'POLICY1'} eq 'MODE1'){ $selected{'POLICY1'}{'MODE1'} = 'selected'; } else { $selected{'POLICY1'}{'MODE1'} = ''; }
+       if ($fwdfwsettings{'POLICY1'} eq 'MODE2'){ $selected{'POLICY1'}{'MODE2'} = 'selected'; } else { $selected{'POLICY1'}{'MODE2'} = ''; }
+print <<END;
+       <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+       <table width='100%' border='0'>
+               <tr><td colspan='3' style='font-weight:bold;color:red;' align='left'>FORWARD </td></tr>
+               <tr><td colspan='3' align='left'>$Lang::tr{'fwdfw pol text'}</td></tr>
+               <tr><td colspan='3'><hr /></td></tr>
+               <tr><td width='15%' align='left'>       <select name='POLICY' style="width: 100px">
+               <option value='MODE1' $selected{'POLICY'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
+               <option value='MODE2' $selected{'POLICY'}{'MODE2'}>$Lang::tr{'fwdfw pol allow'}</option></select>
+           <input type='submit' name='ACTION' value=$Lang::tr{'save'} /><input type='hidden' name='defpol' value='1'></td>
+END
+       print "</tr></table></form>";
+       print"<br><br>";
+       print <<END;
+       <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+       <table width='100%' border='0'>
+               <tr><td colspan='3' style='font-weight:bold;color:red;' align='left'>OUTGOING </td></tr>
+               <tr><td colspan='3' align='left'>$Lang::tr{'fwdfw pol text1'}</td></tr>
+               <tr><td colspan='3'><hr /></td></tr>
+               <tr><td width='15%' align='left'>       <select name='POLICY1' style="width: 100px">
+               <option value='MODE1' $selected{'POLICY1'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
+               <option value='MODE2' $selected{'POLICY1'}{'MODE2'}>$Lang::tr{'fwdfw pol allow'}</option></select>
+           <input type='submit' name='ACTION' value='$Lang::tr{'save'}' /><input type='hidden' name='defpol' value='1'></td>
+END
+       print "</tr></table></form>";
+       &Header::closebox();
+
 &Header::closebigbox();
 &Header::closepage();