This file is indexed.

/usr/share/logwatch/scripts/services/xntpd is in logwatch 7.4.1-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!/usr/bin/perl

##########################################################################
# $Id: xntpd 228 2014-09-09 11:27:00Z stefjakobs $
##########################################################################

########################################################
# This was written and is maintained by:
#    David Baldwin <david.baldwin@anu.edu.au>
#
# Heavily based on sshd script
#
# Please send all comments, suggestions, bug reports,
#    etc, to david.baldwin@anu.edu.au.
########################################################

#######################################################
## Copyright (c) 2008 David Baldwin
## 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 an 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.
#########################################################

use strict;
use Logwatch ':all';

my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;

my $DebugCounter = 0;
my $Starts = 0;
my $Kills = 0;
my $SyncLost = 0;
my (@TimeReset,%Interfaces,%Syncs,%TwoInst,%Errors,%OtherList);
my %ConfErrs;
my %Operations;

# No sense in running if 'xntpd' doesn't even exist on this system...
unless (( -f "/usr/sbin/ntpd" ) or ( -f "/usr/local/sbin/ntpd") or ( -f "/usr/lib/inet/xntpd") or ( -f "/usr/lib/inet/ntpd" ) ) {
   if ( $Debug >= 5 ) {
      print STDERR "\n\nDEBUG: Exiting XNTPD Filter - no ntpd binary on system\n\n";
   }
   exit (0);
}

if ( $Debug >= 5 ) {
         print STDERR "\n\nDEBUG: Inside XNTPD Filter \n\n";
         $DebugCounter = 1;
}


