Skip to content

Instantly share code, notes, and snippets.

@mdmower
Last active November 20, 2020 06:54
Show Gist options
  • Save mdmower/f1923a23bd6270792a2362f552a9c464 to your computer and use it in GitHub Desktop.
Save mdmower/f1923a23bd6270792a2362f552a9c464 to your computer and use it in GitHub Desktop.
Logwatch modifications to avoid Google Mail (GMail) spam detection
diff --git a/etc/logwatch/conf/services/sshd.conf b/etc/logwatch/conf/services/sshd.conf
new file mode 100644
index 0000000..a346169
--- /dev/null
+++ b/etc/logwatch/conf/services/sshd.conf
@@ -0,0 +1,2 @@
+# Set to No to disable IP lookups
+$sshd_ip_lookup = No
diff --git a/usr/share/logwatch/scripts/services/sshd b/etc/logwatch/scripts/services/sshd
index 4f02cc5..d4a3401 100755
--- a/usr/share/logwatch/scripts/services/sshd
+++ b/etc/logwatch/scripts/services/sshd
@@ -31,6 +31,7 @@ my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
my $IgnoreHost = $ENV{'sshd_ignore_host'} || "";
my $RefusedConnectionsThreshold = $ENV{'refused_connections_threshold'} || 0;
+$main::DoLookup = $ENV{'sshd_ip_lookup'};
my $DebugCounter = 0;
# No sense in running if 'sshd' doesn't even exist on this system...
@@ -482,7 +483,7 @@ if (keys %NegotiationFailed) {
}
$Total += $HostTotal;
if ( $Detail > 0 ) {
- print " $Host: " . timesplural($HostTotal);
+ print " $Host : " . timesplural($HostTotal);
}
if ( $Detail > 5 ) {
foreach my $Offer (sort {$a cmp $b} keys %{$NegotiationFailed{$Reason}{$Host}}) {
@@ -531,7 +532,7 @@ if (keys %IllegalUsers) {
foreach my $user (keys %{$IllegalUsers{$ip}}) {
$totcount += $IllegalUsers{$ip}{$user};
}
- print " $name: " . timesplural($totcount);
+ print " $name : " . timesplural($totcount);
if ($Detail >= 5) {
my $sort = CountOrder(%{$IllegalUsers{$ip}});
foreach my $user (sort $sort keys %{$IllegalUsers{$ip}}) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment