]> git.ipfire.org Git - thirdparty/chrony.git/log
thirdparty/chrony.git
9 years agodoc: update NEWS 2.2-security 2.2.1
Miroslav Lichvar [Mon, 11 Jan 2016 14:42:36 +0000 (15:42 +0100)] 
doc: update NEWS

9 years agotest: extend 105-ntpauth to test symmetric mode
Miroslav Lichvar [Mon, 11 Jan 2016 15:40:29 +0000 (16:40 +0100)] 
test: extend 105-ntpauth to test symmetric mode

9 years agotest: allow setting options for each peer side separately
Miroslav Lichvar [Mon, 11 Jan 2016 15:23:07 +0000 (16:23 +0100)] 
test: allow setting options for each peer side separately

9 years agontp: restrict authentication of server/peer to specified key
Miroslav Lichvar [Fri, 8 Jan 2016 14:03:09 +0000 (15:03 +0100)] 
ntp: restrict authentication of server/peer to specified key

When a server/peer was specified with a key number to enable
authentication with a symmetric key, packets received from the
server/peer were accepted if they were authenticated with any of
the keys contained in the key file and not just the specified key.

This allowed an attacker who knew one key of a client/peer to modify
packets from its servers/peers that were authenticated with other
keys in a man-in-the-middle (MITM) attack. For example, in a network
where each NTP association had a separate key and all hosts had only
keys they needed, a client of a server could not attack other clients
of the server, but it could attack the server and also attack its own
clients (i.e. modify packets from other servers).

To not allow the server/peer to be authenticated with other keys
extend the authentication test to check if the key ID in the received
packet is equal to the configured key number. As a consequence, it's
no longer possible to authenticate two peers to each other with two
different keys, both peers have to be configured to use the same key.

This issue was discovered by Matt Street of Cisco ASIG.

9 years agodoc: update NEWS 2.2
Miroslav Lichvar [Mon, 19 Oct 2015 09:17:16 +0000 (11:17 +0200)] 
doc: update NEWS

9 years agoconfigure: disable scfilter by default
Miroslav Lichvar [Mon, 19 Oct 2015 09:16:45 +0000 (11:16 +0200)] 
configure: disable scfilter by default

As an experimental feature it should be explicitly enabled.

9 years agoclient: add debug message for recv() error
Miroslav Lichvar [Thu, 15 Oct 2015 09:57:54 +0000 (11:57 +0200)] 
client: add debug message for recv() error

9 years agodoc: add minimum recommended configuration to FAQ
Miroslav Lichvar [Wed, 14 Oct 2015 14:44:06 +0000 (16:44 +0200)] 
doc: add minimum recommended configuration to FAQ

9 years agodoc: include chrony version in manual title
Miroslav Lichvar [Wed, 14 Oct 2015 12:43:47 +0000 (14:43 +0200)] 
doc: include chrony version in manual title

9 years agodoc: update comparison with ntpd
Miroslav Lichvar [Wed, 14 Oct 2015 12:08:21 +0000 (14:08 +0200)] 
doc: update comparison with ntpd

9 years agodoc: remove obsolete section on contributing
Miroslav Lichvar [Wed, 14 Oct 2015 11:52:35 +0000 (13:52 +0200)] 
doc: remove obsolete section on contributing

9 years agodoc: improve maxdistance description
Miroslav Lichvar [Wed, 14 Oct 2015 11:51:19 +0000 (13:51 +0200)] 
doc: improve maxdistance description

9 years agologging: don't ignore message severity with debug support
Miroslav Lichvar [Mon, 12 Oct 2015 11:16:04 +0000 (13:16 +0200)] 
logging: don't ignore message severity with debug support

The severity was fixed for all messages to LOGS_DEBUG. This was broken
in commit 7b2430fc3c44bc7f5fc3b6ca2b478cdea77ef841.

9 years agoconfigure: check for struct in_pktinfo with ipi_spec_dst
Miroslav Lichvar [Mon, 12 Oct 2015 09:44:21 +0000 (11:44 +0200)] 
configure: check for struct in_pktinfo with ipi_spec_dst

On NetBSD there is a struct in_pktinfo, but it doesn't have the
ipi_spec_dst field and it breaks compilation.

9 years agoconfigure: improve description of struct in6_pktinfo check
Miroslav Lichvar [Mon, 12 Oct 2015 09:29:13 +0000 (11:29 +0200)] 
configure: improve description of struct in6_pktinfo check

9 years agoconfigure: include IPV6_PKTINFO in struct in6_pktinfo check
Miroslav Lichvar [Mon, 12 Oct 2015 09:22:27 +0000 (11:22 +0200)] 
configure: include IPV6_PKTINFO in struct in6_pktinfo check

9 years agodoc: update NEWS 2.2-pre2
Miroslav Lichvar [Fri, 9 Oct 2015 11:36:59 +0000 (13:36 +0200)] 
doc: update NEWS

9 years agoexamples: use one-second check interval in chrony-wait.service
Miroslav Lichvar [Fri, 9 Oct 2015 11:36:02 +0000 (13:36 +0200)] 
examples: use one-second check interval in chrony-wait.service

9 years agoconfigure: make default hwclockfile configurable
Miroslav Lichvar [Thu, 8 Oct 2015 08:44:23 +0000 (10:44 +0200)] 
configure: make default hwclockfile configurable

9 years agortc: improve logging
Miroslav Lichvar [Thu, 8 Oct 2015 08:18:34 +0000 (10:18 +0200)] 
rtc: improve logging

Improve, shorten, or convert to debug log messages.

9 years agoclient: make waitsync check interval configurable
Miroslav Lichvar [Wed, 7 Oct 2015 10:44:25 +0000 (12:44 +0200)] 
client: make waitsync check interval configurable

9 years agortc: restore time from driftfile if later than RTC time
Miroslav Lichvar [Tue, 6 Oct 2015 13:52:36 +0000 (15:52 +0200)] 
rtc: restore time from driftfile if later than RTC time

This is useful on computers that have an RTC, but there is no battery to
keep the time when they are turned off and start with the same time on
each boot.

9 years agortc: don't run time_init function if pre_init failed
Miroslav Lichvar [Tue, 6 Oct 2015 11:23:14 +0000 (13:23 +0200)] 
rtc: don't run time_init function if pre_init failed

9 years agodoc: reduce makestep threshold in examples to 1 second
Miroslav Lichvar [Mon, 5 Oct 2015 08:12:50 +0000 (10:12 +0200)] 
doc: reduce makestep threshold in examples to 1 second

9 years agosys_linux: abort when loading seccomp rules fails
Miroslav Lichvar [Mon, 5 Oct 2015 07:56:58 +0000 (09:56 +0200)] 
sys_linux: abort when loading seccomp rules fails

9 years agodoc: update NEWS 2.2-pre1
Miroslav Lichvar [Thu, 1 Oct 2015 16:06:44 +0000 (18:06 +0200)] 
doc: update NEWS

9 years agodoc: update README
Miroslav Lichvar [Thu, 1 Oct 2015 11:25:40 +0000 (13:25 +0200)] 
doc: update README

9 years agoupdate copyright years
Miroslav Lichvar [Thu, 1 Oct 2015 12:23:32 +0000 (14:23 +0200)] 
update copyright years

9 years agoclient: remove unreachable code
Miroslav Lichvar [Thu, 1 Oct 2015 07:26:34 +0000 (09:26 +0200)] 
client: remove unreachable code

9 years agoclient: don't try sending request with invalid socket
Miroslav Lichvar [Wed, 30 Sep 2015 12:58:17 +0000 (14:58 +0200)] 
client: don't try sending request with invalid socket

9 years agoclient: don't shorten default timeout with ASYNCDNS
Miroslav Lichvar [Wed, 30 Sep 2015 12:20:49 +0000 (14:20 +0200)] 
client: don't shorten default timeout with ASYNCDNS

With connected sockets recv() should fail immediately if chronyd is not
listening on localhost and with the Unix socket connecting should fail.

9 years agostubs: add NSR_RefreshAddresses()
Miroslav Lichvar [Wed, 30 Sep 2015 11:33:06 +0000 (13:33 +0200)] 
stubs: add NSR_RefreshAddresses()

9 years agostubs: don't call DNS_Name2IPAddress handler directly
Miroslav Lichvar [Tue, 29 Sep 2015 15:39:27 +0000 (17:39 +0200)] 
stubs: don't call DNS_Name2IPAddress handler directly

Instead of calling the handler directly schedule a timeout with zero
delay for resolving to make the function behave similarly to the real
asynchronous resolver. This should prevent problems with code that
inadvertently depends on this behavior and which would break only when
compiled without support for asynchronous resolving.

9 years agoclient: improve signal handling
Miroslav Lichvar [Tue, 29 Sep 2015 15:11:38 +0000 (17:11 +0200)] 
client: improve signal handling

After receiving a signal, don't process new command from readline() and
break from waitsync command.

9 years agodoc: document refresh command
Miroslav Lichvar [Tue, 29 Sep 2015 14:27:38 +0000 (16:27 +0200)] 
doc: document refresh command

9 years agoclient: update help text
Miroslav Lichvar [Tue, 29 Sep 2015 14:18:06 +0000 (16:18 +0200)] 
client: update help text

9 years agocmdmon: add refresh command
Gautier PHILIPPON [Tue, 29 Sep 2015 14:08:43 +0000 (16:08 +0200)] 
cmdmon: add refresh command

This command can be used to resolve the names of configured sources to
IP addresses again.

9 years agoclient: fix compiler warning on extra printf argument
Miroslav Lichvar [Tue, 29 Sep 2015 08:07:26 +0000 (10:07 +0200)] 
client: fix compiler warning on extra printf argument

9 years agodoc: update for recent changes
Miroslav Lichvar [Fri, 25 Sep 2015 15:30:49 +0000 (17:30 +0200)] 
doc: update for recent changes

9 years agoclient: update help text
Miroslav Lichvar [Fri, 25 Sep 2015 14:02:04 +0000 (16:02 +0200)] 
client: update help text

Update the text for recent changes, add missing commands and indent the
description in the output.

9 years agologging: don't save debugging arguments when debug is disabled
Miroslav Lichvar [Thu, 24 Sep 2015 16:31:17 +0000 (18:31 +0200)] 
logging: don't save debugging arguments when debug is disabled

Don't save the facility number, line number, function name and filename
in the compiled binary unless the debugging support is enabled.

9 years agosys: use NetBSD driver on FreeBSD
Miroslav Lichvar [Tue, 22 Sep 2015 15:31:04 +0000 (17:31 +0200)] 
sys: use NetBSD driver on FreeBSD

The NetBSD driver now provides fast slewing using adjtime(), which
can be used on FreeBSD too.

9 years agosys_netbsd: add fast slewing based on adjtime()
Miroslav Lichvar [Tue, 22 Sep 2015 15:18:43 +0000 (17:18 +0200)] 
sys_netbsd: add fast slewing based on adjtime()

Implement slewing based on adjtime() that the generic driver can use to
correct offsets larger than 1 second with 5000 ppm slewing rate.

9 years agosys_generic: allow fast slewing with system driver
Miroslav Lichvar [Tue, 22 Sep 2015 15:12:15 +0000 (17:12 +0200)] 
sys_generic: allow fast slewing with system driver

The system drivers may implement their own slewing which the generic
driver can use to slew faster than the maximum frequency the driver is
allowed to set directly.

