M
mian
Guest
Code:
--- maillogconvert.pl 2004-09-14 04:48:07.000000000 +0930
+++ /usr/local/awstats/tools/maillogconvert.pl 2005-10-20 12:38:04.205717080 +0930
@@ -27,7 +27,7 @@
$Debug
%mail %qmaildelivery
$help
-$mode $year $lastmon $Debug
+$mode $year $lastmon $Debug $filterdomain
$NBOFENTRYFOFLUSH
$MailType
%MonthNum
@@ -178,6 +178,7 @@
if ($param{$key} =~ /(^|-|&)debug=([^&]+)/i) { $Debug=$2; shift; next; }
if ($param{$key} =~ /^(\d+)$/) { $year=$1; shift; next; }
if ($param{$key} =~ /^(standard|vadmin)$/i) { $mode=$1; shift; next; }
+ if ($param{$key} =~ /^(.*\..*)$/i) { $filterdomain=$1; shift; next; }
}
if ($mode ne 'standard' and $mode ne 'vadmin') { $help = 1; }
@@ -325,10 +326,10 @@
# sendmail: Sep 30 04:21:32 halley sendmail[3161]: g8U2LVi03161: ruleset=check_rcpt, arg1=<[email protected]>, relay=moon.partenor.fr [10.0.0.254], reject=550 5.7.1 <[email protected]>... Relaying denied
# sendmail: Jan 10 07:37:48 smtp sendmail[32440]: ruleset=check_relay, arg1=[211.228.26.114], arg2=211.228.26.114, relay=[211.228.26.114], reject=554 5.7.1 Rejected 211.228.26.114 found in dnsbl.sorbs.net
- # sendmail: Jan 10 07:37:08 smtp sendmail[32439]: ruleset=check_relay, arg1=235.Red-213-97-175.pooles.rima-tde.net, arg2=213.97.175.235, relay=235.Red-213-97-175.pooles.rima-tde.net [213.97.175.235], reject=550 5.7.1 Mail from 213.97.175.235 refused. Rejected for bad WHOIS info on IP of your SMTP server - see http://www.rfc-ignorant.org/
+ # sendmail: Jan 10 07:37:08 smtp sendmail[32439]: ruleset=check_relay, arg1=235.Red-213-97-175.pooles.rima-tde.net, arg2=213.97.175.235, relay=235.Red-213-97-175.pooles.rima-tde.net [213.97.175.235], reject=550 5.7.1 Mail from 213.97.175.235 refused. Rejected for bad WHOIS info on IP of your SMTP server - see http://www.rfc-ignorant.org/
# sendmail: Jan 10 17:15:42 smtp sendmail[12770]: ruleset=check_relay, arg1=[63.218.84.21], arg2=63.218.84.21, relay=[63.218.84.21], reject=553 5.3.0 Rejected - see http://spamhaus.org/
my ($mon,$day,$time,$id,$ruleset,$arg,$relay_s,$code)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+[\w\-\.\@]+\s+(?:sendmail|sm-mta)\[\d+\][:\s]*(.*?):\sruleset=(\w+),\s+arg1=(.*),\s+relay=(.*),\s+(reject=.*)/;
- # sendmail: Jan 10 18:00:34 smtp sendmail[5759]: i04Axx2c005759: Milter: data, reject=511 Virus found in email!
+ # sendmail: Jan 10 18:00:34 smtp sendmail[5759]: i04Axx2c005759: Milter: data, reject=511 Virus found in email!
if (! $mon) { ($mon,$day,$time,$id,$ruleset,$code)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+[\w\-\.\@]+\s+(?:sendmail|sm-mta)\[\d+\]:\s+(.*?):\s\w+:\s(\w+),\s+(reject=.*)/; }
$mailid=(! $id && $mon?'999':$id); # id not provided in log, we take '999'
if ($mailid) {
@@ -630,7 +631,9 @@
# If we can
if ($canoutput) {
- &OutputRecord($mail{$mailid}{'year'}?$mail{$mailid}{'year'}:$year,$mail{$mailid}{'mon'},$mail{$mailid}{'day'},$mail{$mailid}{'time'},$mail{$mailid}{'from'},$to,$mail{$mailid}{'relay_s'},$mail{$mailid}{'relay_r'},$code,$mail{$mailid}{'size'},$mail{$mailid}{'forwardto'},$mail{$mailid}{'extinfo'});
+ if ($mail{$mailid}{'from'} =~ /$filterdomain$/ || $to =~ /$filterdomain$/) {
+ &OutputRecord($mail{$mailid}{'year'}?$mail{$mailid}{'year'}:$year,$mail{$mailid}{'mon'},$mail{$mailid}{'day'},$mail{$mailid}{'time'},$mail{$mailid}{'from'},$to,$mail{$mailid}{'relay_s'},$mail{$mailid}{'relay_r'},$code,$mail{$mailid}{'size'},$mail{$mailid}{'forwardto'},$mail{$mailid}{'extinfo'});
+ }
# Delete mail with generic unknown id (This id can by used by another mail)
if ($mailid eq '999') {
debug(" Delete mail for id=$mailid",3);
Code:
--- awstats.pl 2005-02-25 07:32:23.000000000 +1030
+++ /usr/local/awstats/wwwroot/cgi-bin/awstats.pl 2005-10-01 15:14:43.000000000 +0930
@@ -5632,6 +5632,7 @@
exit 2;
}
$SiteConfig||=&Sanitize($ENV{'SERVER_NAME'});
+
#$ENV{'SERVER_NAME'}||=$SiteConfig; # For thoose who use __SERVER_NAME__ in conf file and use CLI.
$ENV{'AWSTATS_CURRENT_CONFIG'}=$SiteConfig;
@@ -5730,6 +5731,12 @@
exit 0;
}
+my $Domain = $ENV{'SERVER_NAME'};
+$Domain =~ s/^([^\.]+)//g;
+if (! ($SiteConfig =~ /^([^\.]+).$Domain/i)) {
+ error("Server '".$ENV{"SERVER_NAME"}."' is not allowed to access statistics of this domain/config.");
+}
+
# Security check
if ($AllowAccessFromWebToAuthenticatedUsersOnly && $ENV{'GATEWAY_INTERFACE'}) {
if ($Debug) { debug("REMOTE_USER=".$ENV{"REMOTE_USER"}); }
@@ -6068,7 +6075,7 @@
$LogFormat = $fixField[0];
&DefinePerlParsingFormat();
}
- }
+ }
# Parse line record to get all required fields
if (! (@field=map(/$PerlParsingFormat/,$line))) {