Skip to contentSkip to conversation

package/ntpsec: new package

PATCH In review Peter Seiderer 2 participants 2 messages Dec 31, 2021 – Jul 23, 2022 Arm MediaTek

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/ntpsec: new package

- set 'CC="$(HOSTCC)"' to avoid cross-compile failure (see [1]):

/bin/sh: line 1: .../build/ntpsec-1_2_0/build/host/ntpd/keyword-gen: cannot execute binary file: Exec format error

Waf: Leaving directory `.../build/ntpsec-1_2_0/build/host'
Build failed
-> task in 'ntp_keyword.h' failed with exit status 126 (run with -v to display more information)

- set '-std=gnu99"' to avoid compile failure with old compilers

- explicit set PYTHON_CONFIG

- add patch 001-ntptime-fix-jfmt5-ofmt5-jfmt6-ofmt6-related-compile-.patch to fix ntptime jfmt5/ofmt5 jfmt6/ofmt6 related compile failure

- add patch 0002-wscript-remove-checks-for-bsd-string.h-fixes-host-co.patch to fix host-compile failure in case target libbsd is detected

- add SYSV init file (S49ntp)

- add example ntpd.conf (with legacy option enabled and provide skeleton for NTS configuration)

- add config option for NTS support

- depend on python3 (omit python2 to reduce test effort)

- add ntp user/group and run ntpd as restricted user

- add libcap dependency (compile time optional but needed for droproot support)

[1] https://gitlab.com/NTPsec/ntpsec/-/issues/694

---
Changes v2 -> v3:
- update 0001-ntptime-fix-jfmt5-ofmt5-jfmt6-ofmt6-related-compile-.patch
- add 0002-wscript-remove-checks-for-bsd-string.h-fixes-host-co.patch

Changes v1 -> v2:
- update version to 1.2.1, note version 1.2.1 is tagged ([2], [3]) and

    downloadable but not listed as release ([4]), for changelog see [5],
    (suggested by Guillaume)

    [2] https://gitlab.com/NTPsec/ntpsec/-/tags
    [3] https://gitlab.com/NTPsec/ntpsec/-/commit/3c41d31e11a67ff17f303a4133ae0f867bc3ce26
    [4] https://gitlab.com/NTPsec/ntpsec/-/releases
    [5] https://gitlab.com/NTPsec/ntpsec/-/blob/master/NEWS.adoc

- improve python3 only usage (omit python2/python3 select code)
- use CC="$(HOSTCC)" (suggested by Guillaume)
- drop link to libntpc.so, use --libdir instead (suggested by Guillaume)
- drop commented out '--enable-nts' code

---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 ...5-ofmt5-jfmt6-ofmt6-related-compile-.patch | 90 +++++++++++++++++++
 ...hecks-for-bsd-string.h-fixes-host-co.patch | 73 +++++++++++++++
 package/ntpsec/Config.in                      | 31 +++++++
 package/ntpsec/S49ntp                         | 58 ++++++++++++
 package/ntpsec/ntpd.etc.conf                  | 33 +++++++
 package/ntpsec/ntpsec.hash                    |  4 +
 package/ntpsec/ntpsec.mk                      | 65 ++++++++++++++
 9 files changed, 356 insertions(+)
 create mode 100644 package/ntpsec/0001-ntptime-fix-jfmt5-ofmt5-jfmt6-ofmt6-related-compile-.patch
 create mode 100644 package/ntpsec/0002-wscript-remove-checks-for-bsd-string.h-fixes-host-co.patch
 create mode 100644 package/ntpsec/Config.in
 create mode 100644 package/ntpsec/S49ntp
 create mode 100644 package/ntpsec/ntpd.etc.conf
 create mode 100644 package/ntpsec/ntpsec.hash
 create mode 100644 package/ntpsec/ntpsec.mk
DEVELOPERS +1 -0
index 78e41b7d7c..9f788925a8 100644
@@ -2222,6 +2222,7 @@ F:	package/iwd/
 F:	package/libevdev/
 F:	package/libuev/
 F:	package/log4cplus/
+F:	package/ntpsec/
 F:	package/postgresql/
 F:	package/python-colorzero/
 F:	package/python-flask-wtf/
package/Config.in +1 -0
index ce12e5f3c5..9c23828070 100644
@@ -2287,6 +2287,7 @@ endif
 	source "package/nmap/Config.in"
 	source "package/noip/Config.in"
 	source "package/ntp/Config.in"
+	source "package/ntpsec/Config.in"
 	source "package/nuttcp/Config.in"
 	source "package/odhcp6c/Config.in"
 	source "package/odhcploc/Config.in"
package/ntpsec/0001-ntptime-fix-jfmt5-ofmt5-jfmt6-ofmt6-related-compile-.patch new file +90 -0

90 lines not on this page · raw message

package/ntpsec/0002-wscript-remove-checks-for-bsd-string.h-fixes-host-co.patch new file +73 -0

73 lines not on this page · raw message

package/ntpsec/Config.in new file +31 -0
new file mode 100644
index 0000000000..7275533d26
@@ -0,0 +1,31 @@
+config BR2_PACKAGE_NTPSEC
+	bool "ntpsec"
+	depends on BR2_PACKAGE_PYTHON3
+	select BR2_PACKAGE_LIBCAP
+	select BR2_PACKAGE_OPENSSL
+	help
+	  NTPsec project - a secure, hardened, and improved
+	  implementation of Network Time Protocol derived
+	  from NTP Classic, Dave Mills’s original.
+
+	  Provides things like ntpd, ntpdate, ntpq, etc...
+
+	  https://www.ntpsec.org/
+
+if BR2_PACKAGE_NTPSEC
+
+config BR2_PACKAGE_NTPSEC_CLASSIC_MODE
+	bool "classic-mode"
+	help
+	  Enable strict configuration and log-format compatibility
+	  with NTP Classic.
+
+config BR2_PACKAGE_NTPSEC_NTS
+	bool "NTS support"
+	help
+	  Enable Network Time Security (NTS) support.
+
+endif
+
+comment "ntpsec depens on Pyhton3"
+	depends on !BR2_PACKAGE_PYTHON3
package/ntpsec/S49ntp new file +58 -0

58 lines not on this page · raw message

package/ntpsec/ntpd.etc.conf new file +33 -0
new file mode 100644
index 0000000000..e0f45c1438
@@ -0,0 +1,33 @@
+#
+# legacy NTP configuration
+#
+pool 0.pool.ntp.org iburst
+pool 1.pool.ntp.org iburst
+pool 2.pool.ntp.org iburst
+pool 3.pool.ntp.org iburst
+
+#
+# NTS configuration
+#
+# Notes:
+#  - uncomment the following lines to enable NTS support (but
+#    make sure the initial clock is up-to-date (otherwise the
+#    NTS certificate validation will fail with 'NTSc: certificate invalid:
+#    9=>certificate is not yet valid' as on boards without RTC support)
+#    and/or keep at least one line from the legacy NTP lines
+#  - enable BR2_PACKAGE_CA_CERTIFICATES to gain access to the certificate
+#    files
+#
+# server time.cloudflare.com nts  # Global, anycast
+# server nts.ntp.se:4443 nts      # Sweden
+# server ntpmon.dcs1.biz nts      # Singapore
+# server ntp1.glypnod.com nts     # San Francisco
+# server ntp2.glypnod.com nts     # London
+#
+# ca /usr/share/ca-certificates/mozilla
+
+# Allow only time queries, at a limited rate, sending KoD when in excess.
+# Allow all local queries (IPv4, IPv6)
+restrict default nomodify nopeer noquery limited kod
+restrict 127.0.0.1
+restrict [::1]
package/ntpsec/ntpsec.hash new file +4 -0
new file mode 100644
index 0000000000..49dc4e4d52
@@ -0,0 +1,4 @@
+# Locally calculated
+sha256  71c9f4bde6953bbc048bbaf278da81c451a56cc08d6772542b4ad37c67d72e89  ntpsec-NTPsec_1_2_1.tar.bz2
+sha256  b4db4de3317c3b0554ed91eb692968800bdfd6ad2c16ffbeee8ce4895ed91da4  LICENSE.adoc
+sha256  d3b21470adadd9abd9c6d675378f8c371ac5a4ea6dbec91859e02fadca3c0856  docs/copyright.adoc
package/ntpsec/ntpsec.mk new file +65 -0

65 lines not on this page · raw message

Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Peter,

Quoted 32 lines · On Fri, 31 Dec 2021 09:49:23 +0100 Peter Seiderer <[email protected]> wrote:

- set 'CC="$(HOSTCC)"' to avoid cross-compile failure (see [1]):

/bin/sh: line 1: .../build/ntpsec-1_2_0/build/host/ntpd/keyword-gen: cannot execute binary file: Exec format error

Waf: Leaving directory `.../build/ntpsec-1_2_0/build/host'
Build failed
-> task in 'ntp_keyword.h' failed with exit status 126 (run with -v to display more information)

