]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/outgoingfw.cgi
Fixed a bug in the outgoingfw where preselected groups where not
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / outgoingfw.cgi
index e2bfcfdebfc77806f57f9ffc2bcc2c5bb237f648..295bde477c4a9069fe986116642bf0d94e0a39c9 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2005-2010  IPTifre Team                                       #
+# Copyright (C) 2005-2010  IPFire 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        #
@@ -310,6 +310,11 @@ if ($outfwsettings{'ACTION'} eq $Lang::tr{'delete'})
 if ($outfwsettings{'ACTION'} eq $Lang::tr{'add'})
 {
        if ( $outfwsettings{'VALID'} eq 'yes' ) {
+
+               if ( $outfwsettings{'SNET'} eq "all" ) {
+                       $outfwsettings{'SIP'} ="";
+                       $outfwsettings{'SMAC'}="";
+               }
                open( FILE, ">> $configfile" ) or die "Unable to write $configfile";
                print FILE <<END
 $outfwsettings{'STATE'};$outfwsettings{'ENABLED'};$outfwsettings{'SNET'};$outfwsettings{'PROT'};$outfwsettings{'NAME'};$outfwsettings{'SIP'};$outfwsettings{'SMAC'};$outfwsettings{'DIP'};$outfwsettings{'DPORT'};$outfwsettings{'LOG'};$outfwsettings{'TIME_MON'};$outfwsettings{'TIME_TUE'};$outfwsettings{'TIME_WED'};$outfwsettings{'TIME_THU'};$outfwsettings{'TIME_FRI'};$outfwsettings{'TIME_SAT'};$outfwsettings{'TIME_SUN'};$outfwsettings{'TIME_FROM'};$outfwsettings{'TIME_TO'};
@@ -321,7 +326,7 @@ END
                $outfwsettings{'ACTION'} = 'Add rule';
        }
 }
-if ($outfwsettings{'ACTION'} eq 'Add rule')
+if ($outfwsettings{'ACTION'} eq $Lang::tr{'Add Rule'})
 {
        &addrule();
        exit
@@ -343,7 +348,7 @@ if ($outfwsettings{'POLICY'} ne 'MODE0'){
        &Header::openbox('100%', 'center', 'Rules');
                print <<END
        <form method='post' action='$ENV{'SCRIPT_NAME'}'>
-               <input type='submit' name='ACTION' value='Add rule' />
+               <input type='submit' name='ACTION' value='$Lang::tr{'Add Rule'}' />
        </form>
 END
 ;
@@ -403,8 +408,12 @@ END
                                if ($outfwsettings{'STATE'} eq 'DENY'){ $outfwsettings{'DISPLAY_STATE'} = "<img src='/images/stock_stop.png' alt='DENY' />"; }
                                if ($outfwsettings{'STATE'} eq 'ALLOW'){ $outfwsettings{'DISPLAY_STATE'} = "<img src='/images/stock_ok.png' alt='ALLOW' />"; }
                                if ((($outfwsettings{'POLICY'} eq 'MODE1') && ($outfwsettings{'STATE'} eq 'ALLOW')) || (($outfwsettings{'POLICY'} eq 'MODE2') && ($outfwsettings{'STATE'} eq 'DENY'))){
-                                       print <<END
-                                       <tr bgcolor='$color{'color20'}'>
+                               if ( $outfwsettings{'ENABLED'} eq "on" ){
+                                       print "<tr bgcolor='$color{'color20'}'>";
+                               } else {
+                                       print "<tr bgcolor='$color{'color18'}'>";
+                               }
+                                       print <<END
                                            <td align='center'>$outfwsettings{'PROT'}
                                            <td align='center'>$outfwsettings{'SNET'}
                                            <td align='center'>$outfwsettings{'DISPLAY_DIP'}:$outfwsettings{'DISPLAY_DPORT'}
@@ -462,17 +471,25 @@ END
 END
 ;
                                        if (($outfwsettings{'SIP'}) || ($outfwsettings{'SMAC'})) {
-                                               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 <<END
-                                               <tr><td width='14%' align='right'>$Lang::tr{'source ip'}:
-                                                   <td width='14%' align='left'>$outfwsettings{'DISPLAY_SIP'}
-                                                   <td width='44%' colspan='2' align='center'>
-END
-;
+
+                                               unless ($outfwsettings{'SIP'}) {
+                                                       $outfwsettings{'DISPLAY_SIP'} = 'ALL';
+                                               } else {
+                                                       $outfwsettings{'DISPLAY_SIP'} = $outfwsettings{'SIP'};
+                                               }
+
+                                               unless ($outfwsettings{'SMAC'}) {
+                                                       $outfwsettings{'DISPLAY_SMAC'} = 'ALL';
+                                                       print "<tr><td /><td align='left'>$Lang::tr{'source ip or net'}: </td>";
+                                                       print "<td align='left' colspan='2'>$outfwsettings{'DISPLAY_SIP'}</td>";
+                                               } else {
+                                                       $outfwsettings{'DISPLAY_SMAC'} = $outfwsettings{'SMAC'};
+                                                       print "<tr><td /><td align='left'>$Lang::tr{'source'} $Lang::tr{'mac address'}: </td>";
+                                                       print "<td align='left' colspan='2'>$outfwsettings{'DISPLAY_SMAC'}</td>";
+                                               }
                                        }
                                                print <<END
-                                               <tr><td width='14%' align='right'>$Lang::tr{'time'} - </td>
+                                               <tr><td width='14%' align='right'>$Lang::tr{'time'} -  </td>
                                                    <td width='14%' align='left'>
 END
 ;
@@ -559,13 +576,13 @@ END
                if ($p2pline[2] eq 'on') {
                        print <<END
                                <input type='hidden' name='ACTION' value='disable' />
-                               <input type='image' name='submit' src='/images/stock_ok.png' alt='/>
+                               <input type='image' name='submit' src='/images/stock_ok.png' alt='$Lang::tr{'outgoing firewall p2p allow'}' title='$Lang::tr{'outgoing firewall p2p allow'}'/>
 END
 ;
                } else {
                        print <<END
                                <input type='hidden' name='ACTION' value='enable' />
-                               <input type='image' name='submit' src='/images/stock_stop.png' alt='' />
+                               <input type='image' name='submit' src='/images/stock_stop.png' alt='$Lang::tr{'outgoing firewall p2p deny'}' title='$Lang::tr{'outgoing firewall p2p deny'}' />
 END
 ;
                }
@@ -576,7 +593,7 @@ END
        }
        print <<END
        </table>
-  <br />$Lang::tr{'outgoingfw p2p description'}
+  <br />$Lang::tr{'outgoing firewall p2p description 1'} <img src='/images/stock_ok.png' align='absmiddle' alt='$Lang::tr{'outgoing firewall p2p deny'}'> $Lang::tr{'outgoing firewall p2p description 2'} <img src='/images/stock_stop.png' align='absmiddle' alt='$Lang::tr{'outgoing firewall p2p deny'}'> $Lang::tr{'outgoing firewall p2p description 3'}
 END
 ;
        &Header::closebox();
@@ -586,9 +603,9 @@ END
 print <<END
        <form method='post' action='$ENV{'SCRIPT_NAME'}'>
        <table width='100%'>
-               <tr><td width='10%' align='left'><b>$Lang::tr{'mode'} 0:</b><td width='90%' align='left' colspan='2'>$Lang::tr{'outgoingfw mode0'}</td></tr>
-               <tr><td width='10%' align='left'><b>$Lang::tr{'mode'} 1:</b><td width='90%' align='left' colspan='2'>$Lang::tr{'outgoingfw mode1'}</td></tr>
-               <tr><td width='10%' align='left'><b>$Lang::tr{'mode'} 2:</b><td width='90%' align='left' colspan='2'>$Lang::tr{'outgoingfw mode2'}</td></tr>
+               <tr><td width='10%' align='left'><b>$Lang::tr{'mode'} 0:</b><td width='90%' align='left' colspan='2'>$Lang::tr{'outgoing firewall mode0'}</td></tr>
+               <tr><td width='10%' align='left'><b>$Lang::tr{'mode'} 1:</b><td width='90%' align='left' colspan='2'>$Lang::tr{'outgoing firewall mode1'}</td></tr>
+               <tr><td width='10%' align='left'><b>$Lang::tr{'mode'} 2:</b><td width='90%' align='left' colspan='2'>$Lang::tr{'outgoing firewall mode2'}</td></tr>
                <tr><td colspan='3'><hr /></td></tr>
                <tr><td width='10%' align='left'>       <select name='POLICY' style="width: 85px"><option value='MODE0' $selected{'POLICY'}{'MODE0'}>$Lang::tr{'mode'} 0</option><option value='MODE1' $selected{'POLICY'}{'MODE1'}>$Lang::tr{'mode'} 1</option><option value='MODE2' $selected{'POLICY'}{'MODE2'}>$Lang::tr{'mode'} 2</option></select>
                    <td width='45%' align='left'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
@@ -597,7 +614,7 @@ END
 ;
        if ($outfwsettings{'POLICY'} ne 'MODE0') {
                print <<END
-                   $Lang::tr{'outgoingfw reset'}: <input type='submit' name='ACTION' value=$Lang::tr{'reset'} />
+                   $Lang::tr{'outgoing firewall reset'}: <input type='submit' name='ACTION' value=$Lang::tr{'reset'} />
 END
 ;
        }
@@ -627,7 +644,7 @@ print <<END
                        <td width='30%' align='left' colspan='2'><input type='checkbox' name='ENABLED' $selected{'ENABLED'} /></td>
                </tr>
                <tr>
-                       <td width='20%' align='right'>$Lang::tr{'protocol'}:</td>
+                       <td width='20%' align='right'>$Lang::tr{'protocol'}</td>
                        <td width='30%' align='left'>
                                <select name='PROT'>
                                        <option value='all' $selected{'PROT'}{'all'}>All</option>
@@ -655,14 +672,16 @@ END
                                <select name='SNET'>
                                        <optgroup label='---'>
                                                <option value='all' $selected{'SNET'}{'ALL'}>$Lang::tr{'all'}</option>
+                                       <optgroup label='$Lang::tr{'mac address'}'>
+                                               <option value='mac' $selected{'SNET'}{'mac'}>$Lang::tr{'source'} $Lang::tr{'mac address'}</option>
+                                       </optgroup>
                                        <optgroup label='$Lang::tr{'ip address'}'>
-                                               <option value='ip' $selected{'SNET'}{'ip'}>IPSEC $Lang::tr{'interface'}</option>
-                                               <option value='red' $selected{'SNET'}{'red'}>OpenVPN $Lang::tr{'interface'}</option>
+                                               <option value='ip' $selected{'SNET'}{'ip'}>$Lang::tr{'source ip or net'}</option>
+                                               <option value='red' $selected{'SNET'}{'red'}>$Lang::tr{'red'} IP</option>
                                        </optgroup>
+                                       <optgroup label='$Lang::tr{'alt vpn'}'>
+                                               <option value='ovpn' $selected{'SNET'}{'ovpn'}>OpenVPN $Lang::tr{'interface'}</option>
                                        </optgroup>
-                                               <option value='ipsec' $selected{'SNET'}{'ipsec'}>$Lang::tr{'source ip'}</option>
-                                               <option value='ovpn' $selected{'SNET'}{'ovpn'}>$Lang::tr{'red'} IP</option>
-                                       <optgroup label='$Lang::tr{'network'}'>
                                        <optgroup label='$Lang::tr{'network'}'>
                                                <option value='green' $selected{'SNET'}{'green'}>$Lang::tr{'green'}</option>
 END
@@ -675,19 +694,37 @@ END
        }
        print <<END
                                        </optgroup>
-                                       <optgroup label='$Lang::tr{'advproxy NCSA group'}'>
+                                       <optgroup label='IP $Lang::tr{'advproxy NCSA group'}'>
 END
 ;
        my @ipgroups = qx(ls $configpath/ipgroups/);
        foreach (sort @ipgroups){
-               print "\t\t\t\t\t<option value='$_' $selected{'SNET'}{'$_'}>$_</option>\n";
+               chomp($_);
+               print "\t\t\t\t\t<option value='$_' $selected{'SNET'}{$_}>$_</option>\n";
+       }
+       print <<END
+                                       </optgroup>
+                                       <optgroup label='MAC $Lang::tr{'advproxy NCSA group'}'>
+END
+;
+       my @macgroups = qx(ls $configpath/macgroups/);
+       foreach (sort @macgroups){
+               chomp($_);
+               print "\t\t\t\t\t<option value='$_' $selected{'SNET'}{$_}>$_</option>\n";
        }
        print <<END
                                        </optgroup>
                                </select>
                        </td>
-                       <td width='20%' align='right' colspan='2'>$Lang::tr{'source ip'}: <img src='/blob.gif' /></td>
-                       <td width='30%' align='left' colspan='2'><input type='text' name='SIP' maxlength='15' value='$outfwsettings{'SIP'}' /></td>
+                       <td align='right' colspan='4'><font color='red'>$Lang::tr{'outgoing firewall warning'}</font></td>
+               </tr>
+               <tr>
+                       <td align='right' colspan='4' >$Lang::tr{'source ip or net'}<img src='/blob.gif' /></td>
+                       <td align='left' colspan='4' ><input type='text' name='SIP' value='$outfwsettings{'SIP'}' /></td>
+               </tr>
+               <tr>
+                       <td align='right' colspan='4' >$Lang::tr{'source'} $Lang::tr{'mac address'}: <img src='/blob.gif' />
+                       <td align='left' colspan='4' ><input type='text' name='SMAC' maxlength='23' value='$outfwsettings{'SMAC'}' />
                </tr>
                <tr>
                        <td width='20%' align='right'>$Lang::tr{'logging'}:</td>
@@ -700,10 +737,10 @@ END
                        <td width='20%' align='right' colspan='2' />
                        <td width='30%' align='left' colspan='2' />
                <tr>
-                       <td width='20%' align='right'>$Lang::tr{'destination ip'}: <img src='/blob.gif' /></td>
-                       <td width='30%' align='left'><input type='text' name='DIP' maxlength='15' value='$outfwsettings{'DIP'}' /></td>
-                       <td width='20%' align='right' colspan='2'>$Lang::tr{'destination port'}: <img src='/blob.gif' /></td>
-                       <td width='30%' align='left' colspan='2'><input type='text' name='DPORT' maxlength='11' value='$outfwsettings{'DPORT'}' /></td>
+                       <td width='20%' align='right'>$Lang::tr{'destination ip or net'}: <img src='/blob.gif' /></td>
+                       <td width='30%' align='left'><input type='text' name='DIP'  value='$outfwsettings{'DIP'}' /></td>
+                       <td width='20%' align='right' colspan='2'>$Lang::tr{'destination port'}(s) <img src='/blob.gif' /></td>
+                       <td width='30%' align='left' colspan='2'><input type='text' name='DPORT' value='$outfwsettings{'DPORT'}' /></td>
                </tr>
                <tr>
                        <td width='20%' align='right'>$Lang::tr{'time'}:</td>
@@ -809,4 +846,4 @@ END
 }
 
 &Header::closebigbox();
-&Header::closepage();
\ No newline at end of file
+&Header::closepage();