1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
5 ;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages ntp)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages linux)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages pkg-config)
30 #:use-module (gnu packages tls)
31 #:use-module (gnu packages libevent)
32 #:use-module ((guix licenses) #:prefix l:)
33 #:use-module (guix packages)
34 #:use-module (guix utils)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix build-system gnu)
38 #:use-module (srfi srfi-1))
47 (uri (list (string-append
48 "http://archive.ntp.org/ntp4/ntp-"
49 (version-major+minor version)
50 "/ntp-" version ".tar.gz")
52 "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-"
53 (version-major+minor version)
54 "/ntp-" version ".tar.gz")))
57 "13i7rp1va29ffjdk08fvsfl6n47zzwsp147zhgb550k8agvkjjpi"))
58 (modules '((guix build utils)))
61 ;; Remove the bundled copy of libevent, but we must keep
62 ;; sntp/libevent/build-aux since configure.ac contains
63 ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
64 (rename-file "sntp/libevent/build-aux"
65 "sntp/libevent:build-aux")
66 (delete-file-recursively "sntp/libevent")
67 (mkdir "sntp/libevent")
68 (rename-file "sntp/libevent:build-aux"
69 "sntp/libevent/build-aux")
71 (native-inputs `(("which" ,which)
72 ("pkg-config" ,pkg-config)))
74 `(("openssl" ,openssl)
75 ("libevent" ,libevent)
76 ;; Build with POSIX capabilities support on GNU/Linux. This allows 'ntpd'
77 ;; to run as non-root (when invoked with '-u'.)
78 ,@(if (string-suffix? "-linux"
79 (or (%current-target-system) (%current-system)))
84 (modify-phases %standard-phases
85 (add-after 'unpack 'disable-network-test
87 (substitute* "tests/libntp/Makefile.in"
88 (("test-decodenetnum\\$\\(EXEEXT\\) ") ""))
90 (build-system gnu-build-system)
91 (synopsis "Real time clock synchronization system")
92 (description "NTP is a system designed to synchronize the clocks of
93 computers over a network.")
95 "http://www.eecis.udel.edu/~mills/ntp/html/copyright.html"
96 "A non-copyleft free licence from the University of Delaware"))
97 (home-page "http://www.ntp.org")))
99 (define-public openntpd
106 "mirror://openbsd/OpenNTPD/" name "-" version ".tar.gz"))
109 "0fn12i4kzsi0zkr4qp3dp9bycmirnfapajqvdfx02zhr4hanj0kv"))))
110 (build-system gnu-build-system)
112 '(#:configure-flags '("--with-privsep-user=ntpd"
113 "--localstatedir=/var")
115 (modify-phases %standard-phases
116 (add-after 'unpack 'modify-install-locations
118 ;; Don't try to create /var/run or /var/db
119 (substitute* "src/Makefile.in"
120 (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR"))
123 `(("libressl" ,libressl))) ; enable TLS time constraints. See ntpd.conf(5).
124 (home-page "http://www.openntpd.org/")
125 (synopsis "NTP client and server by the OpenBSD Project")
126 (description "OpenNTPD is the OpenBSD Project's implementation of a client
127 and server for the Network Time Protocol. Its design goals include being
128 secure, easy to configure, and accurate enough for most purposes, so it's more
129 minimalist than ntpd.")
130 ;; A few of the source files are under bsd-3.
131 (license (list l:isc l:bsd-3))))
133 (define-public tlsdate
137 (home-page "https://github.com/ioerror/tlsdate")
141 (commit (string-append "tlsdate-" version))
145 "0w3v63qmbhpqlxjsvf4k3zp90k6mdzi8cdpgshan9iphy1f44xgl"))
146 (file-name (string-append name "-" version "-checkout"))))
147 (build-system gnu-build-system)
149 `(;; Disable seccomp when it's not supported--e.g., on aarch64. See
150 ;; 'src/seccomp.c' for the list of supported systems.
151 #:configure-flags ,(if (any (lambda (system)
153 (%current-target-system)
156 '("x86_64" "i686" "arm"))
158 ''("--disable-seccomp-filter"))
160 #:phases (modify-phases %standard-phases
161 (add-after 'unpack 'autogen
163 ;; The ancestor of 'SOURCE_DATE_EPOCH'; it contains the
164 ;; date that is recorded in binaries. It must be a
165 ;; "recent date" since it is used to detect bogus dates
166 ;; received from servers.
167 (setenv "COMPILE_DATE" (number->string 1530144000))
168 (invoke "sh" "autogen.sh"))))))
169 (inputs `(("openssl" ,openssl)
170 ("libevent" ,libevent)))
171 (native-inputs `(("pkg-config" ,pkg-config)
172 ("autoconf" ,autoconf)
173 ("automake" ,automake)
174 ("libtool" ,libtool)))
175 (synopsis "Extract remote time from TLS handshakes")
177 "@command{tlsdate} sets the local clock by securely connecting with TLS
178 to remote servers and extracting the remote time out of the secure handshake.
179 Unlike ntpdate, @command{tlsdate} uses TCP, for instance connecting to a
180 remote HTTPS or TLS enabled service, and provides some protection against
181 adversaries that try to feed you malicious time information.")