pakfire cgi not refreshes after upgrades

readded firewall options to disbale drop logging
added log option for outgoing fw mode 1
cleaned kernel log from firewall messages
change firewall init script because of changes
added samba cgi ability to change charsets
started core update number 4


git-svn-id: http://svn.ipfire.org/svn/ipfire/branches/2.1/trunk@1132 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
maniacikarus
2007-12-28 16:22:35 +00:00
parent 071e69ccf6
commit 5595bc0381
19 changed files with 234 additions and 47 deletions

View File

@@ -333,7 +333,7 @@ foreach $_ (@log)
my $comment = $3;
my $packet = $4;
$packet =~ /IN=(\w+)/; my $iface=$1;
$packet =~ /IN=(\w+)/; my $iface=$1; if ( $1 eq "27" ){ $iface="";}
$packet =~ /SRC=([\d\.]+)/; my $srcaddr=$1;
$packet =~ /DST=([\d\.]+)/; my $dstaddr=$1;
$packet =~ /MAC=([\w+\:]+)/; my $macaddr=$1;

View File

@@ -12,8 +12,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";
@@ -50,21 +50,20 @@ my $year = $now[5]+1900;
$cgiparams{'DAY'} = $now[3];
$cgiparams{'MONTH'} = $now[4];
$cgiparams{'ACTION'} = '';
$cgiparams{'SECTION'} = 'ipfire';
$cgiparams{'SECTION'} = 'kernel';
my %sections = (
'ipfire' => '(ipfire)',
'red' => '(red.*|kernel: usb.*|pppd\[.*\]|chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|kernel: eth.*|dhcpcd\[.*\]|modem_run\[.*\])',
'dns' => '(dnsmasq\[.*\])',
'dhcp' => '(dhcpd)',
'cron' => '(fcron\[.*\])',
'ntp' => '(ntpd(?:ate)?\[.*\])',
'ssh' => '(sshd(?:\(.*\))?\[.*\])',
'auth' => '(\w+\(pam_unix\)\[.*\])',
'kernel' => '(kernel)',
'ipsec' => '(ipsec_[\w_]+|pluto\[.*\]|vpnwatch)',
'snort' => '(snort)',
'openvpn' => '(openvpnserver)\[.*\]'
'ipfire' => '(ipfire: )',
'red' => '(red:|pppd\[.*\]: |chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|dhcpcd\[.*\]|modem_run\[.*\])',
'dns' => '(dnsmasq\[.*\]: )',
'dhcp' => '(dhcpd: )',
'cron' => '(fcron\[.*\]: )',
'ntp' => '(ntpd(?:ate)?\[.*\]: )',
'ssh' => '(sshd(?:\(.*\))?\[.*\]: )',
'auth' => '(\w+\(pam_unix\)\[.*\]: )',
'kernel' => '(kernel: (?!DROP-))',
'ipsec' => '(ipsec_[\w_]+: |pluto\[.*\]: |vpnwatch: )',
'openvpn' => '(openvpnserver)\[.*\]: '
);
# Translations for the %sections array.
@@ -80,7 +79,6 @@ my %trsections = (
'kernel' => "$Lang::tr{'kernel'}",
'ipsec' => 'IPSec',
'openvpn' => 'OpenVPN',
'snort' => 'Snort'
);
@@ -197,7 +195,7 @@ while ($gzindex >=0 && $loop) {
#&General::log("reading $filestr");
READ:while (<FILE>) {
my $line = $_;
if ($line =~ /^${monthstr} ${daystr} ..:..:.. [\w\-]+ ${section}: (.*)/) {
if ($line =~ /^${monthstr} ${daystr} ..:..:.. [\w\-]+ ${section}(.*)/) {
# when standart viewing, just keep in memory the correct slice
# it starts a '$start' and size is $viewport
# If export, then keep all lines...
@@ -242,11 +240,11 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'export'})
foreach $_ (@log)
{
/^... (..) (..:..:..) [\w\-]+ ${section}: (.*)$/;
/^... (..) (..:..:..) [\w\-]+ ${section}(.*)$/;
my $day = $1;
$day =~ tr / /0/;
my $time = $cgiparams{'DAY'} ? "$2" : "$day/$2" ;
print "$time $3 $4\r\n";
print "$time $3 $4\r\n";
}
exit 0;
}
@@ -365,7 +363,7 @@ $lines = 0;
#print '<tt>';
foreach $_ (@log)
{
/^... (..) (..:..:..) [\w\-]+ ${section}: (.*)$/;
/^... (..) (..:..:..) [\w\-]+ ${section}(.*)$/;
my $day = $1;
$day =~ tr / /0/;
my $time = $cgiparams{'DAY'} ? "$2" : "$day/$2" ;

View File

@@ -306,7 +306,7 @@ foreach $_ (@slice)
$timestamp =~ /(...) (..) (..:..:..)/;
my $month = $1; my $day = $2; my $time = $3;
if ($a =~ /IN\=(\w+)/) { $in = $1; }
if ($a =~ /IN\=(\w+)/) { $iface = $1; }
if ($a =~ /OUT\=(\w+)/) { $out = $1; }
if ($a =~ /SRC\=([\d\.]+)/) { $srcaddr = $1; }
if ($a =~ /DST\=([\d\.]+)/) { $dstaddr = $1; }
@@ -314,7 +314,6 @@ foreach $_ (@slice)
my $protostrlc = lc($protostr);
if ($a =~ /SPT\=([\d\.]+)/){ $srcport = $1; }
if ($a =~ /DPT\=([\d\.]+)/){ $dstport = $1; }
$a =~ /IN=(\w+)/; my $iface=$1;
if ($lines % 2) {
print "<tr bgcolor='${Header::table1colour}'>\n"; }

View File

@@ -312,7 +312,7 @@ foreach $_ (@slice)
$timestamp =~ /(...) (..) (..:..:..)/;
my $month = $1; my $day = $2; my $time = $3;
if ($a =~ /IN\=(\w+)/) { $in = $1; }
if ($a =~ /IN\=(\w+)/) { $iface = $1; }
if ($a =~ /OUT\=(\w+)/) { $out = $1; }
if ($a =~ /SRC\=([\d\.]+)/) { $srcaddr = $1; }
if ($a =~ /DST\=([\d\.]+)/) { $dstaddr = $1; }
@@ -320,7 +320,6 @@ foreach $_ (@slice)
my $protostrlc = lc($protostr);
if ($a =~ /SPT\=([\d\.]+)/){ $srcport = $1; }
if ($a =~ /DPT\=([\d\.]+)/){ $dstport = $1; }
$a =~ /IN=(\w+)/; my $iface=$1;
if ($lines % 2) {
print "<tr bgcolor='${Header::table1colour}'>\n"; }

101
html/cgi-bin/optionsfw.cgi Normal file
View File

@@ -0,0 +1,101 @@
#!/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 <grhm@grhm.co.uk>
#
# $Id: optionsfw.cgi,v 1.1.2.10 2005/10/03 00:34:10 gespinasse Exp $
#
#
# 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
# File used
my $filename = "${General::swroot}/optionsfw/settings";
our %settings=();
$settings{'DISABLEPING'} = 'NO';
$settings{'DROPNEWNOTSYN'} = 'on';
$settings{'DROPINPUT'} = 'on';
$settings{'DROPOUTPUT'} = 'on';
$settings{'DROPPORTSCAN'} = 'on';
my $errormessage = '';
my $warnmessage = '';
&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
}
&Header::openpage($Lang::tr{'options fw'}, 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'warning messages'});
print "<font color='red'>$errormessage&nbsp;</font>";
&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{'DROPOUTPUT'}{'off'} = '';
$checked{'DROPOUTPUT'}{'on'} = '';
$checked{'DROPOUTPUT'}{$settings{'DROPOUTPUT'}} = "checked='checked'";
$checked{'DROPPORTSCAN'}{'off'} = '';
$checked{'DROPPORTSCAN'}{'on'} = '';
$checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'";
&Header::openbox('100%', 'center', $Lang::tr{'options fw'});
print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='95%' cellspacing='0'>
<tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw logging'}</b></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'drop newnotsyn'}</td><td align='left'>on <input type='radio' name='DROPNEWNOTSYN' value='on' $checked{'DROPNEWNOTSYN'}{'on'} />/
<input type='radio' name='DROPNEWNOTSYN' value='off' $checked{'DROPNEWNOTSYN'}{'off'} /> off</td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'drop input'}</td><td align='left'>on <input type='radio' name='DROPINPUT' value='on' $checked{'DROPINPUT'}{'on'} />/
<input type='radio' name='DROPINPUT' value='off' $checked{'DROPINPUT'}{'off'} /> off</td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'drop output'}</td><td align='left'>on <input type='radio' name='DROPOUTPUT' value='on' $checked{'DROPOUTPUT'}{'on'} />/
<input type='radio' name='DROPOUTPUT' value='off' $checked{'DROPOUTPUT'}{'off'} /> off</td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'drop portscan'}</td><td align='left'>on <input type='radio' name='DROPPORTSCAN' value='on' $checked{'DROPPORTSCAN'}{'on'} />/
<input type='radio' name='DROPPORTSCAN' value='off' $checked{'DROPPORTSCAN'}{'off'} /> off</td></tr>
</table>
<br />
<table width='10%' cellspacing='0'>
<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value=$Lang::tr{'save'} />
<input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/media-floppy.png' /></form></td></tr>
</table>
</form>
END
;
&Header::closebox();
&Header::closebigbox();
&Header::closepage();

