Blame SPECS/chrony.spec

f132bc
%global _hardened_build 1
f132bc
%global clknetsim_ver 8b4842
f132bc
%bcond_without debug
f132bc
f132bc
Name:           chrony
f132bc
Version:        3.4
f132bc
Release:        1%{?dist}
f132bc
Summary:        An NTP client/server
f132bc
f132bc
Group:          System Environment/Daemons
f132bc
License:        GPLv2
f132bc
URL:            https://chrony.tuxfamily.org
f132bc
Source0:        https://download.tuxfamily.org/chrony/chrony-%{version}%{?prerelease}.tar.gz
f132bc
Source1:        chrony.dhclient
f132bc
Source2:        chrony.helper
f132bc
Source3:        chrony-dnssrv@.service
f132bc
Source4:        chrony-dnssrv@.timer
f132bc
# simulator for test suite
f132bc
Source10:       https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknetsim-%{clknetsim_ver}.tar.gz
f132bc
f132bc
# add NTP servers from DHCP when starting service
f132bc
Patch1:         chrony-service-helper.patch
f132bc
# remove upstream kernel versions in documentation of HW timestamping
f132bc
Patch2:         chrony-timestamping.patch
f132bc
# revert upstream changes in packaged configuration examples
f132bc
Patch3:         chrony-defconfig.patch
f132bc
f132bc
BuildRequires:  libcap-devel libedit-devel nss-devel pps-tools-devel
f132bc
%ifarch %{ix86} x86_64 %{arm} aarch64 ppc64 ppc64le s390 s390x
f132bc
BuildRequires:  libseccomp-devel
f132bc
%endif
f132bc
BuildRequires:  bison systemd-units
f132bc
# require kernel headers with supported HW-timestamping features
f132bc
BuildRequires:  kernel-headers > 3.10.0-742
f132bc
f132bc
Requires(pre):  shadow-utils
f132bc
Requires(post): systemd
f132bc
Requires(preun): systemd
f132bc
Requires(postun): systemd
f132bc
f132bc
%description
f132bc
A client/server for the Network Time Protocol, this program keeps your
f132bc
computer's clock accurate. It was specially designed to support
f132bc
systems with intermittent internet connections, but it also works well
f132bc
in permanently connected environments. It can use also hardware reference
f132bc
clocks, system real-time clock or manual input as time references.
f132bc
f132bc
%if 0%{!?vendorzone:1}
f132bc
%global vendorzone %(source /etc/os-release && echo ${ID}.)
f132bc
%endif
f132bc
f132bc
%prep
f132bc
%setup -q -n %{name}-%{version}%{?prerelease} -a 10
f132bc
%patch1 -p1 -b .service-helper
f132bc
%patch2 -p1 -b .timestamping
f132bc
%patch3 -p1 -b .defconfig
f132bc
f132bc
# review changes in packaged configuration files and scripts
f132bc
md5sum -c <<-EOF | (! grep -v 'OK$')
f132bc
        47ad7eccc410b981d2f2101cf5682616  examples/chrony-wait.service
f132bc
        58978d335ec3752ac2c38fa82b48f0a5  examples/chrony.conf.example2
f132bc
        ba6bb05c50e03f6b5ab54a2b7914800d  examples/chrony.keys.example
f132bc
        6a3178c4670de7de393d9365e2793740  examples/chrony.logrotate
f132bc
        8748a663f0b1943ea491858f414a6b26  examples/chrony.nm-dispatcher
f132bc
        921b354e94f5e3db124cb50d11cd560f  examples/chronyd.service
f132bc
EOF
f132bc
f132bc
# don't allow empty vendor zone
f132bc
test -n "%{vendorzone}"
f132bc
f132bc
# use our vendor zone and replace the pool directive with server
f132bc
# directives as some configuration tools don't support it yet
f132bc
sed -e 's|^\(pool \)\(pool.ntp.org.*\)|'\
f132bc
'server 0.%{vendorzone}\2\nserver 1.%{vendorzone}\2\n'\
f132bc
'server 2.%{vendorzone}\2\nserver 3.%{vendorzone}\2|' \
f132bc
        < examples/chrony.conf.example2 > chrony.conf
