maybe chmod 0644 'default/networking'
maybe chmod 0644 'default/nss'
maybe chmod 0644 'default/ntp'
+maybe chmod 0644 'default/ntpdate'
maybe chmod 0644 'default/openvpn'
maybe chmod 0644 'default/psad'
maybe chmod 0644 'default/qemu-kvm'
maybe chmod 0755 'dhcp/dhclient-enter-hooks.d/resolved'
maybe chmod 0755 'dhcp/dhclient-exit-hooks.d'
maybe chmod 0644 'dhcp/dhclient-exit-hooks.d/ntp'
+maybe chmod 0644 'dhcp/dhclient-exit-hooks.d/ntpdate'
maybe chmod 0644 'dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes'
maybe chmod 0644 'dhcp/dhclient-exit-hooks.d/timesyncd'
maybe chmod 0755 'dhcp/dhclient-exit-hooks.d/zzz_avahi-autoipd'
maybe chmod 0755 'logcheck/ignore.d.server'
maybe chmod 0644 'logcheck/ignore.d.server/gpg-agent'
maybe chmod 0644 'logcheck/ignore.d.server/libsasl2-modules'
+maybe chmod 0644 'logcheck/ignore.d.server/ntpdate'
maybe chmod 0644 'logcheck/ignore.d.server/rkhunter'
maybe chmod 0644 'logcheck/ignore.d.server/rsyslog'
maybe chmod 0644 'login.defs'
maybe chmod 0755 'network/if-up.d/avahi-daemon'
maybe chmod 0755 'network/if-up.d/ethtool'
maybe chmod 0755 'network/if-up.d/ip'
+maybe chmod 0755 'network/if-up.d/ntpdate'
maybe chmod 0755 'network/if-up.d/openssh-server'
maybe chmod 0755 'network/if-up.d/openvpn'
maybe chmod 0755 'network/if-up.d/postfix'
--- /dev/null
+# The settings in this file are used by the program ntpdate-debian, but not
+# by the upstream program ntpdate.
+
+# Set to "yes" to take the server list from /etc/ntp.conf, from package ntp,
+# so you only have to keep it in one place.
+NTPDATE_USE_NTP_CONF=yes
+
+# List of NTP servers to use (Separate multiple servers with spaces.)
+# Not used if NTPDATE_USE_NTP_CONF is yes.
+NTPSERVERS="ntp.ubuntu.com"
+
+# Additional options to pass to ntpdate
+NTPOPTIONS=""
--- /dev/null
+NTPDATE_CONF=/etc/default/ntpdate
+NTPDATE_DHCP_CONF=/run/ntpdate.dhcp
+
+
+ntp_servers_setup_remove() {
+ rm -f $NTPDATE_DHCP_CONF
+}
+
+
+ntp_servers_setup_add() {
+ if [ -e $NTPDATE_DHCP_CONF ] && [ "$new_ntp_servers" = "$old_ntp_servers" ]; then
+ return
+ fi
+
+ if [ -z "$new_ntp_servers" ]; then
+ ntp_servers_setup_remove
+ return
+ fi
+
+ tmp=$(mktemp "$NTPDATE_DHCP_CONF.XXXXXX") || return
+ chmod --reference=$NTPDATE_CONF $tmp
+ chown --reference=$NTPDATE_CONF $tmp
+
+ (
+ echo "# NTP server entries received from DHCP server"
+ echo "NTPSERVERS='$new_ntp_servers'"
+ ) >>$tmp
+
+ mv $tmp $NTPDATE_DHCP_CONF
+}
+
+
+ntp_servers_setup() {
+ case $reason in
+ BOUND|RENEW|REBIND|REBOOT)
+ ntp_servers_setup_add
+ ;;
+ EXPIRE|FAIL|RELEASE|STOP)
+ ntp_servers_setup_remove
+ ;;
+ esac
+}
+
+
+ntp_servers_setup
--- /dev/null
+^\w{3} [ :0-9]{11} [._[:alnum:]-]+ ntpdate\[[0-9]+\]: (adjust|step) time server [0-9.]{7,15} offset -?[0-9.]+ sec$
--- /dev/null
+#!/bin/sh
+
+set -e
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+# This is a heuristic: The idea is that if a static interface is brought
+# up, that is a major event, and we can put in some extra effort to fix
+# the system time. Feel free to change this, especially if you regularly
+# bring up new network interfaces.
+if [ "$METHOD" = static ]; then
+ OPTS="-b"
+fi
+
+if [ "$METHOD" = loopback ] || [ "$METHOD" = none ]; then
+ exit 0
+fi
+
+# Check whether ntpdate was removed but not purged; it's useless to wait for
+# it in that case.
+if [ ! -x /usr/sbin/ntpdate-debian ] && [ -d /usr/sbin ]; then
+ exit 0
+fi
+
+(
+
+# This is for the case that /usr will be mounted later.
+if [ -r /lib/udev/hotplug.functions ]; then
+ . /lib/udev/hotplug.functions
+ wait_for_file /usr/sbin/ntpdate-debian
+fi
+
+# Avoid running more than one at a time
+flock -n /run/lock/ntpdate /usr/sbin/ntpdate-debian -s $OPTS 2>/dev/null || :
+
+) &