diff --git a/README.md b/README.md index 1a2d91a..acde4e0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # ntp-server +The Network Time Protocol (NTP) is used to synchronize a computer's time with another reference time source. +The ntp package contains utilities and daemons which will synchronize your computer's time to Coordinated Universal Time (UTC) via the NTP protocol and NTP servers. +Ntp includes ntpdate (a program for retrieving the date and time from remote machines via a network) and ntpd (a daemon which continuously adjusts system time). + +Install the ntp package if you need tools for keeping your system's time synchronized via the NTP protocol. + diff --git a/ntp-4.2.6-nano.patch b/ntp-4.2.6-nano.patch new file mode 100644 index 0000000..37a422b --- /dev/null +++ b/ntp-4.2.6-nano.patch @@ -0,0 +1,17 @@ +--- include/ntp_syscall.h.orig 2009-05-19 16:44:55.048156467 -0400 ++++ include/ntp_syscall.h 2009-05-19 16:46:19.293323686 -0400 +@@ -14,6 +14,14 @@ + # include + #endif + ++#if defined(ADJ_NANO) && !defined(MOD_NANO) ++#define MOD_NANO ADJ_NANO ++#endif ++ ++#if defined(ADJ_TAI) && !defined(MOD_TAI) ++#define MOD_TAI ADJ_TAI ++#endif ++ + #ifndef NTP_SYSCALLS_LIBC + #ifdef NTP_SYSCALLS_STD + # define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) diff --git a/ntp-server.spec b/ntp-server.spec new file mode 100644 index 0000000..4a69d5d --- /dev/null +++ b/ntp-server.spec @@ -0,0 +1,200 @@ +Name: ntp-server +Version: 4.2.6p5 +Release: 1mamba +Summary: Synchronizes system time using the Network Time Protocol (NTP) +Group: System/Configuration +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.ntp.org +Source0: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-%{version}.tar.gz +Source1: ntp.conf +Source2: ntp.keys +Source3: ntpd.rc +Source5: ntpservers +Patch0: ntp-4.2.6-nano.patch +License: BSD +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libbeecrypt-devel +BuildRequires: libbzip2-devel +BuildRequires: libcap-devel +BuildRequires: libe2fs-devel +BuildRequires: libelf-devel +BuildRequires: libexpat-devel +BuildRequires: libkrb5-devel +%if "%{stage1}" != "1" +BuildRequires: libnetsnmp-devel +BuildRequires: libnl-devel +BuildRequires: rpm +BuildRequires: libpopt-devel +BuildRequires: libproxy-devel +BuildRequires: libneon-devel +%endif +BuildRequires: libopenssl-devel +BuildRequires: libselinux-devel +BuildRequires: libstdc++6-devel +BuildRequires: libz-devel +BuildRequires: perl-devel +## AUTOBUILDREQ-END +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +The Network Time Protocol (NTP) is used to synchronize a computer's time with another reference time source. +The ntp package contains utilities and daemons which will synchronize your computer's time to Coordinated Universal Time (UTC) via the NTP protocol and NTP servers. +Ntp includes ntpdate (a program for retrieving the date and time from remote machines via a network) and ntpd (a daemon which continuously adjusts system time). + +Install the ntp package if you need tools for keeping your system's time synchronized via the NTP protocol. + +%prep +%setup -q -n ntp-%{version} +%patch0 -p0 + +%build +%configure \ + --bindir=%{_sbindir} \ + --with-binsubdir=sbin \ + --with-openssl-libdir=%{_libdir} \ + --enable-all-clocks \ + --enable-parse-clocks \ + --enable-linuxcaps \ + --enable-ipv6 + +%make \ +%if "%{_host}" != "%{_build}" + LDFLAGS="-lcap -lcrypt -lattr" +%endif + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +install -D -m644 %{S:1} %{buildroot}%{_sysconfdir}/ntp.conf +install -D -m600 %{S:2} %{buildroot}%{_sysconfdir}/ntp/keys +install -D -m755 %{S:3} %{buildroot}%{_initrddir}/ntpd +install -D -m644 %{S:5} %{buildroot}%{_sysconfdir}/ntp/ntpservers + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post +if [ $1 -eq 1 ]; then + /sbin/chkconfig --add ntpd +fi +exit 0 + +%preun +if [ $1 -eq 0 ]; then +# uninstall + service ntpd stop + /sbin/chkconfig --del ntpd +fi +exit 0 + +%postun +if [ $1 -eq 1 ]; then +#update + service ntpd condrestart +fi +exit 0 + +%files +%defattr(-,root,root) +%{_sbindir}/ntp-keygen +%{_sbindir}/ntp-wait +%{_sbindir}/ntpdate +%{_sbindir}/ntpd +%{_sbindir}/ntpdc +%{_sbindir}/ntpq +%if "%{stage1}" != "1" +%{_sbindir}/ntpsnmpd +%endif +%{_sbindir}/ntptime +%{_sbindir}/ntptrace +%{_sbindir}/sntp +%{_sbindir}/tickadj +%config(noreplace) %{_sysconfdir}/ntp.conf +%config(noreplace) %{_sysconfdir}/ntp/keys +%config %{_sysconfdir}/ntp/ntpservers +%{_initrddir}/ntpd +%{_mandir}/man1/ntp-keygen.* +%{_mandir}/man1/ntpd.* +%{_mandir}/man1/ntpdc.* +%{_mandir}/man1/ntpsnmpd.* +%{_mandir}/man1/ntpq.* +%{_mandir}/man1/sntp.* +%doc ChangeLog COPYRIGHT NEWS *.y2kfixes README* TODO WHERE-TO-START + +%changelog +* Thu Jun 14 2012 Automatic Build System 4.2.6p5-1mamba +- automatic version update by autodist + +* Mon Sep 26 2011 Automatic Build System 4.2.6p4-1mamba +- automatic version update by autodist + +* Tue Jan 04 2011 Automatic Build System 4.2.6p3-1mamba +- automatic update by autodist + +* Fri Oct 22 2010 Silvan Calarco 4.2.6p2-3mamba +- also source renamed to ntp-server + +* Fri Oct 15 2010 Silvan Calarco 4.2.6p2-2mamba +- renamed to ntp-server to leave place to chrony on client installations + +* Mon Aug 09 2010 Automatic Build System 4.2.6p2-1mamba +- automatic update by autodist +- initscript: use ntpserver file instead fo step-tickers; start later (99) +- /etc/ntp/ntpserver: updated server list with *.pool.ntp.org and names replaced with IP's +- /etc/ntp/step-tickers: file removed + +* Wed Feb 17 2010 Silvan Calarco 4.2.6-2mamba +- fixed multicast and authentication configuration keys in ntp.conf to work with recent version + +* Sun Jan 10 2010 Silvan Calarco 4.2.6-1mamba +- update to 4.2.6 +- initscript: stard ntpd with -g option to enable big adjustment on first check + +* Fri May 29 2009 Automatic Build System 4.2.4p7-1mamba +- automatic update by autodist + +* Sun Mar 15 2009 Silvan Calarco 4.2.4p6-1mamba +- automatic update by autodist + +* Wed Dec 10 2008 Silvan Calarco 4.2.4p5-1mamba +- update to 4.2.4p5 + +* Fri Aug 31 2007 Aleph0 4.2.4p3-1mamba +- update to 4.2.4p3 +- fix action stop in the initscript + +* Tue Oct 31 2006 Stefano Cotta Ramusino 4.2.2p4-1qilnx +- update to version 4.2.2p4 by autospec + +* Fri Oct 13 2006 Davide Madrisan 4.2.2p3-2qilnx +- update to version 4.2.2p3 by autospec +- dropped patch against CAN-2005-2496 (merged upstream) + +* Wed Sep 07 2005 Davide Madrisan 4.2.0a-1qilnx +- update to version 4.2.0a-20050816 +- security fix QSA-2005-102 (CAN-2005-2496) + +* Tue Feb 08 2005 Silvan Calarco 4.2.0-3qilnx +- chkconfig of service on first install + +* Tue Nov 30 2004 Silvan Calarco 4.2.0-2qilnx +- fixed default configuration of ntp.conf to include /etc/ntp/ntpservers + +* Tue Feb 24 2004 Davide Madrisan 4.2.0-1qilnx +- new version rebuild + +* Mon Sep 09 2003 Davide Madrisan 4.1.1-3qilnx +- fixed the date localization problem in /etc/init.d/ntpd + +* Wed Jun 25 2003 Silvan Calarco 4.1.1-2qilnx +- changed initscript to support hardware clock synconization + +* Wed Jun 25 2003 Silvan Calarco 4.1.1-1qilnx +- fixed sysconfdir information + +* Fri Apr 18 2003 Mirko Cortillaro +- write a spec file for ntp diff --git a/ntp.conf b/ntp.conf new file mode 100644 index 0000000..30401ba --- /dev/null +++ b/ntp.conf @@ -0,0 +1,49 @@ + +# +# Undisciplined Local Clock. This is a fake driver intended for backup +# and when no outside source of synchronized time is available. The +# default stratum is usually 3, but in this case we elect to use stratum +# 0. Since the server line does not have the prefer keyword, this driver +# is never used for synchronization, unless no other other +# synchronization source is available. In case the local host is +# controlled by some external source, such as an external oscillator or +# another protocol, the prefer keyword would cause the local host to +# disregard all other synchronization sources, unless the kernel +# modifications are in use and declare an unsynchronized condition. +# +server 127.127.1.0 # local clock +fudge 127.127.1.0 stratum 10 +includefile /etc/ntp/ntpservers + +# server clock.via.net + +# +# Drift file. Put this in a directory which the daemon can write to. +# No symbolic links allowed, either, since the daemon updates the file +# by creating a temporary in the same directory and then rename()'ing +# it to the file. +# +driftfile /etc/ntp/drift +multicastclient 224.0.1.1 ff15::101 # listen on default 224.0.1.1 +broadcastdelay 0.008 + +# +# Authentication delay. If you use, or plan to use someday, the +# authentication facility you should make the programs in the auth_stuff +# directory and figure out what this number should be on your machine. +# +#authdelay 0.001 + +# +# Keys file. If you want to diddle your server at run time, make a +# keys file (mode 600 for sure) and define the key number to be +# used for making requests. +# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote +# systems might be able to reset your clock at will. +# +#keys /etc/ntp/keys +#trustedkey 65535 +#requestkey 65535 +#controlkey 65535 + +#restrict default ignore \ No newline at end of file diff --git a/ntp.keys b/ntp.keys new file mode 100644 index 0000000..1c3fbd2 --- /dev/null +++ b/ntp.keys @@ -0,0 +1,2 @@ +65535 M akey +1 M pass diff --git a/ntpd.rc b/ntpd.rc new file mode 100644 index 0000000..5815010 --- /dev/null +++ b/ntpd.rc @@ -0,0 +1,96 @@ +#!/bin/bash +# +# ntpd -- startup script for the Network Time Protocol (NTP) daemon +# +# description: this script takes care of starting and stopping \ +# the NTPv4 daemon needed to set the system date and time \ +# using an external source (the ntp server) +# +# chkconfig: 2345 55 10 +# +# processname: nptd +# config: /etc/ntp.conf, /etc/ntp/* +# lockfile: /var/lock/subsys/ntpd + +# Copyright (c) by Silvan Calarco +# Copyright (c) by Davide Madrisan + +. /etc/sysconfig/rc + +# Source function library. +[ -r "$rc_functions" ] && . $rc_functions + +NAME=ntpd +DAEMON=/usr/sbin/$NAME +DAEMONPID=/var/run/$NAME.pid +DAEMONCONF=/etc/ntp.conf +OPTIONS="-c $DAEMONCONF -p $DAEMONPID -g" + +[ -x $DAEMON ] || exit 0 + +# Source networking configuration. +[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "yes" ] || exit 0 + +[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME + +# check if the squid conf file is present +[ -r $DAEMONCONF ] || exit 0 + +# source clock configuration +[ -r /etc/sysconfig/clock ] && . /etc/sysconfig/clock + +# see how we were called +case "$1" in + start) + # adjust time to make life easy for ntpd + if [ -r /etc/ntp/step-tickers ]; then + echo -n $"Syncing time for $NAME: " + /usr/sbin/ntpdate -sbup8 `cat /etc/ntp/step-tickers` + RETVAL=$? + evaluate_retval + echo + if [ $RETVAL = 0 ]; then + if [ $UTC = "1" ]; then + echo -n $"Syncing hardware clock to UTC: " + hwclock --set --date="`date --utc --rfc-822`" --utc + else + echo -n $"Syncing hardware clock to local time: " + hwclock --set --date="`date --utc --rfc-822`" --localtime + fi + evaluate_retval + echo + fi + fi + # start daemon + echo -n $"Starting $NAME: " + daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS + RETVAL=$? + echo + [ $RETVAL = 0 ] && touch /var/lock/subsys/$NAME + ;; + stop) + echo -n $"Stopping $NAME: " + killproc -p $DAEMONPID $DAEMON + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$NAME $DAEMONPID + ;; + status) + statusproc ntpd + ;; + restart|reload) + $0 stop + sleep 1 + $0 start + ;; + condrestart) + [ -e /var/lock/subsys/$NAME ] && $0 restart || : + ;; + *) + echo "Usage: /etc/init.d/$NAME {start|stop|restart|condrestart|status}" + exit 1 + ;; +esac diff --git a/ntpservers b/ntpservers new file mode 100644 index 0000000..d849724 --- /dev/null +++ b/ntpservers @@ -0,0 +1,5 @@ +server ntp1.ien.it +server ntp2.ien.it +server ntp1.connectiv.com +server canon.inria.fr +