+++ /dev/null
-#!/bin/bash
-
-config=/etc/chrony.conf
-keyfile=/etc/chrony.keys
-chronyc=/usr/bin/chronyc
-dhclient_servers=/var/lib/dhclient/chrony.servers.*
-service_name=chronyd.service
-
-get_key() {
- awk '/^[ \t]*'$1'\>/ { print $2; exit }' < $keyfile
-}
-
-get_commandkeyid() {
- awk '/^[ \t]*commandkey\>/ { keyid=$2 } END { print keyid }' < $config
-}
-
-chrony_command() {
- commandkeyid=$(get_commandkeyid)
- [ -z "$commandkeyid" ] && return 1
- commandkey=$(get_key $commandkeyid)
- [ -z "$commandkey" ] && return 2
-
- $chronyc <<EOF
-password $commandkey
-$1
-EOF
-}
-
-generate_commandkey() {
- commandkeyid=$(get_commandkeyid)
- [ -z "$commandkeyid" ] && return 1
- commandkey=$(get_key $commandkeyid)
- [ -z "$commandkey" ] || return 0
-
- commandkey=$(tr -c -d '[\041-\176]' < /dev/urandom | head -c 16)
- [ -n "$commandkey" ] && echo "$commandkeyid $commandkey" >> $keyfile
-}
-
-add_dhclient_servers() {
- command=$(cat $dhclient_servers 2> /dev/null |
- while read server serverargs; do
- echo "add server $server $serverargs"
- done)
- if [ -n "$command" ]; then
- chrony_command "$command" &> /dev/null
- fi
-}
-
-is_running() {
- systemctl status chronyd.service &> /dev/null
-}
-
-case "$1" in
- generate-commandkey)
- generate_commandkey
- ;;
- add-dhclient-servers)
- add_dhclient_servers
- ;;
- command)
- is_running && chrony_command "$2"
- ;;
- *)
- echo $"Usage: $0 {generate-commandkey|add-dhclient-servers|command}"
- exit 2
-esac
-exit $?
-
keyfile /etc/chrony.keys
-# Specify the key used as password for chronyc.
-commandkey 1
-
# Disable logging of client accesses.
noclientlog
+++ /dev/null
-#!/bin/bash
-
-SERVERFILE=$SAVEDIR/chrony.servers.$interface
-
-chrony_config() {
- rm -f $SERVERFILE
- if [ "$PEERNTP" != "no" ]; then
- /usr/libexec/chrony-helper command "$(
- for server in $new_ntp_servers; do
- echo "add server $server $NTPSERVERARGS"
- echo "$server $NTPSERVERARGS" >> $SERVERFILE
- done)" &> /dev/null
- fi
-}
-
-chrony_restore() {
- if [ -f $SERVERFILE ]; then
- /usr/libexec/chrony-helper command "$(
- while read server serverargs; do
- echo "delete $server"
- done < $SERVERFILE)" &> /dev/null
- rm -f $SERVERFILE
- fi
-}
###############################################################################
name = chrony
-version = 1.26
-release = 9
+version = 3.4
+release = 1
groups = System/Daemons
-url = http://chrony.tuxfamily.org
+url = https://chrony.tuxfamily.org
license = GPLv2
summary = An NTP client/server.
clocks, system real-time clock or manual input as time references.
end
+source_dl = https://download.tuxfamily.org/chrony/
+
build
requires
bison
libcap-devel
libedit-devel
+ nettle-devel
readline-devel
shadow-utils
texinfo
install -m 640 -p %{DIR_SOURCE}/chrony.keys %{BUILDROOT}/etc/chrony.keys
chown -v root.chrony %{BUILDROOT}/etc/chrony.keys
- mkdir -pv %{BUILDROOT}/etc/dhcp/dhclient.d
- install -m 755 -p %{DIR_SOURCE}/chrony.dhclient \
- %{BUILDROOT}/etc/dhcp/dhclient.d/chrony.sh
-
mkdir -pv %{BUILDROOT}/etc/logrotate.d
install -m 644 -p %{DIR_SOURCE}/chrony.logrotate \
%{BUILDROOT}/etc/logrotate.d/chrony
- mkdir -pv %{BUILDROOT}/usr/lib/chrony
- install -m 755 -p %{DIR_SOURCE}/chrony-helper %{BUILDROOT}/usr/lib/chrony-helper
-
chown -Rv chrony.chrony %{BUILDROOT}/var/{lib,log}/chrony
end
end
[Service]
EnvironmentFile=-/etc/sysconfig/chronyd
-ExecStartPre=/usr/lib/chrony-helper generate-commandkey
ExecStart=/usr/sbin/chronyd -n -u chrony $OPTIONS
-ExecStartPost=/usr/lib/chrony-helper add-dhclient-servers
[Install]
WantedBy=multi-user.target