]> git.ipfire.org Git - thirdparty/chrony.git/log
thirdparty/chrony.git
9 years agoutil: add function for IP address hashing
Miroslav Lichvar [Mon, 23 Nov 2015 14:24:33 +0000 (15:24 +0100)] 
util: add function for IP address hashing

Move the hashing function from find_slot() in ntp_sources to make it
available to clientlog and improve the hashing a bit.

9 years agocmdmon: tidy up declarations in read_from_cmd_socket()
Miroslav Lichvar [Thu, 26 Nov 2015 09:08:49 +0000 (10:08 +0100)] 
cmdmon: tidy up declarations in read_from_cmd_socket()

9 years agosys_macosx: tidy up includes
Bryan Christianson [Tue, 24 Nov 2015 09:07:58 +0000 (22:07 +1300)] 
sys_macosx: tidy up includes

Use "sysincl.h" in place of the common system include files

9 years agosys_macosx: drop root privileges
Bryan Christianson [Tue, 24 Nov 2015 08:01:59 +0000 (21:01 +1300)] 
sys_macosx: drop root privileges

Run chronyd as a non-privileged user, using the privops helper to
perform adjtime(), settimeofday() and bind() functions on its behalf.

9 years agoadd support for privilege separation
Bryan Christianson [Fri, 20 Nov 2015 10:43:19 +0000 (23:43 +1300)] 
add support for privilege separation

Privileged helper that will perform adjtime(), settimeofday(), bind() on
behalf of chronyd when running as non-root user.

9 years agosys_linux: allow ioctl(TCGETS) in seccomp filter
Miroslav Lichvar [Wed, 18 Nov 2015 11:42:38 +0000 (12:42 +0100)] 
sys_linux: allow ioctl(TCGETS) in seccomp filter

This seems to be needed to allow fopen() called on /dev/urandom to check
if it's a terminal.

9 years agoconf: don't allow invalid last refclock option
Miroslav Lichvar [Wed, 18 Nov 2015 11:21:23 +0000 (12:21 +0100)] 
conf: don't allow invalid last refclock option

9 years agontp: ignore poll in KoD RATE packets
Miroslav Lichvar [Mon, 16 Nov 2015 14:21:32 +0000 (15:21 +0100)] 
ntp: ignore poll in KoD RATE packets

The meaning of the poll value in KoD RATE packets is not currently
defined in the NTP specification (RFC 5905). In the reference NTP
implementation it signals the minimum acceptable polling interval to the
clients. In chrony the minimum poll is set to the KoD RATE poll if it's
larger, but not to a larger value than 10.

The problem is that ntpd as a server sets the KoD RATE poll to the
maximum of the client's poll and the configured rate limiting interval.
An attacker can send a burst of spoofed packets to the server to trigger
the client's request rate limit. When the client sends its next request
and the server responds with a KoD RATE packet, the client will set its
minimum poll to the current poll and it will no longer be able to switch
to a shorter poll when needed.

ntpd could be fixed to always set the KoD RATE poll to the rate limiting
interval. Unfortunately, ntpd as a client seems to depend on the current
behavior. It tries to follow the server poll and if the KoD RATE poll
was shorter than the current poll, the polling interval would be
reduced, defeating the purpose of KoD RATE. The server fix will probably
need to wait until clients are fixed and that could take a very long
time.

For now, ignore the poll value in KoD RATE packets. Just add an extra
delay based on the current poll to the next transmit timeout and stop an
ongoing burst.

9 years agodoc: update description of offline command
Miroslav Lichvar [Mon, 16 Nov 2015 13:50:57 +0000 (14:50 +0100)] 
doc: update description of offline command

Reachability and online/offline mode has no effect on source selection
since version 2.0.

9 years agontp: adjust initial delay for polling interval
Miroslav Lichvar [Mon, 16 Nov 2015 11:28:42 +0000 (12:28 +0100)] 
ntp: adjust initial delay for polling interval

First packet after setting a source to online was sent with constant
delay (0.2s). If the period in which the source was offline was shorter
than the current polling interval, the new packet was sent sooner than
it would be if the source wasn't switched to offline and back.

