This file is indexed.

/etc/NetworkManager/dispatcher.d/20-chrony is in chrony 3.2-4ubuntu4.

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
#!/bin/sh
# This is a NetworkManager dispatcher / networkd-dispatcher script for
# chronyd to set its NTP sources online or offline when a network interface
# is configured or removed

export LC_ALL=C

# For NetworkManager consider only up/down events
[ $# -ge 2 ] && [ "$2" != "up" ] && [ "$2" != "down" ] && exit 0

# Note: for networkd-dispatcher routable.d ~= on and off.d ~= off

# Check if there is a default route

if /sbin/ip route list 2> /dev/null | grep -q '^default'; then
  chronyc online > /dev/null 2>&1
  exit 0
fi

sources=$(chronyc -c -n sources 2> /dev/null)

[ $? -ne 0 ] && exit 0

# Check each configured source if it has a route

echo "$sources" | while IFS=, read mode state address rest; do
  [ "$mode" != '^' ] && [ "$mode" != '=' ] && continue

  /sbin/ip route get "$address" > /dev/null 2>&1 && command="online" || command="offline"

  # Set priority of sources so that the selected source is set as
  # last if offline to avoid unnecessary reselection
  [ "$state" != '*' ] && priority=1 || priority=2

  echo "$priority $command $address"

done | sort | while read priority command address; do
  echo "$command $address"
done | chronyc > /dev/null 2>&1

exit 0