[Logwatch-Devel] Patches for named, smartd, cron and modprobe

Anssi Kolehmainen anssi.kolehmainen@pp.inet.fi
Thu, 1 Jan 2004 19:17:19 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0001_01C3D09B.E0D130A0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi,

Attached patch files (against current cvs) do following:

named:
 - show 'dynamic update by ip is insecure' zones
 
smartd:
 - changed show style from one line per change to one line per attribute
 Before:
   1 Time(s): SMART Prefailure Attribute: 1 Raw_Read_Error_Rate changed from
58 to 59 
   1 Time(s): SMART Prefailure Attribute: 1 Raw_Read_Error_Rate changed from
59 to 58 
   1 Time(s): SMART Prefailure Attribute: 1 Raw_Read_Error_Rate changed from
59 to 60 
   3 Time(s): SMART Usage Attribute: 194 Temperature_Celsius changed from 46
to 47 
   2 Time(s): SMART Usage Attribute: 194 Temperature_Celsius changed from 47
to 46 
 After:
   Prefailure: Raw_Read_Error_Rate (1) changed to 58, 59, 60
   Usage: Hardware_ECC_Recovered (195) changed to 58, 59, 60
   Usage: Temperature_Celsius (194) changed to 46, 47, 48, 49
 
cron:
 - parse ORPHAN entries
 
modprobe:
 - add sorting


Anssi Kolehmainen

------=_NextPart_000_0001_01C3D09B.E0D130A0
Content-Type: application/octet-stream;
	name="logwatch-modprobe.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="logwatch-modprobe.patch"

