X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Foutgoingfw.cgi;h=6e27262abec66da356a5d240a44c14eac10e146e;hp=f3cf581a6a06aae27b9b817bd264e0e7b3a3f7f5;hb=9f6e5c768ee27f986b303f91dd42d07bc0ce4c56;hpb=39008af71dee1f65a7f424cb04a9594b4a7ea4b4 diff --git a/html/cgi-bin/outgoingfw.cgi b/html/cgi-bin/outgoingfw.cgi index f3cf581a6a..6e27262abe 100644 --- a/html/cgi-bin/outgoingfw.cgi +++ b/html/cgi-bin/outgoingfw.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2009 Michael Tremer & Christian Schmidt # +# Copyright (C) 2005-2010 IPTifre Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -21,8 +21,8 @@ use strict; # enable only the following on debugging purpose -use warnings; -use CGI::Carp 'fatalsToBrowser'; +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; @@ -41,6 +41,7 @@ my @p2ps = (); my @p2pline = (); my $configfile = "/var/ipfire/outgoing/rules"; +my $configpath = "/var/ipfire/outgoing/groups/"; my $p2pfile = "/var/ipfire/outgoing/p2protocols"; my $servicefile = "/var/ipfire/outgoing/defaultservices"; @@ -79,6 +80,19 @@ $outfwsettings{'TIME_TO'} = '00:00'; &General::readhash("${General::swroot}/outgoing/settings", \%outfwsettings); &Header::getcgihash(\%outfwsettings); +############### +# DEBUG DEBUG +#&Header::openbox('100%', 'left', 'DEBUG'); +#my $debugCount = 0; +#foreach my $line (sort keys %outfwsettings) { +#print "$line = $outfwsettings{$line}
\n"; +# $debugCount++; +#} +#print " Count: $debugCount\n"; +#&Header::closebox(); +# DEBUG DEBUG +############### + $selected{'TIME_FROM'}{$outfwsettings{'TIME_FROM'}} = "selected='selected'"; $selected{'TIME_TO'}{$outfwsettings{'TIME_TO'}} = "selected='selected'"; @@ -111,7 +125,28 @@ if ($outfwsettings{'POLICY'} eq 'MODE0'){ $selected{'POLICY'}{'MODE0'} = 'select if ($outfwsettings{'POLICY'} eq 'MODE1'){ $selected{'POLICY'}{'MODE1'} = 'selected'; } else { $selected{'POLICY'}{'MODE1'} = ''; } if ($outfwsettings{'POLICY'} eq 'MODE2'){ $selected{'POLICY'}{'MODE2'} = 'selected'; } else { $selected{'POLICY'}{'MODE2'} = ''; } -&Header::openpage('Ausgehende Firewall', 1, ''); +# This is a little hack if poeple donĀ“t mark any date then all will be selected, because they might have forgotten to select +# a valid day. A Rule without any matching day will never work, because the timeranges are new feature people might not notice +# that they have to select a day for the rule. + +if ( $outfwsettings{'TIME_MON'} eq "" && + $outfwsettings{'TIME_TUE'} eq "" && + $outfwsettings{'TIME_WED'} eq "" && + $outfwsettings{'TIME_THU'} eq "" && + $outfwsettings{'TIME_FRI'} eq "" && + $outfwsettings{'TIME_SAT'} eq "" && + $outfwsettings{'TIME_SUN'} eq "" ) + { + $outfwsettings{'TIME_MON'} = "on"; + $outfwsettings{'TIME_TUE'} = "on"; + $outfwsettings{'TIME_WED'} = "on"; + $outfwsettings{'TIME_THU'} = "on"; + $outfwsettings{'TIME_FRI'} = "on"; + $outfwsettings{'TIME_SAT'} = "on"; + $outfwsettings{'TIME_SUN'} = "on"; + } + +&Header::openpage($Lang::tr{'outgoing firewall'}, 1, ''); &Header::openbigbox('100%', 'left', '', $errormessage); ############################################################################################################################ @@ -182,6 +217,17 @@ if ($outfwsettings{'ACTION'} eq $Lang::tr{'edit'}) foreach $configentry (sort @configs) { @configline = split( /\;/, $configentry ); + + $configline[10] = "on" if not exists $configline[11]; + $configline[11] = "on" if not exists $configline[11]; + $configline[12] = "on" if not exists $configline[12]; + $configline[13] = "on" if not exists $configline[13]; + $configline[14] = "on" if not exists $configline[14]; + $configline[15] = "on" if not exists $configline[15]; + $configline[16] = "on" if not exists $configline[16]; + $configline[17] = "00:00" if not exists $configline[17]; + $configline[18] = "00:00" if not exists $configline[18]; + unless (($configline[0] eq $outfwsettings{'STATE'}) && ($configline[1] eq $outfwsettings{'ENABLED'}) && ($configline[2] eq $outfwsettings{'SNET'}) && @@ -224,6 +270,17 @@ if ($outfwsettings{'ACTION'} eq $Lang::tr{'delete'}) foreach $configentry (sort @configs) { @configline = split( /\;/, $configentry ); + + $configline[10] = "on" if not exists $configline[11]; + $configline[11] = "on" if not exists $configline[11]; + $configline[12] = "on" if not exists $configline[12]; + $configline[13] = "on" if not exists $configline[13]; + $configline[14] = "on" if not exists $configline[14]; + $configline[15] = "on" if not exists $configline[15]; + $configline[16] = "on" if not exists $configline[16]; + $configline[17] = "00:00" if not exists $configline[17]; + $configline[18] = "00:00" if not exists $configline[18]; + unless (($configline[0] eq $outfwsettings{'STATE'}) && ($configline[1] eq $outfwsettings{'ENABLED'}) && ($configline[2] eq $outfwsettings{'SNET'}) && @@ -320,15 +377,26 @@ END $outfwsettings{'DIP'} = $configline[7]; $outfwsettings{'DPORT'} = $configline[8]; $outfwsettings{'LOG'} = $configline[9]; - $outfwsettings{'TIME_MON'} = $configline[10]; - $outfwsettings{'TIME_TUE'} = $configline[11]; - $outfwsettings{'TIME_WED'} = $configline[12]; - $outfwsettings{'TIME_THU'} = $configline[13]; - $outfwsettings{'TIME_FRI'} = $configline[14]; - $outfwsettings{'TIME_SAT'} = $configline[15]; - $outfwsettings{'TIME_SUN'} = $configline[16]; - $outfwsettings{'TIME_FROM'} = $configline[17]; - $outfwsettings{'TIME_TO'} = $configline[18]; + + $configline[10] = "on" if not exists $configline[11]; + $configline[11] = "on" if not exists $configline[11]; + $configline[12] = "on" if not exists $configline[12]; + $configline[13] = "on" if not exists $configline[13]; + $configline[14] = "on" if not exists $configline[14]; + $configline[15] = "on" if not exists $configline[15]; + $configline[16] = "on" if not exists $configline[16]; + $configline[17] = "00:00" if not exists $configline[17]; + $configline[18] = "00:00" if not exists $configline[18]; + + $outfwsettings{'TIME_MON'} = $configline[10]; + $outfwsettings{'TIME_TUE'} = $configline[11]; + $outfwsettings{'TIME_WED'} = $configline[12]; + $outfwsettings{'TIME_THU'} = $configline[13]; + $outfwsettings{'TIME_FRI'} = $configline[14]; + $outfwsettings{'TIME_SAT'} = $configline[15]; + $outfwsettings{'TIME_SUN'} = $configline[16]; + $outfwsettings{'TIME_FROM'} = $configline[17]; + $outfwsettings{'TIME_TO'} = $configline[18]; if ($outfwsettings{'DIP'} eq ''){ $outfwsettings{'DISPLAY_DIP'} = 'ALL'; } else { $outfwsettings{'DISPLAY_DIP'} = $outfwsettings{'DIP'}; } if ($outfwsettings{'DPORT'} eq ''){ $outfwsettings{'DISPLAY_DPORT'} = 'ALL'; } else { $outfwsettings{'DISPLAY_DPORT'} = $outfwsettings{'DPORT'}; } @@ -397,14 +465,14 @@ END unless ($outfwsettings{'SIP'}) { $outfwsettings{'DISPLAY_SIP'} = 'ALL'; } else { $outfwsettings{'DISPLAY_SIP'} = $outfwsettings{'SIP'}; } unless ($outfwsettings{'SMAC'}) { $outfwsettings{'DISPLAY_SMAC'} = 'ALL'; } else { $outfwsettings{'DISPLAY_SMAC'} = $outfwsettings{'SMAC'}; } print <$Lang::tr{'source ip'}: + $Lang::tr{'source ip or net'}: $outfwsettings{'DISPLAY_SIP'} END ; } print <$Lang::tr{'time'} - + $Lang::tr{'time'} - END ; @@ -441,7 +509,7 @@ END if ($outfwsettings{'POLICY'} eq 'MODE1'){ print <
- tcp&udp + all all ALL drop @@ -491,13 +559,13 @@ END if ($p2pline[2] eq 'on') { print < - + END ; } else { print < - + END ; } @@ -508,7 +576,7 @@ END } print < -
$Lang::tr{'outgoingfw p2p description'} +
$Lang::tr{'outgoingfw p2p description 1'} $Lang::tr{ $Lang::tr{'outgoingfw p2p description 2'} $Lang::tr{ $Lang::tr{'outgoingfw p2p description 3'} END ; &Header::closebox(); @@ -540,86 +608,124 @@ END ; &Header::closebox(); -&Header::closebigbox(); -&Header::closepage(); - ############################################################################################################################ ############################################################################################################################ sub addrule { - &Header::openbox('100%', 'center', 'Rules hinzufuegen'); + &Header::openbox('100%', 'center', $Lang::tr{'Add Rule'}); if ($outfwsettings{'EDIT'} eq 'no') { $selected{'ENABLED'} = 'checked'; } $selected{'TIME_FROM'}{$outfwsettings{'TIME_FROM'}} = "selected='selected'"; $selected{'TIME_TO'}{$outfwsettings{'TIME_TO'}} = "selected='selected'"; - print < - + + + + + + + + + + + + + + "; -} -else{ - print ""; -} -print < - + my @ipgroups = qx(ls $configpath/ipgroups/); + foreach (sort @ipgroups){ + print "\t\t\t\t\t\n"; + } + print < + + + + + + + + + + + + + + + + - - - + + + + + + + - + + + + + +
$Lang::tr{'description'}: - - $Lang::tr{'active'}: - -
$Lang::tr{'protocol'}: - - $Lang::tr{'policy'}: - +
$Lang::tr{'description'}: $Lang::tr{'active'}:
$Lang::tr{'protocol'}: + + $Lang::tr{'policy'}: END ; if ($outfwsettings{'POLICY'} eq 'MODE1'){ - print "\t\t\tALLOW\n"; + print "\t\t\t\tALLOW\n"; } elsif ($outfwsettings{'POLICY'} eq 'MODE2'){ - print "\t\t\tDENY\n"; + print "\t\t\t\tDENY\n"; } print <$Lang::tr{'source net'}: -
$Lang::tr{'source'}: + $Lang::tr{'source ip'}: - -
$Lang::tr{'logging'}: + + END ; -if ($outfwsettings{'POLICY'} eq 'MODE1'){ - print " -
$Lang::tr{'destination ip'}: - - $Lang::tr{'destination port'}: - -
$Lang::tr{'time'}:$Lang::tr{'source ip or net'}
$Lang::tr{'logging'}: + + + +
$Lang::tr{'destination ip or net'}: $Lang::tr{'destination port'}(s)
$Lang::tr{'time'}: $Lang::tr{'advproxy monday'} $Lang::tr{'advproxy tuesday'} $Lang::tr{'advproxy wednesday'} $Lang::tr{'advproxy thursday'} $Lang::tr{'advproxy friday'} $Lang::tr{'advproxy saturday'} $Lang::tr{'advproxy sunday'} $Lang::tr{'advproxy from'}$Lang::tr{'advproxy to'}
- - - - - - $Lang::tr{'advproxy to'}
+ + + + + + + + - +
-
$Lang::tr{'this field may be blank'} - + +
+
$Lang::tr{'this field may be blank'}
END ; @@ -694,4 +806,7 @@ END print ""; &Header::closebox(); } -} \ No newline at end of file +} + +&Header::closebigbox(); +&Header::closepage(); \ No newline at end of file