9 years agosys_solaris: use timex driver
Miroslav Lichvar [Fri, 18 Sep 2015 08:29:47 +0000 (10:29 +0200)] 
sys_solaris: use timex driver

Remove driver functions based on adjtime() and switch to the new timex
driver. The kernel allows the timex frequency to be set in the full
range of int32_t, which gives a maximum frequency of 32768 ppm. Round
the limit to 32500 ppm.

9 years agosys_timex: set timex constant on Solaris
Miroslav Lichvar [Fri, 18 Sep 2015 08:16:40 +0000 (10:16 +0200)] 
sys_timex: set timex constant on Solaris

The kernel apparently checks the constant even when it's not being set
with MOD_TIMECONST and may return EINVAL on an uninitialized value.

9 years agoclient: fix binding of Unix socket on Solaris
Miroslav Lichvar [Fri, 18 Sep 2015 10:05:44 +0000 (12:05 +0200)] 
client: fix binding of Unix socket on Solaris

bind() needs to be called before connect(), otherwise it fails with
EINVAL.

9 years agofix building on Solaris
Miroslav Lichvar [Fri, 18 Sep 2015 08:10:50 +0000 (10:10 +0200)] 
fix building on Solaris

- a feature test macro is needed to get msg_control in struct msghdr
- variables must not be named sun to avoid conflict with a macro
- res_init() needs -lresolv
- configure tests for IPv6 and getaddrinfo need -lsocket -lnsl
- pid_t is defined as long and needs to be cast for %d format

9 years agoclean up sysincl.h more
Miroslav Lichvar [Fri, 18 Sep 2015 08:07:56 +0000 (10:07 +0200)] 
clean up sysincl.h more

Define feature test macros in config.h if needed.

9 years agoconfigure: check if C compiler works
Miroslav Lichvar [Thu, 17 Sep 2015 11:51:18 +0000 (13:51 +0200)] 
configure: check if C compiler works

Check if the C compiler works to get a useful error message when it
doesn't or it's missing. If the CC environment variable is not set, try
gcc and then cc.

9 years agoconfigure: prefix error messages
Miroslav Lichvar [Thu, 17 Sep 2015 11:32:14 +0000 (13:32 +0200)] 
configure: prefix error messages

9 years agoconfigure: don't set any arch-specific CFLAGS
Miroslav Lichvar [Thu, 17 Sep 2015 11:03:04 +0000 (13:03 +0200)] 
configure: don't set any arch-specific CFLAGS

9 years agoconfigure: ignore architecture in system selection
Miroslav Lichvar [Thu, 17 Sep 2015 09:43:35 +0000 (11:43 +0200)] 
configure: ignore architecture in system selection

Assume chrony can be compiled and work on all architectures supported by
the operating systems.

9 years agosys: drop SunOS driver
Miroslav Lichvar [Tue, 15 Sep 2015 16:46:17 +0000 (18:46 +0200)] 
sys: drop SunOS driver

On FreeBSD is used the new timex driver and SunOS 4 is not supported
anymore.

9 years agosys: use timex driver on FreeBSD
Miroslav Lichvar [Tue, 15 Sep 2015 16:43:43 +0000 (18:43 +0200)] 
sys: use timex driver on FreeBSD

Switch from the SunOS adjtime() based driver to the timex driver.
There is no FreeBSD-specific code, so call SYS_Timex_Initialise()
and SYS_Timex_Finalise() directly from sys.c.

9 years agoclean up sysincl.h
Miroslav Lichvar [Tue, 15 Sep 2015 16:42:09 +0000 (18:42 +0200)] 
clean up sysincl.h

9 years agodrop WINNT-specific code
Miroslav Lichvar [Tue, 15 Sep 2015 16:12:32 +0000 (18:12 +0200)] 
drop WINNT-specific code

This was never really supported and it would probably require a lot of
work to get a usable chronyd in Cygwin. Remove all WINNT-specific code.

9 years agosys: don't allow empty SYS_Initialise()/SYS_Finalise()
Miroslav Lichvar [Tue, 15 Sep 2015 15:54:05 +0000 (17:54 +0200)] 
sys: don't allow empty SYS_Initialise()/SYS_Finalise()

Require one system-specific macro to be defined to always call an
initialization/finalization function.

9 years agosys: move DRIFT_REMOVAL_INTERVAL definition
Miroslav Lichvar [Tue, 15 Sep 2015 15:38:58 +0000 (17:38 +0200)] 
sys: move DRIFT_REMOVAL_INTERVAL definition

In the SunOS and Solaris drivers DRIFT_REMOVAL_INTERVAL needs to be
defined before it's used. This was broken in commit
b6a27df5b9be0f07f151c8fba311cb7eadb2b13e.

9 years agosys_netbsd: use timex driver
Miroslav Lichvar [Tue, 15 Sep 2015 13:44:34 +0000 (15:44 +0200)] 
sys_netbsd: use timex driver

Remove the driver functions based on adjtime() and switch to the new
timex driver, which is based on ntp_adjtime(). This allows chronyd to
control the kernel frequency, adjust the offset with sub-microsecond
accuracy, and set the kernel leap and sync status. A drawback is that
the maximum slew rate is now limited by the 500 ppm maximum frequency
offset, while adjtime() on NetBSD slewed by up to 5000 ppm.

9 years agosys_linux: use timex driver
Miroslav Lichvar [Tue, 15 Sep 2015 13:24:28 +0000 (15:24 +0200)] 
sys_linux: use timex driver

Remove functions that are included in the new timex driver. Keep only
functions that have extended functionality, i.e. read and set the
frequency using the timex tick field and apply step offset with
ADJ_SETOFFSET.

Merge the code from wrap_adjtimex.c that is still needed with
sys_linux.c and remove the file.

9 years agosys: add generic timex driver
Miroslav Lichvar [Tue, 15 Sep 2015 13:03:37 +0000 (15:03 +0200)] 
sys: add generic timex driver

This is based on sys_linux.c and wrap_adjtimex.c. It's intended for all
systems that support the adjtimex() or ntp_adjtime() system call. The
driver functions can be replaced with extended system-specific versions
(e.g. to control the frequency with the tick field on Linux).

9 years agotest: add tests for system adjtime() and ntp_adjtime()
Miroslav Lichvar [Thu, 10 Sep 2015 13:34:56 +0000 (15:34 +0200)] 
test: add tests for system adjtime() and ntp_adjtime()

Include a test program to determine how the adjtime() implementation
behaves. Check the range of supported offset, support for readonly
operation, and slew rate with different update intervals and offsets.

Also, add a test for ntp_adjtime() to check what frequency range it
supports.

9 years agogit: use absolute paths in .gitignore
Miroslav Lichvar [Thu, 10 Sep 2015 13:32:58 +0000 (15:32 +0200)] 
git: use absolute paths in .gitignore

9 years agosys_linux: allow uname in seccomp filter
Miroslav Lichvar [Mon, 14 Sep 2015 07:16:33 +0000 (09:16 +0200)] 
sys_linux: allow uname in seccomp filter

It may be called from res_init() apparently.

9 years agoutil: print expected uid/gid in UTI_CheckDirPermissions()
Miroslav Lichvar [Wed, 9 Sep 2015 15:05:51 +0000 (17:05 +0200)] 
util: print expected uid/gid in UTI_CheckDirPermissions()

9 years agosys_linux: allow setting IP_FREEBIND option in seccomp filter
Miroslav Lichvar [Wed, 9 Sep 2015 14:36:48 +0000 (16:36 +0200)] 
sys_linux: allow setting IP_FREEBIND option in seccomp filter

This is needed when chronyd is started with no allow directive, but the
NTP server socket is opened by the allow command later.