diff -ru logwatch-cvs/scripts/services/modprobe =
logwatch-patched/scripts/services/modprobe
--- logwatch-cvs/scripts/services/modprobe  2003-12-29 =
06:58:49.000000000 +0200
+++ logwatch-patched/scripts/services/modprobe  2004-01-01 =
19:03:13.000000000 +0200
@@ -30,7 +30,7 @@
=20
 if (keys %Modules) {
    print "\nCan't locate these modules:\n";
-   foreach my $ThisOne (keys %Modules) {
+   foreach my $ThisOne (sort keys %Modules) {
       print "   " . $ThisOne . ": " . $Modules{$ThisOne} . " =
Time(s)\n";
    }
 }

------=_NextPart_000_0001_01C3D09B.E0D130A0
Content-Type: application/octet-stream;
	name="logwatch-named.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="logwatch-named.patch"

diff -ru logwatch-cvs/scripts/services/named =
logwatch-patched/scripts/services/named
--- logwatch-cvs/scripts/services/named 2003-12-29 06:58:49.000000000 =
+0200
+++ logwatch-patched/scripts/services/named 2004-01-01 =
18:09:20.000000000 +0200
@@ -60,6 +60,7 @@
          ($ThisLine =3D~ /^exiting/) or
          ($ThisLine =3D~ /^no longer listening/) or
          ($ThisLine =3D~ /^shutting down/) or
+         ($ThisLine =3D~ /^stopping command channel on [0-9.#]/) or
          ($ThisLine =3D~ /^the default for the .* option is now/) or
          ($ThisLine =3D~ /^Malformed response from/) or
          ($ThisLine =3D~ /client .+#\d+: query:/) or
@@ -113,6 +114,10 @@
       $DeniedQuery{$FullClient}++;
    } elsif ( ($Rhost, $Ldom) =3D ($ThisLine =3D~ /^client =
([\d\.]+)#\d+: update '(.*)' denied/)) {
       $UpdateDenied{"$Rhost ($Ldom)"}++;
+   } elsif ( ($Zone) =3D ($ThisLine =3D~ /^zone '([0-9a-zA-Z.-]+)' =
allows updates by IP address, which is insecure/)) {
+      $InsecUpdate{$Zone}++;
+   } elsif ( ($Zone) =3D ($ThisLine =3D~ /^zone ([0-9a-zA-Z.\/-]+): =
journal rollforward failed: journal out of sync with zone/)) {
+      $JournalFail{$Zone}++;
    } else {
       # Report any unmatched entries...
       # remove PID from named messages
@@ -217,6 +222,20 @@
    }
 }
=20
+if ( keys %InsecUpdate ) {
+   print "\nInsecure zones (dynamic update allowed by IP address):\n";
+   foreach $ThisOne (sort {$a cmp $b} keys %InsecUpdate) {
+      print "   " . $ThisOne . ": " . $InsecUpdate{$ThisOne} . " =
Time(s)\n";
+   }
+}
+
+if ( keys %JournalFail ) {
+   print "\nJournall rollforward failed:\n";
+   foreach $ThisOne (sort {$a cmp $b} keys %JournalFail) {
+      print "   " . $ThisOne . ": " . $JournalFail{$ThisOne} . " =
Time(s)\n";
+   }
+}
+
 if (keys %OtherList) {
    print "\n**Unmatched Entries**\n";
    foreach $line (sort {$a cmp $b} keys %OtherList) {

------=_NextPart_000_0001_01C3D09B.E0D130A0
Content-Type: application/octet-stream;
	name="logwatch-smartd.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="logwatch-smartd.patch"

diff -ru logwatch-cvs/scripts/services/smartd =
logwatch-patched/scripts/services/smartd
--- logwatch-cvs/scripts/services/smartd    2003-12-29 =
06:58:50.000000000 +0200
+++ logwatch-patched/scripts/services/smartd    2004-01-01 =
18:47:24.000000000 +0200
@@ -17,17 +17,28 @@
        # ignore
    } elsif ( ($Device,$Msg) =3D ($ThisLine =3D~ /^Device: ([^,]+), =
appears to lack SMART*/ )) {
        # ignore
-   } elsif ( ($Device,$Msg) =3D ($ThisLine =3D~ /^Device: ([^,]+), =
(.*)$/)) {
-      $ParamChanges{$Device}{$Msg}++;
+#   } elsif ( ($Device,$Msg) =3D ($ThisLine =3D~ /^Device: ([^,]+), =
(.*)$/)) {
+#      $ParamChanges{$Device}{$Msg}++;
+   } elsif ( ($Device,$AttribType,$Code,$Name,undef,$NewVal) =3D =
($ThisLine =3D~ /^Device: ([^,]+), SMART ([A-Za-z]+) Attribute: ([0-9]+) =
([A-Za-z_]+) changed from ([0-9]+) to
([0-9]+)/)) {
+      $ParamChanges{$Device}{"$AttribType: $Name ($Code)"}{$NewVal}++;
    }
 }
=20
 if (keys %ParamChanges) {
    foreach $Device (sort keys %ParamChanges) {
-     print "\n$Device :\n";
-     foreach $Msg (sort keys %{$ParamChanges{$Device}}) {
-       print "   $ParamChanges{$Device}{$Msg} Time(s): $Msg \n";
-     }
+      print "\n$Device :\n";
+      foreach $Msg (sort keys %{$ParamChanges{$Device}}) {
+         print "   $Msg changed to ";
+         $vv=3D"";
+         foreach $Val (sort keys %{$ParamChanges{$Device}{$Msg}}) {
+            if (! $vv eq "") {
+               print "$vv, ";
+            }
+            $vv =3D "$Val";
+            #$vv .=3D " ($ParamChanges{$Device}{$Msg}{$Val} times)";
+         }
+         print "$vv\n";
+      }
    }
 }
 
------=_NextPart_000_0001_01C3D09B.E0D130A0
Content-Type: application/octet-stream;
	name="logwatch-cron.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="logwatch-cron.patch"

diff -ru logwatch-cvs/scripts/services/cron =
logwatch-patched/scripts/services/cron
--- logwatch-cvs/scripts/services/cron  2003-12-29 06:58:49.000000000 =
+0200
+++ logwatch-patched/scripts/services/cron  2004-01-01 =
19:01:44.000000000 +0200
@@ -19,6 +19,8 @@
       $User =3D $1;
       if ($ThisLine =3D~ s/^CMD \((.+)\)\s*$/$1/) {
               $Runs->{$User}->{$ThisLine}++;
+      } elsif ($ThisLine =3D~ /ORPHAN \(no passwd entry\)/) {
+              $Orphans++;
       } elsif ($ThisLine =3D~ s/^(BEGIN|END) EDIT \((.+)\)\s*$/$2/) {
               $Runs->{$ThisLine}->{'personal crontab edited'} +=3D 0.5;
       } elsif ($ThisLine =3D~ s/^REPLACE \((.+)\)\s*$/$1/) {
@@ -64,6 +66,10 @@
          print '      ' . $i . ' ' . $UserReloads{$i} . " Time(s)\n";
       }
    }
+  =20
+   if ($Orphans) {
+      print "   ORPHAN entries: $Orphans\n";
+   }
=20
    if ($Startups) {
       print "   CRON Restarted " . $Startups . " Time(s)\n";

------=_NextPart_000_0001_01C3D09B.E0D130A0--