aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ntp/ntpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ntp/ntpd')
-rw-r--r--usr.sbin/ntp/ntpd/Makefile59
-rw-r--r--usr.sbin/ntp/ntpd/Makefile.depend22
-rw-r--r--usr.sbin/ntp/ntpd/Makefile.depend.options5
-rw-r--r--usr.sbin/ntp/ntpd/leap-seconds120
-rw-r--r--usr.sbin/ntp/ntpd/ntp.conf114
5 files changed, 320 insertions, 0 deletions
diff --git a/usr.sbin/ntp/ntpd/Makefile b/usr.sbin/ntp/ntpd/Makefile
new file mode 100644
index 000000000000..33d3598f985f
--- /dev/null
+++ b/usr.sbin/ntp/ntpd/Makefile
@@ -0,0 +1,59 @@
+MAN=
+
+.include <src.opts.mk>
+
+.PATH: ${SRCTOP}/contrib/ntp/ntpd \
+ ${.OBJDIR}
+
+PACKAGE= ntp
+DIRS= ETC_NTP
+ETC_NTP= /etc/ntp
+ETC_NTP_MODE= 0700
+CONFS= ntp.conf
+FILES= leap-seconds
+FILESDIR= ETC_NTP
+FILESMODE= 644
+PROG= ntpd
+
+SRCS= cmd_args.c \
+ ntp_clockdev.c \
+ ntp_config.c ntp_control.c ntp_crypto.c ntp_filegen.c \
+ ntp_io.c ntp_leapsec.c ntp_loopfilter.c ntp_monitor.c ntp_parser.c \
+ ntp_peer.c ntp_proto.c ntp_refclock.c ntp_request.c ntp_restrict.c \
+ ntp_ppsdev.c \
+ ntp_scanner.c ntp_signd.c ntp_timer.c ntp_util.c ntpd-opts.c ntpd.c \
+ rc_cmdlength.c \
+ refclock_acts.c refclock_arbiter.c refclock_arc.c refclock_as2201.c \
+ refclock_atom.c refclock_bancomm.c refclock_chronolog.c \
+ refclock_chu.c refclock_conf.c refclock_datum.c refclock_dumbclock.c \
+ refclock_fg.c refclock_gpsdjson.c refclock_gpsvme.c refclock_heath.c \
+ refclock_hopfpci.c refclock_hopfser.c refclock_hpgps.c \
+ refclock_irig.c refclock_jjy.c refclock_jupiter.c refclock_leitch.c \
+ refclock_local.c refclock_nmea.c refclock_neoclock4x.c \
+ refclock_oncore.c refclock_palisade.c \
+ refclock_parse.c refclock_pcf.c refclock_pst.c refclock_ripencc.c \
+ refclock_shm.c refclock_tpro.c refclock_true.c refclock_tsyncpci.c \
+ refclock_tt560.c refclock_ulink.c refclock_wwv.c refclock_wwvb.c \
+ refclock_zyfer.c version.c
+
+CFLAGS+= -I${SRCTOP}/contrib/ntp/ntpd \
+ -I${SRCTOP}/contrib/ntp/include \
+ -I${SRCTOP}/contrib/ntp/libntp/lib/isc/include \
+ -I${SRCTOP}/contrib/ntp/libntp/lib/isc/pthreads/include \
+ -I${SRCTOP}/contrib/ntp/libntp/lib/isc/unix/include \
+ -I${SRCTOP}/contrib/ntp/sntp/libopts \
+ -I${.CURDIR:H} \
+ -I${.CURDIR}
+
+LIBADD= parse ntp m md opts pthread
+
+.if ${MK_OPENSSL} != "no"
+LIBADD+= crypto
+.endif
+
+CLEANFILES+= .version version.c
+
+version.c:
+ sh -e ${.CURDIR:H}/scripts/mkver ntpd
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/ntp/ntpd/Makefile.depend b/usr.sbin/ntp/ntpd/Makefile.depend
new file mode 100644
index 000000000000..c2747ffc19c6
--- /dev/null
+++ b/usr.sbin/ntp/ntpd/Makefile.depend
@@ -0,0 +1,22 @@
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ bin/sh.host \
+ include \
+ include/arpa \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+ lib/libthr \
+ lib/msun \
+ usr.sbin/ntp/libntp \
+ usr.sbin/ntp/libopts \
+ usr.sbin/ntp/libparse \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.sbin/ntp/ntpd/Makefile.depend.options b/usr.sbin/ntp/ntpd/Makefile.depend.options
new file mode 100644
index 000000000000..b374d7a1fd52
--- /dev/null
+++ b/usr.sbin/ntp/ntpd/Makefile.depend.options
@@ -0,0 +1,5 @@
+# This file is not autogenerated - take care!
+
+DIRDEPS_OPTIONS= OPENSSL
+
+.include <dirdeps-options.mk>
diff --git a/usr.sbin/ntp/ntpd/leap-seconds b/usr.sbin/ntp/ntpd/leap-seconds
new file mode 100644
index 000000000000..649a22c6278f
--- /dev/null
+++ b/usr.sbin/ntp/ntpd/leap-seconds
@@ -0,0 +1,120 @@
+# ATOMIC TIME
+# Coordinated Universal Time (UTC) is the reference time scale derived
+# from The "Temps Atomique International" (TAI) calculated by the Bureau
+# International des Poids et Mesures (BIPM) using a worldwide network of atomic
+# clocks. UTC differs from TAI by an integer number of seconds; it is the basis
+# of all activities in the world.
+#
+#
+# ASTRONOMICAL TIME (UT1) is the time scale based on the rate of rotation of the earth.
+# It is now mainly derived from Very Long Baseline Interferometry (VLBI). The various
+# irregular fluctuations progressively detected in the rotation rate of the Earth led
+# in 1972 to the replacement of UT1 by UTC as the reference time scale.
+#
+#
+# LEAP SECOND
+# Atomic clocks are more stable than the rate of the earth's rotation since the latter
+# undergoes a full range of geophysical perturbations at various time scales: lunisolar
+# and core-mantle torques, atmospheric and oceanic effects, etc.
+# Leap seconds are needed to keep the two time scales in agreement, i.e. UT1-UTC smaller
+# than 0.9 seconds. Therefore, when necessary a "leap second" is applied to UTC.
+# Since the adoption of this system in 1972 it has been necessary to add a number of seconds to UTC,
+# firstly due to the initial choice of the value of the second (1/86400 mean solar day of
+# the year 1820) and secondly to the general slowing down of the Earth's rotation. It is
+# theoretically possible to have a negative leap second (a second removed from UTC), but so far,
+# all leap seconds have been positive (a second has been added to UTC). Based on what we know about
+# the earth's rotation, it is unlikely that we will ever have a negative leap second.
+#
+#
+# HISTORY
+# The first leap second was added on June 30, 1972. Until the year 2000, it was necessary in average to add a
+# leap second at a rate of 1 to 2 years. Since the year 2000 leap seconds are introduced with an
+# average interval of 3 to 4 years due to the acceleration of the Earth's rotation speed.
+#
+#
+# RESPONSIBILITY OF THE DECISION TO INTRODUCE A LEAP SECOND IN UTC
+# The decision to introduce a leap second in UTC is the responsibility of the Earth Orientation Center of
+# the International Earth Rotation and reference System Service (IERS). This center is located at Paris
+# Observatory. According to international agreements, leap seconds should be scheduled only for certain dates:
+# first preference is given to the end of December and June, and second preference at the end of March
+# and September. Since the introduction of leap seconds in 1972, only dates in June and December were used.
+#
+# Questions or comments to:
+# Christian Bizouard: christian.bizouard@obspm.fr
+# Earth orientation Center of the IERS
+# Paris Observatory, France
+#
+#
+#
+# COPYRIGHT STATUS OF THIS FILE
+# This file is in the public domain.
+#
+#
+# VALIDITY OF THE FILE
+# It is important to express the validity of the file. These next two dates are
+# given in units of seconds since 1900.0.
+#
+# 1) Last update of the file.
+#
+# Updated through IERS Bulletin C (https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat)
+#
+# The following line shows the last update of this file in NTP timestamp:
+#
+#$ 3960835200
+#
+# 2) Expiration date of the file given on a semi-annual basis: last June or last December
+#
+# File expires on 28 June 2026
+#
+# Expire date in NTP timestamp:
+#
+#@ 3991593600
+#
+#
+# LIST OF LEAP SECONDS
+# NTP timestamp (X parameter) is the number of seconds since 1900.0
+#
+# MJD: The Modified Julian Day number. MJD = X/86400 + 15020
+#
+# DTAI: The difference DTAI= TAI-UTC in units of seconds
+# It is the quantity to add to UTC to get the time in TAI
+#
+# Day Month Year : epoch in clear
+#
+#NTP Time DTAI Day Month Year
+#
+2272060800 10 # 1 Jan 1972
+2287785600 11 # 1 Jul 1972
+2303683200 12 # 1 Jan 1973
+2335219200 13 # 1 Jan 1974
+2366755200 14 # 1 Jan 1975
+2398291200 15 # 1 Jan 1976
+2429913600 16 # 1 Jan 1977
+2461449600 17 # 1 Jan 1978
+2492985600 18 # 1 Jan 1979
+2524521600 19 # 1 Jan 1980
+2571782400 20 # 1 Jul 1981
+2603318400 21 # 1 Jul 1982
+2634854400 22 # 1 Jul 1983
+2698012800 23 # 1 Jul 1985
+2776982400 24 # 1 Jan 1988
+2840140800 25 # 1 Jan 1990
+2871676800 26 # 1 Jan 1991
+2918937600 27 # 1 Jul 1992
+2950473600 28 # 1 Jul 1993
+2982009600 29 # 1 Jul 1994
+3029443200 30 # 1 Jan 1996
+3076704000 31 # 1 Jul 1997
+3124137600 32 # 1 Jan 1999
+3345062400 33 # 1 Jan 2006
+3439756800 34 # 1 Jan 2009
+3550089600 35 # 1 Jul 2012
+3644697600 36 # 1 Jul 2015
+3692217600 37 # 1 Jan 2017
+#
+# A hash code has been generated to be able to verify the integrity
+# of this file. For more information about using this hash code,
+# please see the readme file in the 'source' directory :
+# https://hpiers.obspm.fr/iers/bul/bulc/ntp/sources/README
+#
+#h 49db2447 571e5e1b 2f002a53 9c8da8e4 39b8e49e
diff --git a/usr.sbin/ntp/ntpd/ntp.conf b/usr.sbin/ntp/ntpd/ntp.conf
new file mode 100644
index 000000000000..726729f30f93
--- /dev/null
+++ b/usr.sbin/ntp/ntpd/ntp.conf
@@ -0,0 +1,114 @@
+#
+#
+# Default NTP servers for the FreeBSD operating system.
+#
+# Don't forget to enable ntpd in /etc/rc.conf with:
+# ntpd_enable="YES"
+#
+# The driftfile is by default /var/db/ntpd.drift, check
+# /etc/defaults/rc.conf on how to change the location.
+#
+
+#
+# Set the target and limit for adding servers configured via pool statements
+# or discovered dynamically via mechanisms such as broadcast and manycast.
+# Ntpd automatically adds maxclock-1 servers from configured pools, and may
+# add as many as maxclock*2 if necessary to ensure that at least minclock
+# servers are providing good consistent time.
+#
+tos minclock 3 maxclock 6
+
+#
+# The following pool statements will give you a random set of IPv4 and IPv6
+# NTP servers geographically close to you. A single pool statement adds
+# multiple servers from the pool, according to the tos minclock/maxclock
+# targets.
+# See http://www.pool.ntp.org/ for details. Note, pool.ntp.org encourages
+# users with a static IP and good upstream NTP servers to add a server
+# to the pool. See http://www.pool.ntp.org/join.html if you are interested.
+#
+# The option `iburst' is used for faster initial synchronization.
+#
+pool 0.freebsd.pool.ntp.org iburst
+pool 2.freebsd.pool.ntp.org iburst
+
+#
+# If you want to pick yourself which country's public NTP server
+# you want to sync against, comment out the above pool statements,
+# uncomment the next ones, and replace CC with the country's abbreviation.
+# Make sure that the hostnames resolves to a proper IP address!
+#
+# pool 0.CC.pool.ntp.org iburst
+# pool 2.CC.pool.ntp.org iburst
+
+#
+# To configure a specific server, such as an organization-wide local
+# server, add lines similar to the following. One or more specific
+# servers can be configured in addition to, or instead of, any server
+# pools specified above. When both are configured, ntpd first adds all
+# the specific servers, then adds servers from the pool until the tos
+# minclock/maxclock targets are met.
+#
+#server time.my-internal.org iburst
+
+#
+# Security:
+#
+# By default, only allow time queries and block all other requests
+# from unauthenticated clients.
+#
+# The "restrict source" line allows peers to be mobilized when added by
+# ntpd from a pool, but does not enable mobilizing a new peer association
+# by other dynamic means (broadcast, manycast, ntpq commands, etc).
+#
+# See http://support.ntp.org/bin/view/Support/AccessRestrictions
+# for more information.
+#
+restrict default limited kod nomodify notrap noquery nopeer
+restrict source limited kod nomodify notrap noquery
+
+#
+# Alternatively, the following rules would block all unauthorized access.
+#
+#restrict default ignore
+#
+# In this case, all remote NTP time servers also need to be explicitly
+# allowed or they would not be able to exchange time information with
+# this server.
+#
+# Please note that this example doesn't work for the servers in
+# the pool.ntp.org domain since they return multiple A records.
+#
+#restrict 0.pool.ntp.org nomodify nopeer noquery notrap
+#restrict 1.pool.ntp.org nomodify nopeer noquery notrap
+#restrict 2.pool.ntp.org nomodify nopeer noquery notrap
+#
+# The following settings allow unrestricted access from the localhost
+restrict 127.0.0.1
+restrict ::1
+
+#
+# If a server loses sync with all upstream servers, NTP clients
+# no longer follow that server. The local clock can be configured
+# to provide a time source when this happens, but it should usually
+# be configured on just one server on a network. For more details see
+# http://support.ntp.org/bin/view/Support/UndisciplinedLocalClock
+# The use of Orphan Mode may be preferable.
+#
+#server 127.127.1.0
+#fudge 127.127.1.0 stratum 10
+
+# See http://support.ntp.org/bin/view/Support/ConfiguringNTP#Section_6.14.
+# for documentation regarding leapfile. Updates to the file can be obtained
+# from ftp://time.nist.gov/pub/ or ftp://tycho.usno.navy.mil/pub/ntp/.
+# Use either leapfile in /etc/ntp or periodically updated leapfile in /var/db.
+#leapfile "/etc/ntp/leap-seconds"
+leapfile "/var/db/ntpd.leap-seconds.list"
+
+# Specify the number of megabytes of memory that should be allocated and
+# locked. -1 (default) means "do not lock the process into memory".
+# 0 means "lock whatever memory the process wants into memory". Any other
+# number means to lock up to that number of megabytes into memory.
+# 0 may result in a segfault when ASLR with stack gap randomization
+# is enabled.
+#rlimit memlock 32