#!/usr/bin/perl # # SmoothWall CGIs # # This code is distributed under the terms of the GPL # # (c) The SmoothWall Team # # Copyright (C) 01-02-2002 Graham Smith # # $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; #use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; my %checked =(); # Checkbox manipulations our %settings=(); 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'}) { 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"); } &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 "$errormessage "; &Header::closebox(); } $checked{'DROPNEWNOTSYN'}{'off'} = ''; $checked{'DROPNEWNOTSYN'}{'on'} = ''; $checked{'DROPNEWNOTSYN'}{$settings{'DROPNEWNOTSYN'}} = "checked='checked'"; $checked{'DROPINPUT'}{'off'} = ''; $checked{'DROPINPUT'}{'on'} = ''; $checked{'DROPINPUT'}{$settings{'DROPINPUT'}} = "checked='checked'"; $checked{'DROPFORWARD'}{'off'} = ''; $checked{'DROPFORWARD'}{'on'} = ''; $checked{'DROPFORWARD'}{$settings{'DROPFORWARD'}} = "checked='checked'"; $checked{'DROPOUTGOING'}{'off'} = ''; $checked{'DROPOUTGOING'}{'on'} = ''; $checked{'DROPOUTGOING'}{$settings{'DROPOUTGOING'}} = "checked='checked'"; $checked{'DROPPORTSCAN'}{'off'} = ''; $checked{'DROPPORTSCAN'}{'on'} = ''; $checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'"; $checked{'DROPWIRELESSINPUT'}{'off'} = ''; $checked{'DROPWIRELESSINPUT'}{'on'} = ''; $checked{'DROPWIRELESSINPUT'}{$settings{'DROPWIRELESSINPUT'}} = "checked='checked'"; $checked{'DROPWIRELESSFORWARD'}{'off'} = ''; $checked{'DROPWIRELESSFORWARD'}{'on'} = ''; $checked{'DROPWIRELESSFORWARD'}{$settings{'DROPWIRELESSFORWARD'}} = "checked='checked'"; $checked{'DROPPROXY'}{'off'} = ''; $checked{'DROPPROXY'}{'on'} = ''; $checked{'DROPPROXY'}{$settings{'DROPPROXY'}} = "checked='checked'"; $checked{'DROPSAMBA'}{'off'} = ''; $checked{'DROPSAMBA'}{'on'} = ''; $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 "
"; print <
$Lang::tr{'fw logging'}
$Lang::tr{'drop newnotsyn'}on / off
$Lang::tr{'drop input'}on / off
$Lang::tr{'drop forward'}on / off
$Lang::tr{'drop outgoing'}on / off
$Lang::tr{'drop portscan'}on / off
$Lang::tr{'drop wirelessinput'}on / off
$Lang::tr{'drop wirelessforward'}on / off

$Lang::tr{'fw blue'}
$Lang::tr{'drop proxy'}on / off
$Lang::tr{'drop samba'}on / off

$Lang::tr{'fw settings'}
$Lang::tr{'fw settings color'}on / off
$Lang::tr{'fw settings remark'}on / off
$Lang::tr{'fw settings ruletable'}on / off
$Lang::tr{'fw settings dropdown'}on / off

$Lang::tr{'fw default drop'}
$Lang::tr{'drop action'}
$Lang::tr{'drop action1'}
$Lang::tr{'drop action2'}

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 print "
FORWARD
$Lang::tr{'fwdfw pol text'}

"; print"

"; print < END print "
OUTGOING
$Lang::tr{'fwdfw pol text1'}

"; &Header::closebox(); &Header::closebigbox(); &Header::closepage();