f132bc
f132bc
touch -r examples/chrony.conf.example2 chrony.conf
f132bc
f132bc
# regenerate the file from getdate.y
f132bc
rm -f getdate.c
f132bc
f132bc
mv clknetsim-%{clknetsim_ver}* test/simulation/clknetsim
f132bc
f132bc
%build
f132bc
%configure \
f132bc
%{?with_debug: --enable-debug} \
f132bc
        --enable-ntp-signd \
f132bc
        --enable-scfilter \
f132bc
        --docdir=%{_docdir} \
f132bc
        --without-nettle \
f132bc
        --with-ntp-era=$(date -d '1970-01-01 00:00:00+00:00' +'%s') \
f132bc
        --with-user=chrony \
f132bc
        --with-hwclockfile=%{_sysconfdir}/adjtime \
f132bc
        --with-sendmail=%{_sbindir}/sendmail
f132bc
make %{?_smp_mflags}
f132bc
f132bc
%install
f132bc
make install DESTDIR=$RPM_BUILD_ROOT
f132bc
f132bc
rm -rf $RPM_BUILD_ROOT%{_docdir}
f132bc
f132bc
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{sysconfig,logrotate.d}
f132bc
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/{lib,log}/chrony
f132bc
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d
f132bc
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/dhcp/dhclient.d
f132bc
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}
f132bc
mkdir -p $RPM_BUILD_ROOT{%{_unitdir},%{_prefix}/lib/systemd/ntp-units.d}
f132bc
f132bc
install -m 644 -p chrony.conf $RPM_BUILD_ROOT%{_sysconfdir}/chrony.conf
f132bc
f132bc
install -m 640 -p examples/chrony.keys.example \
f132bc
        $RPM_BUILD_ROOT%{_sysconfdir}/chrony.keys
f132bc
install -m 755 -p examples/chrony.nm-dispatcher \
f132bc
        $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
f132bc
install -m 755 -p %{SOURCE1} \
f132bc
        $RPM_BUILD_ROOT%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
f132bc
install -m 644 -p examples/chrony.logrotate \
f132bc
        $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/chrony
f132bc
f132bc
install -m 644 -p examples/chronyd.service \
f132bc
        $RPM_BUILD_ROOT%{_unitdir}/chronyd.service
f132bc
install -m 644 -p examples/chrony-wait.service \
f132bc
        $RPM_BUILD_ROOT%{_unitdir}/chrony-wait.service
f132bc
install -m 644 -p %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/chrony-dnssrv@.service
f132bc
install -m 644 -p %{SOURCE4} $RPM_BUILD_ROOT%{_unitdir}/chrony-dnssrv@.timer
f132bc
f132bc
install -m 755 -p %{SOURCE2} $RPM_BUILD_ROOT%{_libexecdir}/chrony-helper
f132bc
f132bc
cat > $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/chronyd <
f132bc
# Command-line options for chronyd
f132bc
OPTIONS=""
f132bc
EOF
f132bc
f132bc
touch $RPM_BUILD_ROOT%{_localstatedir}/lib/chrony/{drift,rtc}
f132bc
f132bc
echo 'chronyd.service' > \
f132bc
        $RPM_BUILD_ROOT%{_prefix}/lib/systemd/ntp-units.d/50-chronyd.list
f132bc
f132bc
%check
f132bc
# set random seed to get deterministic results
f132bc
export CLKNETSIM_RANDOM_SEED=24502
f132bc
make %{?_smp_mflags} -C test/simulation/clknetsim
f132bc
make quickcheck
f132bc
f132bc
%pre
f132bc
getent group chrony > /dev/null || /usr/sbin/groupadd -r chrony
f132bc
getent passwd chrony > /dev/null || /usr/sbin/useradd -r -g chrony \
f132bc
       -d %{_localstatedir}/lib/chrony -s /sbin/nologin chrony
f132bc
:
f132bc
f132bc
%post
f132bc
# fix PIDFile in local chronyd.service on upgrades from chrony < 3.3-2
f132bc
if grep -q 'PIDFile=%{_localstatedir}/run/chronyd.pid' \
f132bc
                %{_sysconfdir}/systemd/system/chronyd.service 2> /dev/null && \
f132bc
        ! grep -qi '^[ '$'\t'']*pidfile' %{_sysconfdir}/chrony.conf 2> /dev/null
f132bc
then
f132bc
        sed -i '/PIDFile=/s|/run/|/run/chrony/|' \