9 years agotest: extend compilation/001-features
Miroslav Lichvar [Wed, 9 Sep 2015 11:50:32 +0000 (13:50 +0200)] 
test: extend compilation/001-features

9 years agostubs: add CAM_OpenUnixSocket()
Miroslav Lichvar [Wed, 9 Sep 2015 11:48:53 +0000 (13:48 +0200)] 
stubs: add CAM_OpenUnixSocket()

It is needed to build with disabled cmdmon.

9 years agoconfigure: add --disable-scfilter option
Miroslav Lichvar [Wed, 9 Sep 2015 11:37:56 +0000 (13:37 +0200)] 
configure: add --disable-scfilter option

9 years agoconfigure: update chronyc feature list
Miroslav Lichvar [Wed, 9 Sep 2015 13:23:44 +0000 (15:23 +0200)] 
configure: update chronyc feature list

9 years agodoc: update section on isolated networks
Miroslav Lichvar [Wed, 9 Sep 2015 14:30:17 +0000 (16:30 +0200)] 
doc: update section on isolated networks

Since the NTPv4 update, the detection of synchronization loops based on
the refid prevents a server to initialize its clock from its clients
after restart. Remove that part from the recommended configuration.
Also, mention the time smoothing feature.

9 years agodoc: update for recent changes
Miroslav Lichvar [Tue, 8 Sep 2015 15:31:38 +0000 (17:31 +0200)] 
doc: update for recent changes

9 years agosys_linux: add support for seccomp filters
Miroslav Lichvar [Mon, 16 Jun 2014 14:21:25 +0000 (16:21 +0200)] 
sys_linux: add support for seccomp filters

The Linux secure computing (seccomp) facility allows a process to
install a filter in the kernel that will allow only specific system
calls to be made. The process is killed when trying to make other system
calls. This is useful to reduce the kernel attack surface and possibly
prevent kernel exploits when the process is compromised.

Use the libseccomp library to add rules and load the filter into the
kernel. Keep a list of system calls that are always allowed after
chronyd is initialized. Restrict arguments that may be passed to the
socket(), setsockopt(), fcntl(), and ioctl() system calls. Arguments
to socketcall(), which is used on some architectures as a multiplexer
instead of separate socket system calls, are not restricted for now.
The mailonchange directive is not allowed as it calls sendmail.

Calls made by the libraries that chronyd is using have to be covered
too. It's difficult to determine which system calls they need as it may
change after an upgrade and it may depend on their configuration (e.g.
resolver in libc). There are also differences between architectures. It
can all break very easily and is therefore disabled by default. It can
be enabled with the new -F option.

This is based on a patch from Andrew Griffiths <agriffit@redhat.com>.

9 years agomain: install signal handler sooner
Miroslav Lichvar [Fri, 4 Sep 2015 10:19:44 +0000 (12:19 +0200)] 
main: install signal handler sooner

9 years agodoc: fix typo in chronyd man page
Miroslav Lichvar [Fri, 4 Sep 2015 15:02:26 +0000 (17:02 +0200)] 
doc: fix typo in chronyd man page

9 years agortc: fix setting time from driftfile when RTC reading fails
Miroslav Lichvar [Thu, 3 Sep 2015 09:30:09 +0000 (11:30 +0200)] 
rtc: fix setting time from driftfile when RTC reading fails

Fix RTC_Linux_TimePreInit() to return 0 when the RTC device can be
opened, but reading its time fails to at least have the time restored
from the driftfile.

9 years agosys_macosx: reset drift removal timer after spike in offset_sd
Bryan Christianson [Fri, 28 Aug 2015 11:21:01 +0000 (23:21 +1200)] 
sys_macosx: reset drift removal timer after spike in offset_sd

When a large spike occurs in offset_sd the drift removal interval can be
set to an excessively long time, although what ever event caused the
perturbation has passed. At the next set_sync_status() we now compare
the expected drift removal interval with that currently in effect. If
they are significantly different, the current timer is cancelled and new
cycle started using the new drift removal interval.

9 years agosys_linux: always call TMX_SetLeap() in set_leap()
Miroslav Lichvar [Wed, 26 Aug 2015 12:45:36 +0000 (14:45 +0200)] 
sys_linux: always call TMX_SetLeap() in set_leap()

The optimization avoiding unnecessary setting of the kernel leap status
can cause a problem when something outside chronyd sets the status to
the new expected value. There will be no TMX_SetLeap() call which would
update the saved status and the kernel status will be overwritten with
the old (incorrect) value in a later TMX_*() call.

Always call TMX_SetLeap() to save the new value and for the log message
selection just check if a leap second has been applied.

9 years agoreference: call LCL_SetSystemLeap() only on leap changes
Miroslav Lichvar [Wed, 26 Aug 2015 12:42:14 +0000 (14:42 +0200)] 
reference: call LCL_SetSystemLeap() only on leap changes

9 years agoexamples: update for removed cmdmon authentication
Miroslav Lichvar [Wed, 26 Aug 2015 07:49:19 +0000 (09:49 +0200)] 
examples: update for removed cmdmon authentication

9 years agosys_macosx: add option to run chronyd as real-time process
Bryan Christianson [Mon, 24 Aug 2015 20:32:14 +0000 (08:32 +1200)] 
sys_macosx: add option to run chronyd as real-time process

Adds option -P to chronyd on MacOS X which can be used to enable the
thread time constraint scheduling policy. This near real-time scheduling
policy removes a 1usec bias from the 'System time' offset.

9 years agosources: add option to limit selection by root distance
Miroslav Lichvar [Tue, 25 Aug 2015 14:27:36 +0000 (16:27 +0200)] 
sources: add option to limit selection by root distance

Add maxdistance directive to set the maximum root distance the sources
are allowed to have to be selected. This is useful to reject NTPv4
sources that are no longer synchronized and report large dispersion.
The default value is 3 seconds.

9 years agoconfigure: add new options to disable dropping root privileges
Miroslav Lichvar [Tue, 25 Aug 2015 12:09:06 +0000 (14:09 +0200)] 
configure: add new options to disable dropping root privileges

9 years agosys_netbsd: allow running without root privileges
Miroslav Lichvar [Tue, 25 Aug 2015 10:15:58 +0000 (12:15 +0200)] 
sys_netbsd: allow running without root privileges

On NetBSD programs with write access to /dev/clockctl can adjust or set
the system clock without the root privileges. Add a function to drop the
privileges and check if the process has write access to the device to
get a more descriptive error message when the chrony uid/gid doesn't
match the owner of the device.

9 years agomain: open cmdmon and NTP internet sockets before dropping root
Miroslav Lichvar [Mon, 24 Aug 2015 15:15:31 +0000 (17:15 +0200)] 
main: open cmdmon and NTP internet sockets before dropping root

Call the CAM, NIO, NCR initialization functions and setup the access
restrictions before root is dropped. This will be needed on NetBSD,
where it's not possible to bind sockets to privileged ports without the
root privileges. Split the creation of the Unix domain command socket
from the CAM initialization to keep the chrony user as the owner of the
socket.

9 years agoconf: allow wildcard patterns in include directive
Miroslav Lichvar [Mon, 24 Aug 2015 13:08:39 +0000 (15:08 +0200)] 
conf: allow wildcard patterns in include directive

Use glob() to match and read multiple configuration files with one
include directive.

9 years agoconf: extend logging in CNF_ReadFile()
Miroslav Lichvar [Mon, 24 Aug 2015 12:57:39 +0000 (14:57 +0200)] 
conf: extend logging in CNF_ReadFile()

9 years agosys_linux: remove unused variables
Miroslav Lichvar [Mon, 24 Aug 2015 11:25:39 +0000 (13:25 +0200)] 
sys_linux: remove unused variables

9 years agocmdmon: update candm.h
Miroslav Lichvar [Thu, 20 Aug 2015 15:21:12 +0000 (17:21 +0200)] 
cmdmon: update candm.h

Remove the auth fields in the command request/reply and replace the
token and utoken fields with padding.

9 years agokeys: remove support for command key
Miroslav Lichvar [Thu, 20 Aug 2015 14:43:12 +0000 (16:43 +0200)] 
keys: remove support for command key

Without the cmdmon authentication, there is no need for command keys.

9 years agoclient: remove authentication support
Miroslav Lichvar [Thu, 20 Aug 2015 14:29:07 +0000 (16:29 +0200)] 
client: remove authentication support

Follow the removal of the server authentication support and remove also
the client support. The -a and -f options are now silently ignored to
not break scripts. The authhash and password commands print a warning,
but they don't return an error.

9 years agocmdmon: remove authentication support
Miroslav Lichvar [Mon, 13 Apr 2015 08:44:15 +0000 (10:44 +0200)] 
cmdmon: remove authentication support

With the new support for cmdmon over Unix domain sockets, authentication
is no longer necessary to authorize a client running on localhost with
the permissions of the root or chrony user/group. Remove the cmdmon
authentication support to simplify the code and significantly reduce the
attack surface of the protocol.

Only monitoring commands are now allowed remotely. Users that need to
configure chronyd remotely or locally without root/chrony permissions
are advised to use ssh and/or sudo.

9 years agocmdmon: allow unauthenticated commands from Unix domain socket
Miroslav Lichvar [Wed, 19 Aug 2015 16:33:18 +0000 (18:33 +0200)] 
cmdmon: allow unauthenticated commands from Unix domain socket

Allow all commands received from the Unix domain command socket (which
is accessible only by the root and chrony user/group), even when they
are not authenticated with the command key.

9 years agoclient: connect to Unix domain socket by default
Miroslav Lichvar [Wed, 19 Aug 2015 16:16:22 +0000 (18:16 +0200)] 
client: connect to Unix domain socket by default

The default value of the -h option is now
/var/run/chrony/chronyd.sock,127.0.0.1,::1.

9 years agoconfigure: add option to set default location of Unix domain sockets
Miroslav Lichvar [Wed, 19 Aug 2015 15:55:42 +0000 (17:55 +0200)] 
configure: add option to set default location of Unix domain sockets

9 years agoclient: reconnect with multiple addresses
Miroslav Lichvar [Wed, 19 Aug 2015 08:19:13 +0000 (10:19 +0200)] 
client: reconnect with multiple addresses

Allow multiple hostnames/addresses separated by comma to be specified
with the -h option. Hostnames are resolved to up to 16 addresses. When
connecting to an address fails or no reply is received, try the next
address in the list.

Set the default value for the -h option to 127.0.0.1,::1.

9 years agoclient: allow connecting to Unix domain sockets
Miroslav Lichvar [Tue, 18 Aug 2015 14:06:05 +0000 (16:06 +0200)] 
client: allow connecting to Unix domain sockets

If the specified hostname starts with /, consider it to be the path of
the chronyd Unix domain command socket. Create the client socket in the
same directory as the server socket (which is not accessible by others)
and change its permission to 0666 to allow chronyd running without root
privileges to send a reply. Remove the socket on exit.

9 years agoclient: connect socket
Miroslav Lichvar [Tue, 18 Aug 2015 11:35:18 +0000 (13:35 +0200)] 
client: connect socket

Call connect() on the socket to set the remote address and switch from
sendto()/recvfrom() to send()/recv(). Setting the IP_RECVERR option no
longer seems to be necessary in order to get ECONNREFUSED errors.

9 years agoclient: add -d option to print debug messages
Miroslav Lichvar [Tue, 18 Aug 2015 11:04:09 +0000 (13:04 +0200)] 
client: add -d option to print debug messages