View File

@@ -71,10 +71,15 @@ $outfwsettings{'DISPLAY_DPORT'} = '';
$outfwsettings{'DISPLAY_SMAC'} = '';
$outfwsettings{'DISPLAY_SIP'} = '';
$outfwsettings{'POLICY'} = 'MODE0';
$outfwsettings{'MODE1LOG'} = 'off';
&General::readhash("${General::swroot}/outgoing/settings", \%outfwsettings);
&Header::getcgihash(\%outfwsettings);
$checked{'MODE1LOG'}{'off'} = '';
$checked{'MODE1LOG'}{'on'} = '';
$checked{'MODE1LOG'}{$outfwsettings{'MODE1LOG'}} = "checked='checked'";
if ($outfwsettings{'POLICY'} eq 'MODE0'){ $selected{'POLICY'}{'MODE0'} = 'selected'; } else { $selected{'POLICY'}{'MODE0'} = ''; }
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'} = ''; }
@@ -98,8 +103,10 @@ if ($outfwsettings{'ACTION'} eq $Lang::tr{'reset'})
if ($outfwsettings{'ACTION'} eq $Lang::tr{'save'})
{
my $MODE = $outfwsettings{'POLICY'};
my $MODE1LOG = $outfwsettings{'MODE1LOG'};
%outfwsettings = ();
$outfwsettings{'POLICY'} = "$MODE";
$outfwsettings{'MODE1LOG'} = "$MODE1LOG";
&General::writehash("${General::swroot}/outgoing/settings", \%outfwsettings);
system("/usr/local/bin/outgoingfwctrl");
}
@@ -331,6 +338,22 @@ END
;
}
}
if ($outfwsettings{'POLICY'} eq 'MODE1'){
print <<END
<tr bgcolor='$color{'color20'}'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<td align='center'>tcp&udp
<td align='center'>all
<td align='center'>ALL
<td align='center'>drop
<td align='center'><img src='/images/stock_stop.png' alt='DENY' />
<td align='center'>on <input type='radio' name='MODE1LOG' value='on' $checked{'MODE1LOG'}{'on'} /><input type='radio' name='MODE1LOG' value='off' $checked{'MODE1LOG'}{'off'} /> off
<td align='center'><input type='hidden' name='ACTION' value=$Lang::tr{'save'} /><input type='image' src='/images/media-floppy.png' width="18" height="18" alt=$Lang::tr{'save'} /></form></tr>
<table border='0' cellpadding='0' cellspacing='0'><tr>
<td>
<td></table>
END
;
}
print <<END
</table>
END

View File

@@ -46,6 +46,8 @@ $pakfiresettings{'AUTOUPDATE'} = 'off';
$pakfiresettings{'AUTOUPGRADE'} = 'off';
$pakfiresettings{'UUID'} = 'on';
sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();}
&Header::getcgihash(\%pakfiresettings);
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
@@ -141,6 +143,7 @@ END
} elsif ($pakfiresettings{'ACTION'} eq 'upgrade') {
system("/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null");
refreshpage();
} elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}") {

View File

@@ -90,6 +90,9 @@ $sambasettings{'OTHERINTERFACES'} = '127.0.0.1';
$sambasettings{'GUESTACCOUNT'} = 'samba';
$sambasettings{'MAPTOGUEST'} = 'Never';
$sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
$sambasettings{'DOSCHARSET'} = 'CP850';
$sambasettings{'UNIXCHARSET'} = 'UTF8';
$sambasettings{'DISPLAYCHARSET'} = 'CP850';
$sambasettings{'SOCKETOPTIONS'} = 'TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 SO_KEEPALIVE';
### Values that have to be initialized
$sambasettings{'ACTION'} = '';
@@ -151,6 +154,9 @@ if ($sambasettings{'ACTION'} eq 'globalresetyes')
$sambasettings{'GUESTACCOUNT'} = 'samba';
$sambasettings{'MAPTOGUEST'} = 'Never';
$sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
$sambasettings{'DOSCHARSET'} = 'CP850';
$sambasettings{'UNIXCHARSET'} = 'UTF8';
$sambasettings{'DISPLAYCHARSET'} = 'CP850';
### Samba CUPS Variablen
$sambasettings{'LOADPRINTERS'} = 'Yes';
$sambasettings{'PRINTING'} = 'cups';
@@ -256,7 +262,9 @@ fstype = NTFS
kernel oplocks = false
map to guest = $sambasettings{'MAPTOGUEST'}
smb ports = 445 139
unix charset = CP850
dos charset = $sambasettings{'DOSCHARSET'}
unix charset = $sambasettings{'UNIXCHARSET'}
display charset = $sambasettings{'DISPLAYCHARSET'}
security = $sambasettings{'SECURITY'}
encrypt passwords = yes
@@ -276,7 +284,7 @@ wins server = $sambasettings{'WINSSRV'}
log file = /var/log/samba/samba-log.%m
lock directory = /var/lock/samba
pid directory = /var/run/
pid directory = /var/run/
log level = $sambasettings{'LOGLEVEL'}
preferred master = $sambasettings{'PREFERREDMASTER'}
@@ -419,6 +427,9 @@ print <<END
<tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'basic options'}</b></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'workgroup'}</td><td align='left'><input type='text' name='WORKGRP' value='$sambasettings{'WORKGRP'}' size="30" /></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'netbios name'}</td><td align='left'><input type='text' name='NETBIOSNAME' value='$sambasettings{'NETBIOSNAME'}' size="30" /></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'dos charset'}</td><td align='left'><input type='text' name='DOSCHARSET' value='$sambasettings{'DOSCHARSET'}' size="30" /></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'unix charset'}</td><td align='left'><input type='text' name='UNIXCHARSET' value='$sambasettings{'UNIXCHARSET'}' size="30" /></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'display charset'}</td><td align='left'><input type='text' name='DISPLAYCHARSET' value='$sambasettings{'DISPLAYCHARSET'}' size="30" /></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'server string'}</td><td align='left'><input type='text' name='SRVSTRING' value='$sambasettings{'SRVSTRING'}' size="30" /></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'log level'}</td><td align='left'><input type='text' name='LOGLEVEL' value='$sambasettings{'LOGLEVEL'}' size="30" /></td></tr>
<tr><td align='left' width='40%'>$Lang::tr{'interfaces'}</td><td align='left'>on <input type='radio' name='VPN' value='on' $checked{'VPN'}{'on'} />/