1 |
commit: 839ee317aeb7166949a75c17997ada40fca2d74c |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 25 17:18:40 2018 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 25 17:19:01 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=839ee317 |
7 |
|
8 |
net-misc/ntpsec: improve out-of-box configuration |
9 |
|
10 |
Package-Manager: Portage-2.3.19, Repoman-2.3.6 |
11 |
|
12 |
net-misc/ntpsec/files/ntp.conf | 21 +++++++++++++++++++ |
13 |
net-misc/ntpsec/files/ntpd.confd | 5 +---- |
14 |
net-misc/ntpsec/files/{ntpd.rc-r1 => ntpd.rc-r2} | 2 +- |
15 |
...psec-1.0.0-r2.ebuild => ntpsec-1.0.0-r3.ebuild} | 24 +++++++++++++--------- |
16 |
net-misc/ntpsec/ntpsec-9999.ebuild | 24 +++++++++++++--------- |
17 |
5 files changed, 51 insertions(+), 25 deletions(-) |
18 |
|
19 |
diff --git a/net-misc/ntpsec/files/ntp.conf b/net-misc/ntpsec/files/ntp.conf |
20 |
new file mode 100644 |
21 |
index 00000000000..e8d68d2ba9b |
22 |
--- /dev/null |
23 |
+++ b/net-misc/ntpsec/files/ntp.conf |
24 |
@@ -0,0 +1,21 @@ |
25 |
+# This is a Gentoo specific configuration file so ntpsec |
26 |
+# works out of the box as a client. Upstream configuration |
27 |
+# can be found in /etc/ntp.d/, but these are not used by |
28 |
+# this file. They are provided as a guide to more complex |
29 |
+# configurations. For more information on how to configure |
30 |
+# ntpsec see https://docs.ntpsec.org/latest/ |
31 |
+ |
32 |
+# Pools for Gentoo users |
33 |
+pool 0.gentoo.pool.ntp.org |
34 |
+pool 1.gentoo.pool.ntp.org |
35 |
+pool 2.gentoo.pool.ntp.org |
36 |
+pool 3.gentoo.pool.ntp.org |
37 |
+ |
38 |
+# These are the restrictions most people want |
39 |
+restrict default kod limited nomodify nopeer noquery |
40 |
+restrict -6 default kod limited nomodify nopeer noquery |
41 |
+restrict 127.0.0.1 |
42 |
+restrict -6 ::1 |
43 |
+ |
44 |
+# Don't change this location. |
45 |
+driftfile /var/lib/ntp/ntp.drift |
46 |
|
47 |
diff --git a/net-misc/ntpsec/files/ntpd.confd b/net-misc/ntpsec/files/ntpd.confd |
48 |
index 92c553a6261..50c1aac6066 100644 |
49 |
--- a/net-misc/ntpsec/files/ntpd.confd |
50 |
+++ b/net-misc/ntpsec/files/ntpd.confd |
51 |
@@ -1,7 +1,4 @@ |
52 |
# /etc/conf.d/ntpd |
53 |
|
54 |
-# Options to pass to the ntpd process |
55 |
-# Most people should leave this line alone ... |
56 |
-# however, if you know what you're doing, feel free to tweak |
57 |
-#NTPD_OPTS="-g -n -u ntp:ntp" |
58 |
+# Most people should leave this line alone. |
59 |
NTPD_OPTS="-g -u ntp:ntp" |
60 |
|
61 |
diff --git a/net-misc/ntpsec/files/ntpd.rc-r1 b/net-misc/ntpsec/files/ntpd.rc-r2 |
62 |
similarity index 94% |
63 |
rename from net-misc/ntpsec/files/ntpd.rc-r1 |
64 |
rename to net-misc/ntpsec/files/ntpd.rc-r2 |
65 |
index dbe76c85e53..13fcbdd092d 100644 |
66 |
--- a/net-misc/ntpsec/files/ntpd.rc-r1 |
67 |
+++ b/net-misc/ntpsec/files/ntpd.rc-r2 |
68 |
@@ -4,7 +4,7 @@ |
69 |
# $Id$ |
70 |
|
71 |
description="ntpd - the network time protocol daemon" |
72 |
-pidfile="/var/run/ntpd.pid" |
73 |
+pidfile="/run/ntpd.pid" |
74 |
command="/usr/sbin/ntpd" |
75 |
command_args="-p ${pidfile} ${NTPD_OPTS}" |
76 |
start_stop_daemon_args="--pidfile ${pidfile}" |
77 |
|
78 |
diff --git a/net-misc/ntpsec/ntpsec-1.0.0-r2.ebuild b/net-misc/ntpsec/ntpsec-1.0.0-r3.ebuild |
79 |
similarity index 83% |
80 |
rename from net-misc/ntpsec/ntpsec-1.0.0-r2.ebuild |
81 |
rename to net-misc/ntpsec/ntpsec-1.0.0-r3.ebuild |
82 |
index 46136f2fa0e..ab3302255ec 100644 |
83 |
--- a/net-misc/ntpsec/ntpsec-1.0.0-r2.ebuild |
84 |
+++ b/net-misc/ntpsec/ntpsec-1.0.0-r3.ebuild |
85 |
@@ -118,21 +118,25 @@ src_install() { |
86 |
python_foreach_impl run_in_build_dir python_install |
87 |
|
88 |
# Install heat generating scripts |
89 |
- use heat && dosbin "${S}/contrib/ntpheat"{,usb} |
90 |
+ use heat && dosbin "${S}"/contrib/ntpheat{,usb} |
91 |
|
92 |
# Install the openrc files |
93 |
- newinitd "${FILESDIR}/ntpd.rc-r1" "ntp" |
94 |
- newconfd "${FILESDIR}/ntpd.confd" "ntp" |
95 |
+ newinitd "${FILESDIR}"/ntpd.rc-r2 ntp |
96 |
+ newconfd "${FILESDIR}"/ntpd.confd ntp |
97 |
|
98 |
# Install the systemd unit file |
99 |
- systemd_newunit "${FILESDIR}/ntpd.service" ntpd.service |
100 |
+ systemd_newunit "${FILESDIR}"/ntpd.service ntpd.service |
101 |
+ |
102 |
+ # Prepare a directory for the ntp.drift file |
103 |
+ mkdir -pv "${ED}"/var/lib/ntp |
104 |
+ chown ntp:ntp "${ED}"/var/lib/ntp |
105 |
+ chmod 770 "${ED}"/var/lib/ntp |
106 |
|
107 |
# Install a log rotate script |
108 |
- mkdir -pv "${ED}/etc/"logrotate.d |
109 |
- cp -v "${S}/etc/logrotate-config.ntpd" "${ED}/etc/logrotate.d/ntpd" |
110 |
+ mkdir -pv "${ED}"/etc/logrotate.d |
111 |
+ cp -v "${S}"/etc/logrotate-config.ntpd "${ED}"/etc/logrotate.d/ntpd |
112 |
|
113 |
- # Install the configuration files |
114 |
- cp -Rv "${S}/etc/ntp.d/" "${ED}/etc/" |
115 |
- mv -v "${ED}/etc/ntp.d/default.conf" "${ED}/etc/ntp.conf" |
116 |
- sed "s|includefile |includefile ntp.d/|" -i "${ED}/etc/ntp.conf" |
117 |
+ # Install the configuration file and sample configuration |
118 |
+ cp -v "${FILESDIR}"/ntp.conf "${ED}"/etc/ntp.conf |
119 |
+ cp -Rv "${S}"/etc/ntp.d/ "${ED}"/etc/ |
120 |
} |
121 |
|
122 |
diff --git a/net-misc/ntpsec/ntpsec-9999.ebuild b/net-misc/ntpsec/ntpsec-9999.ebuild |
123 |
index 8263e59187f..a565abf1c84 100644 |
124 |
--- a/net-misc/ntpsec/ntpsec-9999.ebuild |
125 |
+++ b/net-misc/ntpsec/ntpsec-9999.ebuild |
126 |
@@ -117,21 +117,25 @@ src_install() { |
127 |
python_foreach_impl run_in_build_dir python_install |
128 |
|
129 |
# Install heat generating scripts |
130 |
- use heat && dosbin "${S}/contrib/ntpheat"{,usb} |
131 |
+ use heat && dosbin "${S}"/contrib/ntpheat{,usb} |
132 |
|
133 |
# Install the openrc files |
134 |
- newinitd "${FILESDIR}/ntpd.rc-r1" "ntp" |
135 |
- newconfd "${FILESDIR}/ntpd.confd" "ntp" |
136 |
+ newinitd "${FILESDIR}"/ntpd.rc-r2 ntp |
137 |
+ newconfd "${FILESDIR}"/ntpd.confd ntp |
138 |
|
139 |
# Install the systemd unit file |
140 |
- systemd_newunit "${FILESDIR}/ntpd.service" ntpd.service |
141 |
+ systemd_newunit "${FILESDIR}"/ntpd.service ntpd.service |
142 |
+ |
143 |
+ # Prepare a directory for the ntp.drift file |
144 |
+ mkdir -pv "${ED}"/var/lib/ntp |
145 |
+ chown ntp:ntp "${ED}"/var/lib/ntp |
146 |
+ chmod 770 "${ED}"/var/lib/ntp |
147 |
|
148 |
# Install a log rotate script |
149 |
- mkdir -pv "${ED}/etc/"logrotate.d |
150 |
- cp -v "${S}/etc/logrotate-config.ntpd" "${ED}/etc/logrotate.d/ntpd" |
151 |
+ mkdir -pv "${ED}"/etc/logrotate.d |
152 |
+ cp -v "${S}"/etc/logrotate-config.ntpd "${ED}"/etc/logrotate.d/ntpd |
153 |
|
154 |
- # Install the configuration files |
155 |
- cp -Rv "${S}/etc/ntp.d/" "${ED}/etc/" |
156 |
- mv -v "${ED}/etc/ntp.d/default.conf" "${ED}/etc/ntp.conf" |
157 |
- sed "s|includefile |includefile ntp.d/|" -i "${ED}/etc/ntp.conf" |
158 |
+ # Install the configuration file and sample configuration |
159 |
+ cp -v "${FILESDIR}"/ntp.conf "${ED}"/etc/ntp.conf |
160 |
+ cp -Rv "${S}"/etc/ntp.d/ "${ED}"/etc/ |
161 |
} |