Don't reset the local tx timestamp when mode is changed. When starting
the initial transmit timeout, adjust the delay to make the interval
between the two packets at least as long as the current polling
interval.

9 years agosched: update timeout randomization
Miroslav Lichvar [Fri, 13 Nov 2015 15:08:02 +0000 (16:08 +0100)] 
sched: update timeout randomization

Use UTI_GetRandomBytes() instead of random() to calculate the random
part of the timeout. This was the only remaining use of random() in the
code and the srandom() call can be removed.

9 years agontp: don't reveal local clock in client packets
Miroslav Lichvar [Tue, 10 Nov 2015 16:59:49 +0000 (17:59 +0100)] 
ntp: don't reveal local clock in client packets

In client packets set the leap, stratum, reference ID, reference time,
root delay and root dispersion to constant values to not reveal the
state of the synchronization. Use precision 32 to make the receive and
transmit timestamps completely random and not reveal the local time.

9 years agoutil: rework timestamp fuzzing
Miroslav Lichvar [Tue, 10 Nov 2015 16:26:59 +0000 (17:26 +0100)] 
util: rework timestamp fuzzing

Use UTI_GetRandomBytes() instead of random() to generate random bits
below precision. Save the result in NTP_int64 in the network order and
allow precision in the full range from -32 to 32. With precision 32
the fuzzing now makes the timestamp completely random and can be used to
hide the time.

9 years agoutil: add function to generate random bytes
Miroslav Lichvar [Tue, 10 Nov 2015 15:46:40 +0000 (16:46 +0100)] 
util: add function to generate random bytes

Add a function to fill a buffer with random bytes which uses a better
PRNG than random(). Use arc4random() if it's available on the system.
Fall back to reading from /dev/urandom, which should be available on
all currently supported systems.

9 years agontp: don't keep client sockets open for longer than necessary
Miroslav Lichvar [Thu, 5 Nov 2015 15:43:40 +0000 (16:43 +0100)] 
ntp: don't keep client sockets open for longer than necessary

After sending a client packet, schedule a timeout to close the socket
at the time when all server replies would fail the delay test, so the
socket is not open for longer than necessary (e.g. when the server is
unreachable). With the default maxdelay of 3 seconds the timeout is 7
seconds.

9 years agontp: check remote interval in client mode
Miroslav Lichvar [Wed, 4 Nov 2015 14:47:40 +0000 (15:47 +0100)] 
ntp: check remote interval in client mode

For testA in the client mode require also that the time the server
needed to process the client request is not longer than 4 seconds.
With maximum peer delay this limits the interval in which the client can
accept a server reply.

9 years agosched: use shorter data type for timeout IDs
Miroslav Lichvar [Thu, 5 Nov 2015 12:14:57 +0000 (13:14 +0100)] 
sched: use shorter data type for timeout IDs

9 years agosched: don't allow SCH_RemoveTimeout() with invalid non-zero ID
Miroslav Lichvar [Tue, 10 Nov 2015 13:29:52 +0000 (14:29 +0100)] 
sched: don't allow SCH_RemoveTimeout() with invalid non-zero ID

9 years agosched: don't return currently used timeout ID
Miroslav Lichvar [Tue, 10 Nov 2015 13:41:19 +0000 (14:41 +0100)] 
sched: don't return currently used timeout ID

To avoid problems in the very unlikely case where a timeout is so long
and new IDs are allocated so frequently that they would have a chance
to overflow and catch up with it, make sure before returning new ID that
it's currently not in use.

9 years agosched: always return non-zero timeout ID
Miroslav Lichvar [Thu, 5 Nov 2015 13:29:11 +0000 (14:29 +0100)] 
sched: always return non-zero timeout ID

Timeout ID of zero can be now safely used to indicate that the timer is
not running. Remove the extra timer_running variables that were
necessary to track that.

9 years agosys_linux: allow more syscalls in seccomp filter
Miroslav Lichvar [Wed, 4 Nov 2015 13:53:00 +0000 (14:53 +0100)] 
sys_linux: allow more syscalls in seccomp filter

These seem to be needed by getaddrinfo() in default NSS configuration
on recent Fedora.

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.