f132bc
                %{_sysconfdir}/systemd/system/chronyd.service
f132bc
fi
f132bc
# workaround for late reload of unit file (#1614751)
f132bc
%{_bindir}/systemctl daemon-reload
f132bc
%systemd_post chronyd.service chrony-wait.service
f132bc
f132bc
%preun
f132bc
%systemd_preun chronyd.service chrony-wait.service
f132bc
f132bc
%postun
f132bc
%systemd_postun_with_restart chronyd.service
f132bc
f132bc
%files
f132bc
%doc COPYING FAQ NEWS README
f132bc
%config(noreplace) %{_sysconfdir}/chrony.conf
f132bc
%config(noreplace) %verify(not md5 size mtime) %attr(640,root,chrony) %{_sysconfdir}/chrony.keys
f132bc
%config(noreplace) %{_sysconfdir}/logrotate.d/chrony
f132bc
%config(noreplace) %{_sysconfdir}/sysconfig/chronyd
f132bc
%{_sysconfdir}/NetworkManager/dispatcher.d/20-chrony
f132bc
%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
f132bc
%{_bindir}/chronyc
f132bc
%{_sbindir}/chronyd
f132bc
%{_libexecdir}/chrony-helper
f132bc
%{_prefix}/lib/systemd/ntp-units.d/*.list
f132bc
%{_unitdir}/chrony*.service
f132bc
%{_unitdir}/chrony*.timer
f132bc
%{_mandir}/man[158]/%{name}*.[158]*
f132bc
%dir %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony
f132bc
%ghost %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony/drift
f132bc
%ghost %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony/rtc
f132bc
%dir %attr(-,chrony,chrony) %{_localstatedir}/log/chrony
f132bc
f132bc
%changelog
f132bc
* Thu Jan 10 2019 Miroslav Lichvar <mlichvar@redhat.com> 3.4-1
f132bc
- update to 3.4 (#1636117, #1565544, #1565548, #1596239, #1600882)
f132bc
- drop support for HW timestamping on kernels < 3.10.0-613
f132bc
f132bc
* Tue Dec 05 2017 Miroslav Lichvar <mlichvar@redhat.com> 3.2-2
f132bc
- fix chronyc getting stuck in infinite loop after clock step (#1520884)
f132bc
f132bc
* Tue Sep 19 2017 Miroslav Lichvar <mlichvar@redhat.com> 3.2-1
f132bc
- update to 3.2 (#1482565 #1462081 #1454765)
f132bc
- use ID from /etc/os-release to set pool.ntp.org vendor zone
f132bc
f132bc
* Mon Apr 24 2017 Miroslav Lichvar <mlichvar@redhat.com> 3.1-2
f132bc
- don't drop PHC samples with zero delay (#1443342)
f132bc
f132bc
* Fri Feb 03 2017 Miroslav Lichvar <mlichvar@redhat.com> 3.1-1
f132bc
- update to 3.1 (#1387223 #1274250 #1350669 #1406445)
f132bc
- don't start chronyd without capability to set system clock (#1306046)
f132bc
- fix chrony-helper to escape names of systemd units (#1418968)
f132bc
- package chronyd sysconfig file (#1396840)
f132bc
f132bc
* Fri Nov 18 2016 Miroslav Lichvar <mlichvar@redhat.com> 2.1.1-4
f132bc
- fix crash with smoothtime leaponly directive (#1392793)
f132bc
f132bc
* Tue Jun 28 2016 Miroslav Lichvar <mlichvar@redhat.com> 2.1.1-3
f132bc
- fix chrony-helper to exit with correct status (#1350531)
f132bc
f132bc
* Wed May 25 2016 Miroslav Lichvar <mlichvar@redhat.com> 2.1.1-2
f132bc
- extend chrony-helper to allow management of static sources (#1331655)
f132bc
f132bc
* Tue Jun 23 2015 Miroslav Lichvar <mlichvar@redhat.com> 2.1.1-1
f132bc
- update to 2.1.1 (#1117882)
f132bc
- add -n option to gzip command to not save timestamp
f132bc
f132bc
* Mon Jun 22 2015 Miroslav Lichvar <mlichvar@redhat.com> 2.1-1
f132bc
- update to 2.1 (#1117882 #1169353 #1206504 #1209568 CVE-2015-1821
f132bc
  CVE-2015-1822 CVE-2015-1853)
f132bc
- extend chrony-helper to allow using servers from DNS SRV records (#1211600)
f132bc
- add servers from DHCP with iburst option by default (#1219492)
f132bc
- execute test suite
f132bc
f132bc
* Tue Feb 04 2014 Miroslav Lichvar <mlichvar@redhat.com> 1.29.1-1
f132bc
- update to 1.29.1 (#1053022, CVE-2014-0021)
f132bc
- fix selecting of sources with prefer option (#1061048)
f132bc
- fix potential bug in writing of drift files (#1061106)
f132bc
- replace hardening build flags with _hardened_build (#1061036)
f132bc
f132bc
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.29-4
f132bc
- Mass rebuild 2014-01-24
f132bc
f132bc
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.29-3
f132bc
- Mass rebuild 2013-12-27
f132bc
f132bc
* Thu Oct 03 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.29-2
f132bc
- add ordering dependency to not start chronyd before ntpd stopped (#1011968)
f132bc
f132bc
* Fri Aug 09 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.29-1
f132bc
- update to 1.29 (#995373, CVE-2012-4502, CVE-2012-4503)
f132bc
f132bc
* Wed Jul 17 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.28-1
f132bc
- update to 1.28
f132bc
- change default makestep limit to 10 seconds
f132bc
f132bc
* Mon Jun 24 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.28-0.2.pre1
f132bc
- buildrequire systemd-units
f132bc
f132bc
* Fri Jun 21 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.28-0.1.pre1
f132bc
- update to 1.28-pre1
f132bc
- listen for commands only on localhost by default
f132bc
f132bc
* Thu May 09 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.27-3
f132bc
- disable chrony-wait service by default (#961047)
f132bc
- drop old systemd scriptlets
f132bc
- don't own ntp-units.d directory
f132bc
- move files from /lib
f132bc
- remove unncessary dependency on syslog target
f132bc
f132bc
* Tue Mar 12 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.27-2
f132bc
- suppress error messages from tr when generating key (#907914)
f132bc
- fix delta calculation with extreme frequency offsets
f132bc
f132bc
* Fri Feb 01 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.27-1
f132bc
- update to 1.27
f132bc
- start chrony-wait service with chronyd
f132bc
- start chronyd service after sntp
f132bc
- remove obsolete macros
f132bc
f132bc
* Tue Sep 11 2012 Miroslav Lichvar <mlichvar@redhat.com> 1.27-0.5.pre1.git1ca844
f132bc
- update to git snapshot 1ca844
f132bc
- update systemd integration (#846303)
f132bc
- use systemd macros if available (#850151)
f132bc
- use correct vendor pool.ntp.org zone on RHEL (#845981)
f132bc
- don't log output of chrony-wait service
f132bc
f132bc
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.27-0.4.pre1
f132bc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
f132bc
f132bc
* Fri Apr 27 2012 Miroslav Lichvar <mlichvar@redhat.com> 1.27-0.3.pre1
f132bc
- update service file for systemd-timedated-ntp target (#816493)
f132bc
f132bc
* Fri Apr 06 2012 Miroslav Lichvar <mlichvar@redhat.com> 1.27-0.2.pre1
f132bc
  use systemctl is-active instead of status in chrony-helper (#794771)
f132bc
f132bc
* Tue Feb 28 2012 Miroslav Lichvar <mlichvar@redhat.com> 1.27-0.1.pre1
f132bc
- update to 1.27-pre1
f132bc
- generate SHA1 command key instead of MD5
f132bc
f132bc
* Wed Feb 15 2012 Miroslav Lichvar <mlichvar@redhat.com> 1.26-6.20110831gitb088b7
f132bc
- remove old servers on DHCP update (#787042)
f132bc
f132bc
* Fri Feb 10 2012 Miroslav Lichvar <mlichvar@redhat.com> 1.26-5.20110831gitb088b7
f132bc
- improve chrony-helper to keep track of servers added from DHCP (#787042)
f132bc
- fix dhclient script to always return with zero exit code (#767859)
f132bc
f132bc
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.26-4.20110831gitb088b7
f132bc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
f132bc
f132bc
* Tue Sep 06 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.26-3.20110831gitb088b7
f132bc
- update to git snapshot 20110831gitb088b7
f132bc
- on first start generate password with 16 chars
f132bc
- change systemd service type to forking
f132bc
- add forced-command to chrony-helper (#735821)
f132bc
f132bc
* Mon Aug 15 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.26-2
f132bc
- fix iburst with very high jitters and long delays
f132bc
- use timepps header from pps-tools-devel
f132bc
f132bc
* Wed Jul 13 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.26-1
f132bc
- update to 1.26
f132bc
- read options from sysconfig file if it exists
f132bc
f132bc
* Fri Jun 24 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.26-0.1.pre1
f132bc
- update to 1.26-pre1
f132bc
- fix service name in %%triggerun
f132bc
- drop SysV init script
f132bc
- add chrony-wait service
f132bc
f132bc
* Fri May 06 2011 Bill Nottingham <notting@redhat.com> 1.25-2
f132bc
- fix systemd scriptlets for the upgrade case
f132bc
f132bc
* Wed May 04 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.25-1
f132bc
- update to 1.25
f132bc
f132bc
* Wed Apr 20 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.25-0.3.pre2
f132bc
- update to 1.25-pre2
f132bc
- link with -Wl,-z,relro,-z,now options
f132bc
f132bc
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.25-0.2.pre1
f132bc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
f132bc
f132bc
* Tue Feb 01 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.25-0.1.pre1
f132bc
- update to 1.25-pre1
f132bc
- use iburst, four pool servers, rtcsync, stratumweight in default config
f132bc
- add systemd support
f132bc
- drop sysconfig file 
f132bc
- suppress install-info errors
f132bc
f132bc
* Thu Apr 29 2010 Miroslav Lichvar <mlichvar@redhat.com> 1.24-4.20100428git73d775
f132bc
- update to 20100428git73d775
f132bc
- replace initstepslew directive with makestep in default config
f132bc
- add NetworkManager dispatcher script
f132bc
- add dhclient script
f132bc
- retry server/peer name resolution at least once to workaround
f132bc
  NetworkManager race condition on boot
f132bc
- don't verify chrony.keys
f132bc
f132bc
* Fri Mar 12 2010 Miroslav Lichvar <mlichvar@redhat.com> 1.24-3.20100302git5fb555
f132bc
- update to snapshot 20100302git5fb555
f132bc
- compile with PPS API support
f132bc
f132bc
* Thu Feb 04 2010 Miroslav Lichvar <mlichvar@redhat.com> 1.24-1
f132bc
- update to 1.24 (#555367, CVE-2010-0292 CVE-2010-0293 CVE-2010-0294)
f132bc
- modify default config
f132bc
  - step clock on start if it is off by more than 100 seconds
f132bc
  - disable client log
f132bc
- build with -fPIE on sparc
f132bc
f132bc
* Tue Dec 15 2009 Miroslav Lichvar <mlichvar@redhat.com> 1.24-0.1.pre1
f132bc
- update to 1.24-pre1
f132bc
f132bc
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23-7.20081106gitbe42b4
f132bc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
f132bc
f132bc
* Fri Jul 17 2009 Miroslav Lichvar <mlichvar@redhat.com> 1.23-6.20081106gitbe42b4
f132bc
- switch to editline
f132bc
- support arbitrary chronyc commands in init script
f132bc
f132bc
* Mon Jun 08 2009 Dan Horak <dan[at]danny.cz> 1.23-5.20081106gitbe42b4
f132bc
- add patch with support for s390/s390x
f132bc
f132bc
* Mon Mar 09 2009 Miroslav Lichvar <mlichvar@redhat.com> 1.23-4.20081106gitbe42b4
f132bc
- fix building with broken libcap header (#483548)
f132bc
f132bc
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23-3.20081106gitbe42b4
f132bc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
f132bc
f132bc
* Wed Nov 19 2008 Miroslav Lichvar <mlichvar@redhat.com> 1.23-2.20081106gitbe42b4
f132bc
- fix info uninstall
f132bc
- generate random command key in init script
f132bc
- support cyclelogs, online, offline commands in init script
f132bc
- add logrotate script
f132bc
f132bc
* Tue Nov 11 2008 Miroslav Lichvar <mlichvar@redhat.com> 1.23-1.20081106gitbe42b4
f132bc
- initial release