- set '-std=gnu99"' to avoid compile failure with old compilers

- explicit set PYTHON_CONFIG

- add patch 001-ntptime-fix-jfmt5-ofmt5-jfmt6-ofmt6-related-compile-.patch to fix ntptime jfmt5/ofmt5 jfmt6/ofmt6 related compile failure

- add patch 0002-wscript-remove-checks-for-bsd-string.h-fixes-host-co.patch to fix host-compile failure in case target libbsd is detected

- add SYSV init file (S49ntp)

- add example ntpd.conf (with legacy option enabled and provide skeleton for NTS configuration)

- add config option for NTS support

- depend on python3 (omit python2 to reduce test effort)

- add ntp user/group and run ntpd as restricted user

- add libcap dependency (compile time optional but needed for droproot support)

Quoted 7 lines

[1] https://gitlab.com/NTPsec/ntpsec/-/issues/694

---
Changes v2 -> v3:
- update 0001-ntptime-fix-jfmt5-ofmt5-jfmt6-ofmt6-related-compile-.patch
- add 0002-wscript-remove-checks-for-bsd-string.h-fixes-host-co.patch

I've finally applied to master. Changes done:

- S49ntp was renamed to S49ntpd, because check-package wants the init script to be named after the daemon that it starts

- the LICENSE variable is comma separated, not space-separated

- the depends on BR2_PACKAGE_PYTHON3 has been replaced by select BR2_PACKAGE_PYTHON3, as we now only support python3

Speaking of the need for python on the target, I found it a bit silly, because the daemon itself is written in C. So I filled an issue upstream yesterday: https://gitlab.com/NTPsec/ntpsec/-/issues/743, and they are already working on it, with an initial proposal at
https://gitlab.com/NTPsec/ntpsec/-/merge_requests/1282. It will be useful to follow this issue and see if we can lift the python3 requirement on the target.

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot