Fwd: Patch for Logwatch 7.3.6 for Ubuntu 7.10

"Kirk Bauer" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
---------- Forwarded message ----------
From: Paul Schulz <[email protected]>
Date: Jan 9, 2008 10:17 PM
Subject: Patch for Logwatch 7.3.6 for Ubuntu 7.10
To: [email protected]


Hi Kirk,

Please find attached a patch for Logwatch pam_auth script. This also
fixes a bug with the fc5 regular expression.

I have also reported this to the Ubuntu bugtracker..
https://bugs.launchpad.net/ubuntu/+source/logwatch/+bug/181690

Regards,
Paul Schulz <[email protected]>



-- 
Kirk Bauer <[email protected]>
http://linux.kaybee.org | www.logwatch.org
Author, Automating UNIX & Linux Administration

_______________________________________________
Logwatch-Devel mailing list
[email protected]
http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
patch-logwatch-7.3.6-ps1.diff (text/x-patch, 1.6 KB)
diff --git a/scripts/services/pam_unix b/scripts/services/pam_unix
index fce13a1..7720d8e 100755
--- a/scripts/services/pam_unix
+++ b/scripts/services/pam_unix
@@ -105,7 +105,7 @@ while ($line = <STDIN>) {
 	if ($line =~ s/^... .. ..:..:.. .+ .+\(pam_unix\)\[\d+\]: //) {
 		$service =~ s/^... .. ..:..:.. .+ (.+)\(pam_unix\)\[\d+\]: .*$/$1/;
    # new fedora (fc5) version 
-   } elsif ( $line =~ s/^... .. ..:..:.. .+ pam_unix(.+:.+): //  ) {
+   } elsif ( $line =~ s/^... .. ..:..:.. .+ pam_unix\(.+:.+\): //  ) {
       $service =~ s/^... .. ..:..:.. .+ pam_unix\((.+):.+\): .*$/$1/;
    # for debian sarge - "normal" lines
    } elsif ($line =~ s/^... .. ..:..:.. .+ [^ :]+: \(pam_unix\) //) {
@@ -116,12 +116,15 @@ while ($line = <STDIN>) {
    #for debian woody
    } elsif ( $line =~ s/^... .. ..:..:.. .+ PAM_unix\[\d+\]: \((.*?)\) // ) {
       $service =~ s/^... .. ..:..:.. .+ PAM_unix\[\d+\]: \(([^ ]*)\) .*/$1/;
+   # for Ubuntu 7.10
+   } elsif ( $line =~ s/^... .. ..:..:.. .+ \S+\[\d+\]: pam_unix_\S+\(.+:.+\): //  ) {
+      $service =~ s/^... .. ..:..:.. .+ \S+\[\d+\]: pam_unix_\S+\((.+):.+\): .*$/$1/;
 	} else {
 		next;
 	}
    #lowercase the service 
    $service = lc($service); 
-	if (($service eq 'sshd') or ($service eq 'login') or ($service eq 'ftp') or ($service eq 'rsh')) {
+	if (($service =~ /ssh(|d)/) or ($service eq 'login') or ($service eq 'ftp') or ($service eq 'rsh')) {
 		if ($line =~ s/^session opened for user (.+) by \(uid=\d+\)/$1/) {
 			($Detail >= 5) && $data{$service}{'Sessions Opened'}{$line}++;
       } elsif ($line =~ s/^session opened for user ([^ ]*) by ([^ ]*)\(uid=\d+\)/$1 by $2/) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.