From 3be7bc912ab21dc6c37d45fbf14e9657d65e2a09 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Thu, 4 Dec 2025 12:34:19 +0000 Subject: [PATCH] Import from AlmaLinux stable repository --- SOURCES/sshd-sort-by-count.patch | 22 ++++++++++++++++++++++ SOURCES/zstd-log-support.patch | 31 +++++++++++++++++++++++++++++++ SPECS/logwatch.spec | 14 +++++++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 SOURCES/sshd-sort-by-count.patch create mode 100644 SOURCES/zstd-log-support.patch diff --git a/SOURCES/sshd-sort-by-count.patch b/SOURCES/sshd-sort-by-count.patch new file mode 100644 index 0000000..1a69b21 --- /dev/null +++ b/SOURCES/sshd-sort-by-count.patch @@ -0,0 +1,22 @@ +--- a/scripts/services/sshd 2021-01-22 21:59:40.000000000 +0100 ++++ b/scripts/services/sshd 2024-11-28 10:33:31.199069612 +0100 +@@ -515,7 +515,8 @@ + + if (keys %BadLogins) { + print "\nFailed logins from:\n"; +- foreach my $ip (sort SortIP keys %BadLogins) { ++ my $totalSort = TotalCountOrder(%BadLogins, \&SortIP); ++ foreach my $ip (sort $totalSort keys %BadLogins) { + my $name = LookupIP($ip); + my $totcount = 0; + foreach my $user (keys %{$BadLogins{$ip}}) { +@@ -538,7 +539,8 @@ + print " (with threshold >= $IllegalUsersThreshold)"; + } + print ":\n"; +- foreach my $ip (sort SortIP keys %IllegalUsers) { ++ my $totalSort = TotalCountOrder(%IllegalUsers, \&SortIP); ++ foreach my $ip (sort $totalSort keys %IllegalUsers) { + my $name = LookupIP($ip); + my $totcount = 0; + foreach my $user (keys %{$IllegalUsers{$ip}}) { diff --git a/SOURCES/zstd-log-support.patch b/SOURCES/zstd-log-support.patch new file mode 100644 index 0000000..116d56e --- /dev/null +++ b/SOURCES/zstd-log-support.patch @@ -0,0 +1,31 @@ +diff --color -urN a/scripts/logwatch.pl b/scripts/logwatch.pl +--- a/scripts/logwatch.pl 2025-07-15 12:47:54.869744800 +0200 ++++ b/scripts/logwatch.pl 2025-07-15 16:34:26.473278680 +0200 +@@ -96,6 +96,7 @@ + $Config{'pathtozcat'} = "zcat"; + $Config{'pathtobzcat'} = "bzcat"; + $Config{'pathtoxzcat'} = "xzcat"; ++$Config{'pathtozstdcat'} = "zstdcat"; + $Config{'output'} = "stdout"; #8.0 + $Config{'format'} = "text"; #8.0 + $Config{'encode'} = "none"; #8.0 +@@ -746,7 +747,7 @@ + + # Handle compressed log files using the archive codepath + foreach my $lf (@{$LogFileData{$LogFile}{'logfiles'}}) { +- if ($lf =~ /\.(?:gz|bz2|xz)$/) { ++ if ($lf =~ /\.(?:gz|bz2|xz|zst)$/) { + push @{$LogFileData{$LogFile}{'archives'}}, $lf; + } else { + push @FileList, $lf; +@@ -798,6 +799,10 @@ + my $arguments = "'${Archive}' 2>/dev/null >> $DestFile"; + system("$Config{'pathtoxzcat'} $arguments") == 0 + or die "system '$Config{'pathtoxzcat'} $arguments' failed: $?" ++ } elsif (($Archive =~ m/zst$/) && (-f "$Archive") && (-s "$Archive")) { ++ my $arguments = "'${Archive}' 2>/dev/null >> $DestFile"; ++ system("$Config{'pathtozstdcat'} $arguments") == 0 ++ or die "system '$Config{'pathtozstdcat'} $arguments' failed: $?" + } elsif ((-f "$Archive") && (-s "$Archive")) { + my $arguments = "'${Archive}' >> $DestFile"; + system("$Config{'pathtocat'} $arguments") == 0 diff --git a/SPECS/logwatch.spec b/SPECS/logwatch.spec index d059808..9423510 100644 --- a/SPECS/logwatch.spec +++ b/SPECS/logwatch.spec @@ -2,12 +2,14 @@ Summary: A log file analysis program Name: logwatch Version: 7.5.5 -Release: 6%{?dist} +Release: 8%{?dist} License: MIT URL: https://sourceforge.net/projects/logwatch Source0: logwatch-%{version}.tar.gz Patch0: cron.patch Patch1: systemd-deactivated.patch +Patch2: sshd-sort-by-count.patch +Patch3: zstd-log-support.patch #Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz BuildRequires: perl-generators Requires: grep @@ -35,6 +37,8 @@ of the package on many systems. %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build @@ -129,6 +133,14 @@ echo "# Configuration overrides for specific logfiles/services may be placed her %{_unitdir}/logwatch.timer %changelog +* Mon Aug 04 2025 Pavel Simovec +- Add support for zstd-compressed log files +- Resolves: RHEL-97021 + +* Thu Nov 28 2024 Pavel Simovec - 7.5.5-7 +- sshd: sort IP addresses reported by count +- Resolves: RHEL-69277 + * Fri Apr 14 2023 Pavel Šimovec - 7.5.5-6 - Add patch to fix systemd messages containing "Deactivated" - Resolves: rhbz:2160770