while (defined(my $ThisLine = <STDIN>)) {
    if ( $Debug >= 5 ) {
       print STDERR "DEBUG($DebugCounter): $ThisLine";
       $DebugCounter++;
    }
    chomp($ThisLine);
    if (
        ($ThisLine =~ m/tickadj = /) or # startup
        ($ThisLine =~ m/precision = /) or # startup
        ($ThisLine =~ m/ (succeeded|failed)/) or # startup
        ($ThisLine =~ m/kernel time (discipline|sync) status/) or # startup
        ($ThisLine =~ m/kernel time sync (dis|en)abled /) or # startup
        ($ThisLine =~ m/frequency initialized/) or # startup
        ($ThisLine =~ m/using kernel phase-lock loop/) or # startup
        ($ThisLine =~ m/0\.0\.0\.0 [[:xdigit:]]{4} [[:xdigit:]]{2} /) or # startup
        ($ThisLine =~ m/select([^\)]) error: Interrupted system call/) or
        ($ThisLine =~ m/signal_no_reset: signal \d+ had flags \d+/) or
        ($ThisLine =~ /Deleting interface \#[0-9]+ [^,]*, [^,]*, interface stats: received=.*, sent=.*, dropped=.*, active_time=.* secs/) or
        ($ThisLine =~ /Invalid argument/) or
        ($ThisLine =~ /Listening on interface .* Disabled/) or
        ($ThisLine =~ /Listen and drop on /) or
        ($ThisLine =~ /Listening on routing socket on/) or
        ($ThisLine =~ /ntp_io: estimated max descriptors: \d*, initial socket boundary: \d*/) or
        ($ThisLine =~ /peers refreshed$/) or
        ($ThisLine =~ /restrict: error in address/) or
        ($ThisLine =~ /syntax error in .+ line \d+, column \d+$/)
    ) {
       # Ignore these
    } elsif ($ThisLine =~ m/ntpd [\d\-\.\w@]+ ... ... .. ..:..:.. /) {
      $Starts++;
    } elsif ($ThisLine =~ m/ntpd exiting on signal/) {
      $Kills++;
    } elsif ($ThisLine =~ m/synchronisation lost/) {
      $SyncLost++;
    } elsif ( my (undef,$TimeStep) = ($ThisLine =~ /time reset(| \(step\)) ([^ ]+) s$/ )) {
       push @TimeReset, $TimeStep;
    } elsif ( my (undef,$TimeStep) = ($ThisLine =~ /(step|adjust) time server [^ ]+ offset ([^ ]+) sec$/ )) {
       push @TimeReset, $TimeStep;
    } elsif ( my ($TimeStep) = ($ThisLine =~ /adjusting local clock by ([^ ]+)s$/ )) {
       # Jacob Joseph (12/8/06)
       push @TimeReset, $TimeStep;
    # MEv start no leadin to line
    } elsif ( my (undef,$TimeStep) = ($ThisLine =~ /(offset) ([^ ]+) sec/ )) {
       push @TimeReset, $TimeStep;
    # MEv end no leadin to line
    } elsif ( my ($ListenOn) = ($ThisLine =~ /Listening on interface (.*)(?: Enabled)?/ )) {
       $Interfaces{$ListenOn}++;
    } elsif ( my ($ListenOn) = ($ThisLine =~ /Listen normally on \d+ (.*)/ )) {
       $Interfaces{$ListenOn}++;
    } elsif ( my ($SyncTo,$Stratum) = ($ThisLine =~ /synchronized to ([^ ]+), stratum[ =]([^ ]+)/ )) {
       my $name = $SyncTo;
       if ($Detail > 5 && $SyncTo =~ m/^[\d.]+$/) {
           $name = LookupIP($SyncTo);
       }
       $name .= " stratum " . $Stratum;
       $Syncs{$name}++;
    } elsif ( my ($Host) = ($ThisLine =~ /two instances of default interface for ([^ ]+) in hash table$/ )) {
       if ($Debug >= 5) {
          print STDERR "DEBUG: Found -$1 two instances of default interface\n";
       }
       my $name = LookupIP($Host);
       $TwoInst{$name}++;
    } elsif ( my ($Error) = ($ThisLine =~ /(no server(s reachable| suitable for synchronization found))/ )) {
       $Errors{$Error}++;
    } elsif ( my ($Error) = ($ThisLine =~ /(can't find host \S+|no servers can be used, exiting)/ )) {
       $Errors{$Error}++;
    } elsif ( my ($Error) = ($ThisLine =~ /(sendto\(\S+\): Network is unreachable)/ )) {
       $Errors{$Error}++;
    } elsif ( my ($Error) = ($ThisLine =~ /(getaddrinfo: "\S+" invalid host address, ignored)/ )) {
       $Errors{$Error}++;
    } elsif ( my ($Error) = ($ThisLine =~ /(frequency error \d+ PPM exceeds tolerance \d+ PPM)/ )) {
       $Errors{$Error}++;
    } elsif ( my ($ConfErr) = ($ThisLine =~ /configure: (keyword "[^"]*" unknown, line ignored)/ )) {
       $ConfErrs{$ConfErr}++;
    } elsif ( my ($ConfErr) = ($ThisLine =~ /line \d+ column \d+ syntax error, (.+)$/ )) {
       $ConfErrs{$ConfErr}++;
    } elsif ( my ($StepTime) = ($ThisLine =~ /(.*:) Operation not permitted/) ) {
       $Operations{$StepTime}++
    } else {
       # Report any unmatched entries...
       $OtherList{$ThisLine} += 1;
    }
}

###########################################################

if ($Kills) {
    print "\nXNTPD Killed: " . $Kills . " Time(s)\n";
}
if ($Starts) {
    print "\nXNTPD Started: " . $Starts . " Time(s)\n";
}
if ($SyncLost) {
    print "\nSync lost: " . $SyncLost . " Time(s)\n";
}

if (@TimeReset > 0) {
    if ($Detail > 5) {
       print "\nTime Reset\n";
       print map "  time stepped $_\n",@TimeReset;
    }
    my $t = 0;
    $t += $_ foreach @TimeReset;
    printf "\nTime Reset ".(@TimeReset)." times (total: %.6f s  average: %.6f s)\n", $t, $t/(@TimeReset);
}

if (keys %Interfaces) {
    my $t = 0;
    my $lt = 0;
    print "\nListening on interfaces:\n" if ($Detail > 5);
    foreach my $i (keys %Interfaces) {
       print "  $i - $Interfaces{$i} times\n" if ($Detail > 5);
       unless ($i =~ m/^(wildcard|v[46]wildcard|lo)/) {
          $lt++;
       }
       $t++;
    }
    print "\nTotal interfaces: $t (non-local: $lt)\n";
}

if (keys %Syncs) {
    my $t = 0;
    my $ht = 0;
    print "\nSynchronized to:\n" if ($Detail > 5);
    foreach my $h (keys %Syncs) {
       $ht++;
       $t += $Syncs{$h};
       print "  $h - $Syncs{$h} times\n" if ($Detail > 5);
    }
    print "\nTotal synchronizations $t (hosts: $ht)\n";
}

if (keys %TwoInst) {
    print "\nTwo instances error\n";
    foreach my $h (keys %TwoInst) {
      print "  $h - $TwoInst{$h} times\n";
    }
}

if (keys %Errors) {
    print "\nErrors\n";
    print "  $_: $Errors{$_} time(s)\n" foreach sort keys %Errors;
}

if (keys %ConfErrs) {
    print "\nErrors in configuration file:\n";
    foreach my $k (keys %ConfErrs) {
      print "  $k ". $ConfErrs{$k} . " time(s)\n";
    }
}

if (keys %Operations) {
    print "\nOperations not permitted\n";
    foreach my $o (keys %Operations) {
      print "  $o ". $Operations{$o} . " time(s)\n";
    }
    print "\n  The clock on a VPS is inherited from the clock on the\n";
    print "  hardware node, therefore the ntp-service must be run on\n";
    print "  the hardware node, and not the VPS.\n";
}

if (keys %OtherList) {
    print "\n**Unmatched Entries**\n";
    print "  $_: $OtherList{$_} time(s)\n" foreach keys %OtherList;
}

exit(0);

# vi: shiftwidth=3 tabstop=3 syntax=perl et
# Local Variables:
# mode: perl
# perl-indent-level: 3
# indent-tabs-mode: nil
# End: