diff options
Diffstat (limited to 'source/n/ntp')
-rw-r--r-- | source/n/ntp/doinst.sh | 8 | ||||
-rwxr-xr-x | source/n/ntp/ntp.SlackBuild | 42 | ||||
-rw-r--r-- | source/n/ntp/ntp.conf | 32 | ||||
-rw-r--r-- | source/n/ntp/ntp.logrotate | 7 | ||||
-rw-r--r-- | source/n/ntp/rc.ntpd | 7 | ||||
-rw-r--r-- | source/n/ntp/slack-desc | 8 |
6 files changed, 70 insertions, 34 deletions
diff --git a/source/n/ntp/doinst.sh b/source/n/ntp/doinst.sh index bc5429909..3f1589bda 100644 --- a/source/n/ntp/doinst.sh +++ b/source/n/ntp/doinst.sh @@ -20,9 +20,7 @@ preserve_perms() { config ${NEW} } +config etc/logrotate.d/ntp.new config etc/ntp.conf.new -config etc/ntp/ntp.keys.new -if [ -r etc/rc.d/rc.ntpd -a -r etc/rc.d/rc.ntpd.new ]; then - chmod --reference=etc/rc.d/rc.ntpd etc/rc.d/rc.ntpd.new -fi -mv etc/rc.d/rc.ntpd.new etc/rc.d/rc.ntpd +config etc/ntp.keys.new +preserve_perms etc/rc.d/rc.ntpd.new diff --git a/source/n/ntp/ntp.SlackBuild b/source/n/ntp/ntp.SlackBuild index 21ca6248a..54798e5cb 100755 --- a/source/n/ntp/ntp.SlackBuild +++ b/source/n/ntp/ntp.SlackBuild @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash -# Copyright 2008, 2009, 2010, 2011, 2012, 2014, 2015 Patrick J. Volkerding, Sebeka, MN, USA +# Copyright 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -20,9 +20,11 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +cd $(dirname $0) ; CWD=$(pwd) + PKGNAM=ntp VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} -BUILD=${BUILD:-1} +BUILD=${BUILD:-3} # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then @@ -34,6 +36,14 @@ if [ -z "$ARCH" ]; then esac fi +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + NUMJOBS=${NUMJOBS:-" -j7 "} if [ "$ARCH" = "i586" ]; then @@ -46,7 +56,6 @@ else SLKCFLAGS="-O2" fi -CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/package-ntp @@ -80,12 +89,13 @@ CFLAGS="$SLKCFLAGS" \ --htmldir=/usr/doc/ntp-$VERSION \ --enable-ipv6 \ --with-crypto \ + --enable-ntp-signd \ --program-prefix= \ --program-suffix= \ - --build=$ARCH-slackware-linux + --build=$ARCH-slackware-linux || exit 1 make $NUMJOBS || make || exit 1 -make -i install DESTDIR=$PKG || exit 1 +make install DESTDIR=$PKG || exit 1 # Since the Makefile's install pays no heed to the --bindir settings, # we'll move things to where they've always been ourselves: @@ -98,11 +108,23 @@ rmdir $PKG/usr/lib/pkgconfig # This should be empty. Try to remove it, and error out if it's not actually empty: rmdir $PKG/usr/libexec || exit 1 -mkdir -p $PKG/etc/ntp +# Install default conf and keys files: +mkdir -p $PKG/etc cat $CWD/ntp.conf > $PKG/etc/ntp.conf.new -cat $CWD/ntp.keys > $PKG/etc/ntp/ntp.keys.new -chmod 600 $PKG/etc/ntp/ntp.keys.new -touch $PKG/etc/ntp/step-tickers +cat $CWD/ntp.keys > $PKG/etc/ntp.keys.new +chown root:ntp $PKG/etc/ntp.keys.new +chmod 640 $PKG/etc/ntp.keys.new + +# Location for the drift and stats files: +mkdir -p $PKG/var/lib/ntp +chown ntp:ntp $PKG/var/lib/ntp +chmod 0775 $PKG/var/lib/ntp + +# This is deprecated and no longer used by anything: +#touch $PKG/etc/ntp/step-tickers + +mkdir -p $PKG/etc/logrotate.d +cat $CWD/ntp.logrotate > $PKG/etc/logrotate.d/ntp.new mkdir -p $PKG/etc/rc.d cat $CWD/rc.ntpd > $PKG/etc/rc.d/rc.ntpd.new diff --git a/source/n/ntp/ntp.conf b/source/n/ntp/ntp.conf index 1844fb91c..e88603c12 100644 --- a/source/n/ntp/ntp.conf +++ b/source/n/ntp/ntp.conf @@ -1,4 +1,5 @@ # Sample /etc/ntp.conf: Configuration file for ntpd. + # # Undisciplined Local Clock. This is a fake driver intended for backup # and when no outside source of synchronized time is available. The @@ -22,12 +23,27 @@ fudge 127.127.1.0 stratum 10 #server 3.pool.ntp.org iburst # +# Full path of a directory where statistics files should be created +# +statsdir /var/lib/ntp/stats + +# +# Location of an alternate log file to be used instead of the default system syslog(3) facility +# +logfile /var/log/ntp + +# # Drift file. Put this in a directory which the daemon can write to. # No symbolic links allowed, either, since the daemon updates the file # by creating a temporary in the same directory and then rename()'ing # it to the file. # -driftfile /etc/ntp/drift +driftfile /var/lib/ntp/drift + +# +# Location of PID file +# +pidfile /var/run/ntpd.pid # # Uncomment to use a multicast NTP server on the local subnet: @@ -37,12 +53,13 @@ driftfile /etc/ntp/drift # # Keys file. If you want to diddle your server at run time, make a -# keys file (mode 600 for sure) and define the key number to be -# used for making requests. +# keys file (mode 640 owned by root:ntp) and define the key number to +# be used for making requests. # PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote # systems might be able to reset your clock at will. # -#keys /etc/ntp/keys +#keysdir /etc +#keys /etc/ntp.keys #trustedkey 65535 #requestkey 65535 #controlkey 65535 @@ -59,13 +76,6 @@ restrict -6 default limited kod nomodify notrap nopeer noquery #restrict -6 default limited kod nomodify notrap nopeer # -# Disable the ntpdc -c monlist command, which is insecure and can be used -# to cause a denial of service attack (CVE-2013-5211). Future versions of -# NTP will remove this command. -# (this feature was disabled by default with ntpd 4.2.7p230) -disable monitor - -# # Trust ourselves. :-) restrict 127.0.0.1 restrict ::1 diff --git a/source/n/ntp/ntp.logrotate b/source/n/ntp/ntp.logrotate new file mode 100644 index 000000000..6f2937a99 --- /dev/null +++ b/source/n/ntp/ntp.logrotate @@ -0,0 +1,7 @@ +/var/log/ntp { + notifempty + missingok + postrotate + [ -x /etc/rc.d/rc.ntpd ] && /etc/rc.d/rc.ntpd restart + endscript +} diff --git a/source/n/ntp/rc.ntpd b/source/n/ntp/rc.ntpd index 7cf3d50b0..d1ad44841 100644 --- a/source/n/ntp/rc.ntpd +++ b/source/n/ntp/rc.ntpd @@ -3,9 +3,8 @@ # Start ntpd: ntpd_start() { - CMDLINE="/usr/sbin/ntpd -g" - echo -n "Starting NTP daemon: $CMDLINE" - $CMDLINE -p /var/run/ntpd.pid + echo -n "Starting NTP daemon: /usr/sbin/ntpd -g -u ntp:ntp" + /usr/sbin/ntpd -g -u ntp:ntp echo } @@ -31,7 +30,7 @@ ntpd_restart() { # Check if ntpd is running ntpd_status() { if [ -e /var/run/ntpd.pid ]; then - echo "ntpd is running." + echo "ntpd is running as pid $(cat /var/run/ntpd.pid)." else echo "ntpd is stopped." exit 1 diff --git a/source/n/ntp/slack-desc b/source/n/ntp/slack-desc index 6319e8885..a0a931739 100644 --- a/source/n/ntp/slack-desc +++ b/source/n/ntp/slack-desc @@ -1,8 +1,8 @@ # HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line +# The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must -# make exactly 11 lines for the formatting to be correct. It's also +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. |-----handy-ruler------------------------------------------------------| @@ -16,4 +16,4 @@ ntp: of milliseconds on WANs relative to a primary server synchronized to ntp: Coordinated Universal Time (UTC) via a Global Positioning Service ntp: (GPS) receiver, for example. ntp: -ntp: +ntp: Homepage: http://www.ntp.org |