]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ipblocklist: Add neccessary files for logwatch.
authorTim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Tue, 21 Jun 2022 13:05:29 +0000 (15:05 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 7 Jul 2022 15:28:05 +0000 (17:28 +0200)
config/logwatch/ipblocklist [new file with mode: 0755]
config/logwatch/ipblocklist.conf [new file with mode: 0644]
config/rootfiles/common/logwatch
lfs/logwatch

diff --git a/config/logwatch/ipblocklist b/config/logwatch/ipblocklist
new file mode 100755 (executable)
index 0000000..8d00637
--- /dev/null
@@ -0,0 +1,91 @@
+###########################################################################
+# ipblocklist script for Logwatch
+# Analyzes the IPFire IP Blocklist log
+#
+#########################################################################
+
+########################################################
+## Copyright (c) 2008 Lars Skjærlund
+## Covered under the included MIT/X-Consortium License:
+##    http://www.opensource.org/licenses/mit-license.php
+## All modifications and contributions by other persons to
+## this script are assumed to have been donated to the
+## Logwatch project and thus assume the above copyright
+## and licensing terms.  If you want to make contributions
+## under your own copyright or a different license this
+## must be explicitly stated in the contribution and the
+## Logwatch project reserves the right to not accept such
+## contributions.  If you have made significant
+## contributions to this script and want to claim
+## copyright please contact logwatch-devel@lists.sourceforge.net.
+#########################################################
+
+#########################################################################
+# Files - all shown with default paths:
+#
+# /usr/share/logwatch/default.conf/logfiles/messages.conf
+# /usr/share/logwatch/dist.conf/services/blocklist.conf
+# /usr/share/logwatch/scripts/services/ipblocklist (this file)
+#
+# ... and of course
+#
+# /var/log/messages
+#########################################################################
+
+use Logwatch ':dates';
+
+my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};
+
+my $SearchDate;
+
+my %Updates;
+my %Errors;
+
+$SearchDate = TimeFilter("%b %e");
+
+while (defined(my $ThisLine = <STDIN>))
+{
+  next unless ($ThisLine =~ m/^\s*\w+\s+\w+\s+(..:..:..) .* ipblocklist: (.*)/);
+
+  my $text = $2;
+
+  if ($text =~ m/Successfully updated (\w+) blocklist/)
+  {
+    $Updates{$1}{updates}++;
+  }
+  elsif ($text !~ m/Skipping (\w+) blocklist - Too frequent update attempts!/   and
+         $text !~ m/Skipping (\w+) blocklist - It has not been modified!/ )
+  {
+    $Errors{$text}++;
+  }
+}
+
+#####################################################################
+
+if (keys %Updates)
+{
+   print "\nThe following block lists were updated:\n";
+   foreach my $Lists (sort keys %Updates)
+   {
+     print "   $Lists: $Updates{$Lists}{updates} Time(s)\n";
+   }
+}
+
+if (keys %Errors)
+{
+  print "\nThe following errors were detected:\n";
+
+  foreach my $Text (keys %Errors)
+  {
+    print "   $Text: $Errors{$Text} Time(s)\n";
+  }
+}
+
+exit(0);
+
+# vi: shiftwidth=3 tabstop=3 syntax=perl et
+# Local Variables:
+# mode: perl
+# perl-indent-level: 3
+# indent-tabs-mode: nil
+# End:
diff --git a/config/logwatch/ipblocklist.conf b/config/logwatch/ipblocklist.conf
new file mode 100644 (file)
index 0000000..a723da3
--- /dev/null
@@ -0,0 +1,34 @@
+#########################################################################
+# ids-update script for Logwatch
+# Analyzes the IPFire IP Blocklist update log
+#
+# Version: 1.0.0
+#    Initial release
+#
+#########################################################################
+
+#########################################################################
+# This script is subject to the same copyright as Logwatch itself
+#########################################################################
+
+#########################################################################
+# Files - all shown with default paths:
+#
+# /usr/share/logwatch/default.conf/logfiles/messages.conf
+# /usr/share/logwatch/dist.conf/services/blocklist.conf (this file)
+# /usr/share/logwatch/scripts/services/blocklist
+#
+# ... and of course
+#
+# /var/log/messages
+#########################################################################
+
+
+Title = "IP Blocklist"
+
+# Which logfile group...
+LogFile = messages
+
+*applystddate
+
+# vi: shiftwidth=3 tabstop=3 et
index 40d90cd96507323c66ca91ad006b64e39a5eb0b7..91e2d37b35a7fa28099af24cd5ba7b394c7ec47f 100644 (file)
@@ -195,6 +195,7 @@ usr/share/logwatch/default.conf/services/zz-sys.conf
 usr/share/logwatch/dist.conf/logfiles
 usr/share/logwatch/dist.conf/services
 usr/share/logwatch/dist.conf/services/dialup.conf
+usr/share/logwatch/dist.conf/services/ipblocklist.conf
 #usr/share/logwatch/lib
 usr/share/logwatch/lib/Logwatch.pm
 #usr/share/logwatch/scripts
@@ -260,6 +261,7 @@ usr/share/logwatch/scripts/services/http
 usr/share/logwatch/scripts/services/imapd
 #usr/share/logwatch/scripts/services/in.qpopper
 usr/share/logwatch/scripts/services/init
+usr/share/logwatch/scripts/services/ipblocklist
 usr/share/logwatch/scripts/services/ipop3d
 usr/share/logwatch/scripts/services/iptables
 usr/share/logwatch/scripts/services/kernel
index 8631f4541d58ceb4e366abb3b7d4bb66ae560fdf..5cd79843c2855cafeb404add8e799b66ab5462c6 100644 (file)
@@ -98,6 +98,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        cp -f $(DIR_SRC)/config/logwatch/dialup /usr/share/logwatch/scripts/services/dialup
        cp -f $(DIR_SRC)/config/logwatch/dialup.conf /usr/share/logwatch/dist.conf/services/dialup.conf
 
+       cp -f $(DIR_SRC)/config/logwatch/ipblocklist /usr/share/logwatch/scripts/services/ipblocklist
+       cp -f $(DIR_SRC)/config/logwatch/ipblocklist.conf /usr/share/logwatch/dist.conf/services/ipblocklist.conf
+
        -mkdir -p /var/cache/logwatch
        chmod -v 777 /var/cache/logwatch
        -mkdir -p /var/log/logwatch