summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2018-02-25 12:18:40 -0500
committerAnthony G. Basile <blueness@gentoo.org>2018-02-25 12:19:01 -0500
commit839ee317aeb7166949a75c17997ada40fca2d74c (patch)
treea30a5dbfc3c9600b01a6a8a37ea6403894a36ecd /net-misc/ntpsec
parentapp-misc/vcp: Fix compiling against sys-libs/ncurses[tinfo] (bug #633744). (diff)
downloadgentoo-839ee317aeb7166949a75c17997ada40fca2d74c.tar.gz
gentoo-839ee317aeb7166949a75c17997ada40fca2d74c.tar.bz2
gentoo-839ee317aeb7166949a75c17997ada40fca2d74c.zip
net-misc/ntpsec: improve out-of-box configuration
Package-Manager: Portage-2.3.19, Repoman-2.3.6
Diffstat (limited to 'net-misc/ntpsec')
-rw-r--r--net-misc/ntpsec/files/ntp.conf21
-rw-r--r--net-misc/ntpsec/files/ntpd.confd5
-rw-r--r--net-misc/ntpsec/files/ntpd.rc-r2 (renamed from net-misc/ntpsec/files/ntpd.rc-r1)2
-rw-r--r--net-misc/ntpsec/ntpsec-1.0.0-r3.ebuild (renamed from net-misc/ntpsec/ntpsec-1.0.0-r2.ebuild)24
-rw-r--r--net-misc/ntpsec/ntpsec-9999.ebuild24
5 files changed, 51 insertions, 25 deletions
diff --git a/net-misc/ntpsec/files/ntp.conf b/net-misc/ntpsec/files/ntp.conf
new file mode 100644
index 000000000000..e8d68d2ba9bf
--- /dev/null
+++ b/net-misc/ntpsec/files/ntp.conf
@@ -0,0 +1,21 @@
+# This is a Gentoo specific configuration file so ntpsec
+# works out of the box as a client. Upstream configuration
+# can be found in /etc/ntp.d/, but these are not used by
+# this file. They are provided as a guide to more complex
+# configurations. For more information on how to configure
+# ntpsec see https://docs.ntpsec.org/latest/
+
+# Pools for Gentoo users
+pool 0.gentoo.pool.ntp.org
+pool 1.gentoo.pool.ntp.org
+pool 2.gentoo.pool.ntp.org
+pool 3.gentoo.pool.ntp.org
+
+# These are the restrictions most people want
+restrict default kod limited nomodify nopeer noquery
+restrict -6 default kod limited nomodify nopeer noquery
+restrict 127.0.0.1
+restrict -6 ::1
+
+# Don't change this location.
+driftfile /var/lib/ntp/ntp.drift
diff --git a/net-misc/ntpsec/files/ntpd.confd b/net-misc/ntpsec/files/ntpd.confd
index 92c553a62615..50c1aac60665 100644
--- a/net-misc/ntpsec/files/ntpd.confd
+++ b/net-misc/ntpsec/files/ntpd.confd
@@ -1,7 +1,4 @@
# /etc/conf.d/ntpd
-# Options to pass to the ntpd process
-# Most people should leave this line alone ...
-# however, if you know what you're doing, feel free to tweak
-#NTPD_OPTS="-g -n -u ntp:ntp"
+# Most people should leave this line alone.
NTPD_OPTS="-g -u ntp:ntp"
diff --git a/net-misc/ntpsec/files/ntpd.rc-r1 b/net-misc/ntpsec/files/ntpd.rc-r2
index dbe76c85e536..13fcbdd092d2 100644
--- a/net-misc/ntpsec/files/ntpd.rc-r1
+++ b/net-misc/ntpsec/files/ntpd.rc-r2
@@ -4,7 +4,7 @@
# $Id$
description="ntpd - the network time protocol daemon"
-pidfile="/var/run/ntpd.pid"
+pidfile="/run/ntpd.pid"
command="/usr/sbin/ntpd"
command_args="-p ${pidfile} ${NTPD_OPTS}"
start_stop_daemon_args="--pidfile ${pidfile}"
diff --git a/net-misc/ntpsec/ntpsec-1.0.0-r2.ebuild b/net-misc/ntpsec/ntpsec-1.0.0-r3.ebuild
index 46136f2fa0e3..ab3302255ec7 100644
--- a/net-misc/ntpsec/ntpsec-1.0.0-r2.ebuild
+++ b/net-misc/ntpsec/ntpsec-1.0.0-r3.ebuild
@@ -118,21 +118,25 @@ src_install() {
python_foreach_impl run_in_build_dir python_install
# Install heat generating scripts
- use heat && dosbin "${S}/contrib/ntpheat"{,usb}
+ use heat && dosbin "${S}"/contrib/ntpheat{,usb}
# Install the openrc files
- newinitd "${FILESDIR}/ntpd.rc-r1" "ntp"
- newconfd "${FILESDIR}/ntpd.confd" "ntp"
+ newinitd "${FILESDIR}"/ntpd.rc-r2 ntp
+ newconfd "${FILESDIR}"/ntpd.confd ntp
# Install the systemd unit file
- systemd_newunit "${FILESDIR}/ntpd.service" ntpd.service
+ systemd_newunit "${FILESDIR}"/ntpd.service ntpd.service
+
+ # Prepare a directory for the ntp.drift file
+ mkdir -pv "${ED}"/var/lib/ntp
+ chown ntp:ntp "${ED}"/var/lib/ntp
+ chmod 770 "${ED}"/var/lib/ntp
# Install a log rotate script
- mkdir -pv "${ED}/etc/"logrotate.d
- cp -v "${S}/etc/logrotate-config.ntpd" "${ED}/etc/logrotate.d/ntpd"
+ mkdir -pv "${ED}"/etc/logrotate.d
+ cp -v "${S}"/etc/logrotate-config.ntpd "${ED}"/etc/logrotate.d/ntpd
- # Install the configuration files
- cp -Rv "${S}/etc/ntp.d/" "${ED}/etc/"
- mv -v "${ED}/etc/ntp.d/default.conf" "${ED}/etc/ntp.conf"
- sed "s|includefile |includefile ntp.d/|" -i "${ED}/etc/ntp.conf"
+ # Install the configuration file and sample configuration
+ cp -v "${FILESDIR}"/ntp.conf "${ED}"/etc/ntp.conf
+ cp -Rv "${S}"/etc/ntp.d/ "${ED}"/etc/
}
diff --git a/net-misc/ntpsec/ntpsec-9999.ebuild b/net-misc/ntpsec/ntpsec-9999.ebuild
index 8263e59187fd..a565abf1c84d 100644
--- a/net-misc/ntpsec/ntpsec-9999.ebuild
+++ b/net-misc/ntpsec/ntpsec-9999.ebuild
@@ -117,21 +117,25 @@ src_install() {
python_foreach_impl run_in_build_dir python_install
# Install heat generating scripts
- use heat && dosbin "${S}/contrib/ntpheat"{,usb}
+ use heat && dosbin "${S}"/contrib/ntpheat{,usb}
# Install the openrc files
- newinitd "${FILESDIR}/ntpd.rc-r1" "ntp"
- newconfd "${FILESDIR}/ntpd.confd" "ntp"
+ newinitd "${FILESDIR}"/ntpd.rc-r2 ntp
+ newconfd "${FILESDIR}"/ntpd.confd ntp
# Install the systemd unit file
- systemd_newunit "${FILESDIR}/ntpd.service" ntpd.service
+ systemd_newunit "${FILESDIR}"/ntpd.service ntpd.service
+
+ # Prepare a directory for the ntp.drift file
+ mkdir -pv "${ED}"/var/lib/ntp
+ chown ntp:ntp "${ED}"/var/lib/ntp
+ chmod 770 "${ED}"/var/lib/ntp
# Install a log rotate script
- mkdir -pv "${ED}/etc/"logrotate.d
- cp -v "${S}/etc/logrotate-config.ntpd" "${ED}/etc/logrotate.d/ntpd"
+ mkdir -pv "${ED}"/etc/logrotate.d
+ cp -v "${S}"/etc/logrotate-config.ntpd "${ED}"/etc/logrotate.d/ntpd
- # Install the configuration files
- cp -Rv "${S}/etc/ntp.d/" "${ED}/etc/"
- mv -v "${ED}/etc/ntp.d/default.conf" "${ED}/etc/ntp.conf"
- sed "s|includefile |includefile ntp.d/|" -i "${ED}/etc/ntp.conf"
+ # Install the configuration file and sample configuration
+ cp -v "${FILESDIR}"/ntp.conf "${ED}"/etc/ntp.conf
+ cp -Rv "${S}"/etc/ntp.d/ "${ED}"/etc/
}