diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index e14ca9636..aeba3acb7 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -26,7 +26,7 @@ jobs: - uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 id: meta with: - images: ghcr.io/pendulum-project/ntpd-rs + images: ghcr.io/trifectatechfoundation/statime tags: | type=sha type=semver,pattern={{version}} diff --git a/Cargo.toml b/Cargo.toml index 58b0404e4..dacfba8a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,10 +25,10 @@ resolver = "3" version = "2.0.0-alpha.20261113" edition = "2024" license = "Apache-2.0 OR MIT" -repository = "https://github.com/pendulum-project/ntpd-rs" -homepage = "https://github.com/pendulum-project/ntpd-rs" +repository = "https://github.com/trifectatechfoundation/statime" +homepage = "https://github.com/trifectatechfoundation/statime" readme = "./README.md" -description = "Full-featured implementation of NTP with NTS support" +description = "A full-featured time synchronization daemon, including NTP, NTS and CSPTP support." publish = true rust-version = "1.95" # MSRV diff --git a/Dockerfile b/Dockerfile index 9339bbba8..3e612ab18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,8 @@ RUN apt update \ WORKDIR /build COPY . /build -ARG NTPDRS_BUILD_FEATURES="" -ENV NTPDRS_BUILD_FEATURES="${NTPDRS_BUILD_FEATURES}" +ARG STATIME_BUILD_FEATURES="" +ENV STATIME_BUILD_FEATURES="${STATIME_BUILD_FEATURES}" # Run the build command. # Note that this mounts several cache directories to speed up subsequent builds. @@ -24,7 +24,7 @@ ENV NTPDRS_BUILD_FEATURES="${NTPDRS_BUILD_FEATURES}" RUN --mount=type=cache,target=/usr/local/cargo/git/db \ --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/build/target/ \ - cargo build --locked --release --features="${NTPDRS_BUILD_FEATURES}" \ + cargo build --locked --release --features="${STATIME_BUILD_FEATURES}" \ && mkdir -p /build/artifacts \ && cp target/release/statime-daemon /build/artifacts \ && cp target/release/statime /build/artifacts \ @@ -45,7 +45,7 @@ COPY --from=builder /build/artifacts/statime /usr/local/bin/statime COPY --from=builder /build/artifacts/statime-exporter /usr/local/bin/statime-exporter # Setup a user and group for the runner -ARG USER=ntpd-rs +ARG USER=statime ENV USER=${USER} ARG UID=10001 ENV UID=${UID} diff --git a/clock-steering/src/lib.rs b/clock-steering/src/lib.rs index 4a68ca4a0..5653667fd 100644 --- a/clock-steering/src/lib.rs +++ b/clock-steering/src/lib.rs @@ -1,6 +1,4 @@ //! Logic for steering OS clocks, aimed at NTP and PTP. -//! -//! This code is used in our implementations of NTP [ntpd-rs](https://github.com/pendulum-project/ntpd-rs) and PTP [statime](https://github.com/pendulum-project/statime). #[cfg(target_os = "linux")] mod linux_ioctls; diff --git a/docs/development/ca.md b/docs/development/ca.md index 19dab58c7..7205b513c 100644 --- a/docs/development/ca.md +++ b/docs/development/ca.md @@ -40,7 +40,7 @@ openssl req -x509 -new -nodes -key ca.key -sha256 -days 1825 -out ca.pem Here, `-days` is the number of days that this certificate is valid, the value in the command here results in a validity of five years. OpenSSL will ask for several pieces of information during the setup of the root certificate. The -ntpd-rs daemon does not impose particular requirements to the information in +Statime daemon does not impose particular requirements to the information in your root certificate, so feel free to leave things empty. Note that this command bases the certificate validity based on the current system time, so make sure that it is reasonably accurate. @@ -50,35 +50,35 @@ Once our CA root is setup, we can continue generating the server key and certificate. First, we start by generating a private key for the server: ```sh -openssl genrsa -out ntpd-rs.test.key 2048 +openssl genrsa -out statime.test.key 2048 ``` This time we omit the `-des3` CLI flag, so the private key is not protected with -a password. The ntpd-rs daemon does not support password encrypted private keys, +a password. The Statime daemon does not support password encrypted private keys, so we cannot password protect our private key. Once the private key is generated, we need to create a certificate signing request. We again can use openssl to do this for us: ```sh -openssl req -new -key ntpd-rs.test.key -out ntpd-rs.test.csr +openssl req -new -key statime.test.key -out statime.test.csr ``` -OpenSSL will once again ask for some information, but ntpd-rs once again does +OpenSSL will once again ask for some information, but Statime once again does not impose any requirements on the information requested, so feel free to leave things empty once again. With the certificate signing request generated, we now only need a little bit of configuration to tell the CA root how the generated -certificate will be used, to do this, create a file called `ntpd-rs.ext` with -the following contents, replacing the `ntpd-rs.test` domain name with your own +certificate will be used, to do this, create a file called `statime.ext` with +the following contents, replacing the `statime.test` domain name with your own domain name. -```ini title="/path/to/some/ca-data/ntpd-rs.ext" +```ini title="/path/to/some/ca-data/statime.ext" authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = keyEncipherment subjectAltName = @alt_names [alt_names] -DNS.1 = ntpd-rs.test +DNS.1 = statime.test ``` Note that the domain name does not actually have to exist, but it will be the @@ -86,18 +86,18 @@ domain name that clients somehow have to connect to (e.g. by setting an `/etc/hosts` entry). We now have enough information to generate a certificate: ```sh -openssl x509 -req -in ntpd-rs.test.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out ntpd-rs.test.crt -days 1825 -sha256 -extfile ntpd-rs.ext +openssl x509 -req -in statime.test.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out statime.test.crt -days 1825 -sha256 -extfile statime.ext ``` The above command gives the certificate a period validity of 5 years. If a different lifetime is desired, change the number following the `-days` argument to the number of days the certificate should be valid. The generated certificate -should be concatenated together with the CA certificate, as ntpd-rs needs the +should be concatenated together with the CA certificate, as Statime needs the full certificate chain in order to operate. We can use a simple command to do this: ```sh -cat ntpd-rs.test.crt ca.pem > ntpd-rs.test.chain.pem +cat statime.test.crt ca.pem > statime.test.chain.pem ``` ## Using the generated certificate @@ -110,13 +110,13 @@ following `[[nts-ke-server]]` section (or update an existing section): [[nts-ke-server]] listen = "[::]:4460" -certificate-chain-path = "/path/to/some/ca-data/ntpd-rs.test.chain.pem" -private-key-path = "/path/to/some/ca-data/ntpd-rs.test.key" +certificate-chain-path = "/path/to/some/ca-data/statime.test.chain.pem" +private-key-path = "/path/to/some/ca-data/statime.test.key" # ... ``` -Finally, restart your ntpd-rs daemon by running `systemctl restart ntpd-rs`. +Finally, restart your Statime daemon by running `systemctl restart statime`. Your server should now be ready to handle NTS! !!! Danger @@ -133,13 +133,13 @@ that you should only ever share the `ca.pem` file and never the `ca.key` file! In your client, now you will need to make sure that the domain name under which you reach the server is the same as the domain name for which you configured the server certificate. In our example above we used the domain name -`ntpd-rs.test`. If we wanted the server to be able to reach itself, we can +`statime.test`. If we wanted the server to be able to reach itself, we can simply add a `/etc/hosts` entry for this, like such: ```txt title="/etc/hosts" hl_lines="3" ... 127.0.0.1 localhost -127.0.0.1 ntpd-rs.test +127.0.0.1 statime.test ... ``` @@ -151,7 +151,7 @@ CA root certificate: [[source]] mode = "nts" -address = "ntpd-rs.test" +address = "statime.test" certificate-authority = "/path/to/some/ca-data/ca.pem" # ... diff --git a/docs/development/code-structure.md b/docs/development/code-structure.md index 21ea5e47f..740f4e5fa 100644 --- a/docs/development/code-structure.md +++ b/docs/development/code-structure.md @@ -1,10 +1,10 @@ # Code structure -This document gives a high-level overview of the structure of ntpd-rs. +This document gives a high-level overview of the structure of Statime. ## Crates -ntpd-rs is split into several crates with three goals in mind: +Statime is split into several crates with three goals in mind: - Split the logic of protocol handling from the details around asynchronous network handling @@ -13,9 +13,10 @@ ntpd-rs is split into several crates with three goals in mind: - Limit the scopes where we use unsafe code, ensuring that it is more straightforward to verify. -The main `statime-ntp` and `statime` crates are set up such that neither contains any -unsafe code. Unsafe code is limited to the (external) `timestamped-socket`, `clock-steering` and `pps-time` crates, -which are purposefully kept small and only offer a safe API. +The main `statime-ntp` and `statime` crates are set up such that neither +contains any unsafe code. Unsafe code is limited to the `timestamped-socket`, +`clock-steering` and `pps-time` crates, which are purposefully kept small and +only offer a safe API. ### statime-ntp @@ -33,20 +34,21 @@ ensure that source and steering logic is regularly called. ### timestamped-socket -The [`timestamped-socket` crate](https://github.com/pendulum-project/timestamped-socket) provides an async interface to the Linux kernel's +The `timestamped-socket` crate provides an async interface to the Linux kernel's kernel-level network timestamping functionality. It wraps the system calls for configuring kernel-level timestamping and for retrieving the actual timestamps. Touching the network layer uses `libc` and is inherently unsafe. ### clock-steering -The [`clock-steering` crate](https://github.com/pendulum-project/clock-steering) wraps the system calls needed for controlling the system -clock. Touching the system clock uses `libc` and is inherently unsafe. +The `clock-steering` crate wraps the system calls needed for controlling the +system clock. Touching the system clock uses `libc` and is inherently unsafe. ### pps-time -The [`pps-time` crate](https://github.com/pendulum-project/pps-time) wraps the system calls needed to interact with a PPS device. To -interact with PPS devices ioctl system calls are used, which uses `libc` and is inherently unsafe. +The `pps-time` crate wraps the system calls needed to interact with a PPS +device. To interact with PPS devices ioctl system calls are used, which uses +`libc` and is inherently unsafe. ### statime diff --git a/docs/development/flowdiagram.svg b/docs/development/flowdiagram.svg index 3495e529a..c87934c1c 100644 --- a/docs/development/flowdiagram.svg +++ b/docs/development/flowdiagram.svg @@ -25,11 +25,11 @@
-
ntpd-rs
+
Statime
- ntpd-rs + Statime diff --git a/docs/development/further-reading.md b/docs/development/further-reading.md index e45c961a1..957a9200a 100644 --- a/docs/development/further-reading.md +++ b/docs/development/further-reading.md @@ -2,10 +2,10 @@ - (Link) NTP at the [IETF Datatracker][1] - (Video) Introduction to the project: [NTP for the modern era @ GOSIM][2] -- (Paper) Clock steering and selection algorithm in ntpd-rs: [docs/algorithm/algorithm.pdf][3] +- (Paper) Clock steering and selection algorithm: [docs/algorithm/algorithm.pdf][3] - (Link) [NTP Pool website][4] [1]: https://datatracker.ietf.org/wg/ntp/documents/ [2]: https://www.youtube.com/watch?v=p_zC5zSRRng -[3]: https://github.com/pendulum-project/ntpd-rs/blob/main/docs/algorithm/algorithm.pdf +[3]: https://github.com/trifectatechfoundation/statime/blob/main/docs/algorithm/algorithm.pdf [4]: https://www.ntppool.org diff --git a/docs/development/threat-model.md b/docs/development/threat-model.md index 55241b0a9..e31bcd65b 100644 --- a/docs/development/threat-model.md +++ b/docs/development/threat-model.md @@ -14,11 +14,11 @@ The used methodology is entirely manual, but is derived from We model the following actors: -- System Admin: Administrator of the system running ntpd-rs -- System User: Non-administrator user of the system running ntpd-rs +- System Admin: Administrator of the system running Statime +- System User: Non-administrator user of the system running Statime - Reference Source: A remote time server we use as a source for our time. - External Client: A remote user that is allowed to use this instance of - ntpd-rs to receive time. + Statime to receive time. - Anonymous: Any other party ### Assets @@ -432,7 +432,7 @@ We model the following assets: ![](flowdiagram.svg) -- The security boundaries between the admin and system users and ntpd-rs run +- The security boundaries between the admin and system users and Statime run through the Unix sockets used for communication. - The security boundaries for reference sources and external clients run through the network sockets used for communication. diff --git a/docs/examples/conf/statime-OpenRC-confd b/docs/examples/conf/statime-OpenRC-confd index ca2908842..87e44dfab 100644 --- a/docs/examples/conf/statime-OpenRC-confd +++ b/docs/examples/conf/statime-OpenRC-confd @@ -1,8 +1,8 @@ -# The configuration file path for the ntpd-daemon where settings for the -# configuration of ntpd-rs are stored +# The configuration file path for the daemon where settings for the +# configuration of Statime are stored CONFIG="/etc/statime/statime.toml" # The unprivileged user and group to run as # do not change unless you know what you're doing -USER=ntpd-rs -GROUP=ntpd-rs +USER=statime +GROUP=statime diff --git a/docs/examples/conf/statime-OpenRC-initd b/docs/examples/conf/statime-OpenRC-initd index 5b9d9d49e..a7b9d95fb 100644 --- a/docs/examples/conf/statime-OpenRC-initd +++ b/docs/examples/conf/statime-OpenRC-initd @@ -3,16 +3,16 @@ supervisor=supervise-daemon -name=ntpd-rs -description="Network Time Protocol (ntpd-rs)" +name=statime +description="Time Synchronization Daemon (Statime)" command=/usr/bin/statime-daemon command_args="-c $CONFIG" -# log the stderror and stdout to /var/log/ntpd-rs.log +# log the stderror and stdout to /var/log/statime.log output_log=/var/log/${RC_SVCNAME}.log error_log=/var/log/${RC_SVCNAME}.log if [ $RC_UNAME = "Linux" ]; then - # on linux ntpd-rs can run unprivileged due to the capabilities below + # on linux Statime can run unprivileged due to the capabilities below command_user="${USER}:${GROUP}" capabilities="^cap_net_bind_service,^cap_sys_time" no_new_privs=1 @@ -52,7 +52,7 @@ stop_pre() { return 0 } - + reload() { checkconfig || return $? ebegin "Reloading $RC_SVCNAME" diff --git a/docs/examples/conf/statime-metrics.service b/docs/examples/conf/statime-metrics.service index 0195924b4..41ce00dde 100644 --- a/docs/examples/conf/statime-metrics.service +++ b/docs/examples/conf/statime-metrics.service @@ -1,14 +1,14 @@ [Unit] -Description=Network Time Service (ntpd-rs) metrics exporter -Documentation=https://github.com/pendulum-project/ntpd-rs +Description=Time Synchronization Daemon (Statime) metrics exporter +Documentation=https://github.com/trifectatechfoundation/statime [Service] Type=notify Restart=always ExecStart=/usr/bin/statime-metrics Environment="RUST_LOG=info" -User=ntpd-rs-observe -Group=ntpd-rs-observe +User=statime-observe +Group=statime-observe [Install] WantedBy=multi-user.target diff --git a/docs/examples/conf/statime-metrics.strict.service b/docs/examples/conf/statime-metrics.strict.service index ab030f46e..c5136734f 100644 --- a/docs/examples/conf/statime-metrics.strict.service +++ b/docs/examples/conf/statime-metrics.strict.service @@ -1,14 +1,14 @@ [Unit] -Description=Network Time Service (ntpd-rs) metrics exporter -Documentation=https://github.com/pendulum-project/ntpd-rs +Description=Time Synchronization Daemon (Statime) metrics exporter +Documentation=https://github.com/trifectatechfoundation/statime [Service] Type=notify Restart=always ExecStart=/usr/bin/statime-metrics Environment="RUST_LOG=info" -User=ntpd-rs-observe -Group=ntpd-rs-observe +User=statime-observe +Group=statime-observe NoNewPrivileges=yes AmbientCapabilities= diff --git a/docs/examples/conf/statime.service b/docs/examples/conf/statime.service index 16643e61d..e91440e5a 100644 --- a/docs/examples/conf/statime.service +++ b/docs/examples/conf/statime.service @@ -1,6 +1,6 @@ [Unit] -Description=Network Time Service (ntpd-rs) -Documentation=https://github.com/pendulum-project/ntpd-rs +Description=Time Synchronization Daemon (Statime) +Documentation=https://github.com/trifectatechfoundation/statime After=network-online.target Wants=network-online.target Conflicts=systemd-timesyncd.service ntp.service chrony.service @@ -10,9 +10,9 @@ Type=notify Restart=no ExecStart=/usr/bin/statime-daemon Environment="RUST_LOG=info" -RuntimeDirectory=ntpd-rs -User=ntpd-rs -Group=ntpd-rs +RuntimeDirectory=statime +User=statime +Group=statime AmbientCapabilities=CAP_SYS_TIME CAP_NET_BIND_SERVICE [Install] diff --git a/docs/examples/conf/statime.strict.service b/docs/examples/conf/statime.strict.service index cfe90e6e8..720810ddb 100644 --- a/docs/examples/conf/statime.strict.service +++ b/docs/examples/conf/statime.strict.service @@ -1,6 +1,6 @@ [Unit] -Description=Network Time Service (ntpd-rs) -Documentation=https://github.com/pendulum-project/ntpd-rs +Description=Time Synchronization Daemon (Statime) +Documentation=https://github.com/trifectatechfoundation/statime After=network-online.target Wants=network-online.target Conflicts=systemd-timesyncd.service ntp.service chrony.service @@ -10,20 +10,20 @@ Type=notify Restart=no ExecStart=/usr/bin/statime-daemon Environment="RUST_LOG=info" -User=ntpd-rs -Group=ntpd-rs +User=statime +Group=statime NoNewPrivileges=yes AmbientCapabilities=CAP_SYS_TIME CapabilityBoundingSet=CAP_SYS_TIME ## Sockets live in the runtime directory -RuntimeDirectory=ntpd-rs +RuntimeDirectory=statime RuntimeDirectoryMode=0755 -## Configuration directory is read by both ntpd-rs and ntpd-rs-metrics +## Configuration directory is read by both statime and statime-metrics ## No keys should be stored here -ConfigurationDirectory=ntpd-rs +ConfigurationDirectory=statime ConfigurationDirectoryMode=0555 ## (optional) When running as server @@ -31,8 +31,8 @@ AmbientCapabilities=CAP_NET_BIND_SERVICE CapabilityBoundingSet=CAP_NET_BIND_SERVICE ## (optional) When preserving NTS key materials storage -## Requires setting state in /var/lib/ntpd-rs subfolder -StateDirectory=ntpd-rs +## Requires setting state in /var/lib/statime subfolder +StateDirectory=statime StateDirectoryMode=0700 ## Device management diff --git a/docs/examples/conf/statime.toml.default b/docs/examples/conf/statime.toml.default index 1ae596a1f..dd7081dd2 100644 --- a/docs/examples/conf/statime.toml.default +++ b/docs/examples/conf/statime.toml.default @@ -1,5 +1,5 @@ [observability] -# You can configure ntpd-rs with different output levels of logging information +# You can configure Statime with different output levels of logging information # Basic values for this are `trace`, `debug`, `info`, `warn` and `error`. log-level = "info" ## Using the observe socket you can retrieve statistical information about the @@ -38,7 +38,7 @@ count = 4 #type = "ntp" #listen = "[::]:123" -## Below are configured various thresholds beyond which ntpd-rs will not +## Below are configured various thresholds beyond which Statime will not ## change the system clock. CHANGE THESE TO MATCH YOUR SECURITY NEEDS! [system-clock] # The maximum step size (in seconds) of a single step during normal operation diff --git a/docs/guide/exporting-metrics.md b/docs/guide/exporting-metrics.md index a9148d791..04c2eeb50 100644 --- a/docs/guide/exporting-metrics.md +++ b/docs/guide/exporting-metrics.md @@ -1,12 +1,12 @@ # Exporting metrics -Ntpd-rs supports exporting key operational metrics to an external [prometheus](https://prometheus.io/) instance. +Statime supports exporting key operational metrics to an external [prometheus](https://prometheus.io/) instance. ## Installed from package -If ntpd-rs was installed from the packages distributed by us, the default configuration will already have enabled the observation socket. Furthermore, these packages contain a systemd unit file that enables the metrics exporter with a reasonable configuration. This can be enabled with +If Statime was installed from the packages distributed by us, the default configuration will already have enabled the observation socket. Furthermore, these packages contain a systemd unit file that enables the metrics exporter with a reasonable configuration. This can be enabled with ```sh -sudo systemctl enable --now ntpd-rs-metrics +sudo systemctl enable --now statime-metrics ``` After enabling the metrics exporter, a prometheus metrics dataset will be served on `127.0.0.1:9975/metrics` by default. This can be adjusted with the following configuration section in [statime.toml](../man/statime.toml.5.md#observability) to expose this to Prometheus: @@ -119,7 +119,7 @@ ntp_server_nts_nak_packets_total{listen_address="0.0.0.0:123"} 0 When installed through cargo or from source, two things need to be configured manually: -- Enable the observability socket in the ntpd-rs configuration. +- Enable the observability socket in the Statime configuration. - Configure the system to run statime-metrics as a service. The observability socket can be enabled by adding the following to the configuration: @@ -131,17 +131,17 @@ observation-path = "/var/run/statime/observe" Next, configure your system to run the statime-metrics binary as a service. For systemd based systems, an example is provided below. ```ini [Unit] -Description=Network Time Service (ntpd-rs) metrics exporter -Documentation=https://github.com/pendulum-project/ntpd-rs +Description=Time Synchronization Daemon (Statime) metrics exporter +Documentation=https://github.com/trifectatechfoundation/statime [Service] Type=notify Restart=yes ExecStart=/usr/bin/statime-metrics Environment="RUST_LOG=info" -RuntimeDirectory=ntpd-rs-observe -User=ntpd-rs-observe -Group=ntpd-rs-observe +RuntimeDirectory=statime-observe +User=statime-observe +Group=statime-observe [Install] WantedBy=multi-user.target diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index ce5190a07..86e3a9641 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -1,14 +1,14 @@ # Getting started -Ntpd-rs is an implementation of the NTP protocol. It aims to synchronize your system's clock to time received from the internet. It can also, when [configured as server](server-setup.md), provide time to other machines on the network. +Statime is an implementation of the NTP protocol. It aims to synchronize your system's clock to time received from the internet. It can also, when [configured as server](server-setup.md), provide time to other machines on the network. ## Installation -Installation instructions for your system can be found in the [installation guide](installation.md). For first time users, we strongly recommend using either your OS package repository packages, or the packages we provide. If you have installed ntpd-rs from source, and you have installed files in different locations than the default, you may need to modify the instructions below. +Installation instructions for your system can be found in the [installation guide](installation.md). For first time users, we strongly recommend using either your OS package repository packages, or the packages we provide. If you have installed statime from source, and you have installed files in different locations than the default, you may need to modify the instructions below. ## Checking the synchronization. -The default configuration for ntpd-rs sets it up to synchronize with four servers chosen from [the NTP pool](https://www.ntppool.org). We can check its synchronization status using: +The default configuration for statime sets it up to synchronize with four servers chosen from [the NTP pool](https://www.ntppool.org). We can check its synchronization status using: ```sh statime status ``` @@ -46,7 +46,7 @@ The final section is empty, but if we were running a server, it would show stati ## Configuring a custom time source -The sources ntpd-rs uses to get the current time can be configured in the `/etc/statime/statime.toml` configuration file. Suppose that, in addition to the sources from the NTP pool, we also always want to use two sources from the [time.nl](https://time.nl) pool. To do this, we add the following lines to the configuration file: +The sources Statime uses to get the current time can be configured in the `/etc/statime/statime.toml` configuration file. Suppose that, in addition to the sources from the NTP pool, we also always want to use two sources from the [time.nl](https://time.nl) pool. To do this, we add the following lines to the configuration file: ```toml [[source]] mode = "pool" @@ -54,7 +54,7 @@ address = "ntp.time.nl" count = 2 ``` -After restarting the daemon (using `sudo systemctl restart ntpd-rs` if you are using Linux) and waiting a bit for it to synchronize, the status now looks like +After restarting the daemon (using `sudo systemctl restart statime` if you are using Linux) and waiting a bit for it to synchronize, the status now looks like ``` Synchronization status: Dispersion: 0.000123s, Delay: 0.005496s @@ -96,5 +96,5 @@ can take a look at [using NTS](nts.md). Setting up your own time server is explained in our [server setup guide](server-setup.md). -When operating ntpd-rs as part of a larger critical system, you may also be -interested in our [guidance on hardening ntpd-rs](security-guidance.md). +When operating Statime as part of a larger critical system, you may also be +interested in our [guidance on hardening Statime](security-guidance.md). diff --git a/docs/guide/gps-pps.md b/docs/guide/gps-pps.md index c05e054a4..095b5e1ae 100644 --- a/docs/guide/gps-pps.md +++ b/docs/guide/gps-pps.md @@ -1,21 +1,21 @@ # GPS / PPS time sources ## GPSd time source -Instead of using another NTP server as a time source, it is also possible to use time data from [GPSd](https://gpsd.gitlab.io/gpsd/) as a time source for ntpd-rs. +Instead of using another NTP server as a time source, it is also possible to use time data from [GPSd](https://gpsd.gitlab.io/gpsd/) as a time source for Statime. GPSd is able to interpret GPS signals from a GPS receiver, from which it can derive the current time. -To provide this information, gpsd tries to open a socket at `/run/chrony.XXXX.sock`, where `XXXX` is replaced with the device name of the GPS device. When running ntpd-rs with reduced permissions, this socket cannot be created by ntpd-rs. We therefore have to configure systemd (or an equivalent startup daemon) to create a symlink to a folder ntpd-rs can create the socket in. We recommend linking to `/run/statime/chrony.XXXX.sock`, which can be done with the following systemd unit: +To provide this information, gpsd tries to open a socket at `/run/chrony.XXXX.sock`, where `XXXX` is replaced with the device name of the GPS device. When running Statime with reduced permissions, this socket cannot be created by Statime. We therefore have to configure systemd (or an equivalent startup daemon) to create a symlink to a folder Statime can create the socket in. We recommend linking to `/run/statime/chrony.XXXX.sock`, which can be done with the following systemd unit: ```ini [Unit] Description=GPSD Socket Shim -Documentation=https://github.com/pendulum-project/ntpd-rs +Documentation=https://github.com/trifectatechfoundation/statime [Service] Type=oneshot ExecStart=/bin/bash -c "ln -s /run/statime/chrony.XXXX.sock /run/chrony.XXXX.sock" ``` -GPSd can then be added as a time source for ntpd-rs by adding the following to the configuration: +GPSd can then be added as a time source for Statime by adding the following to the configuration: ```toml [[source]] mode = "sock" @@ -23,26 +23,26 @@ path = "/run/statime/chrony.XXXX.sock" precision = 1e-3 ``` -For socket sources such as a GPS device from gpsd, ntpd-rs is unable to estimate the uncertainty of the timing data. Therefore, you must provide an estimate (corresponding to 1 standard deviation) of this noise yourself through the `precision` field. For typical GPS receivers, an uncertainty somewhere in the range of 1 to 100 ms is reasonable. +For socket sources such as a GPS device from gpsd, Statime is unable to estimate the uncertainty of the timing data. Therefore, you must provide an estimate (corresponding to 1 standard deviation) of this noise yourself through the `precision` field. For typical GPS receivers, an uncertainty somewhere in the range of 1 to 100 ms is reasonable. In addition, an accuracy can also be configured for sock sources. This allows you to deprioritize sock sources which have larger offset, or for whom the quality of the GPS signal is not particularly good. These are then still used for consensus of what time it should be, but have far less impact on the actual synchronization. ### Setting up GPSd -In order for GPSd to connect to ntpd-rs, GPSd must start after ntpd-rs and after the socket shim has been created. This is because ntpd-rs needs to create the socket for GPSd, which can only find the socket if it exists at the moment GPSd starts. +In order for GPSd to connect to Statime, GPSd must start after Statime and after the socket shim has been created. This is because Statime needs to create the socket for GPSd, which can only find the socket if it exists at the moment GPSd starts. GPSd can be manually restarted using: ```sh sudo systemctl restart gpsd.socket ``` -Systemd can be told to enforce such a starting order using the [`Wants`, `Before` and `After` keys in the `Unit` section](https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#%5BUnit%5D%20Section%20Options). It is recommended to modify the unit files for ntpd-rs and gpsd through `systemctl edit` when making these changes. +Systemd can be told to enforce such a starting order using the [`Wants`, `Before` and `After` keys in the `Unit` section](https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#%5BUnit%5D%20Section%20Options). It is recommended to modify the unit files for Statime and gpsd through `systemctl edit` when making these changes. For help with setting up GPSd on a Raspberry Pi, see for example [this guide](https://n4bfr.com/2020/04/raspberry-pi-with-chrony/2/). ## Pulse Per Second (PPS) -Ntpd-rs also supports using PPS timing data via Kernel PPS, based on [RFC 2783](https://datatracker.ietf.org/doc/html/rfc2783). +Statime also supports using PPS timing data via Kernel PPS, based on [RFC 2783](https://datatracker.ietf.org/doc/html/rfc2783). -Here is an example configuration of a 1 PPS device in ntpd-rs: +Here is an example configuration of a 1 PPS device in Statime: ```toml [[source]] mode = "pps" @@ -59,11 +59,11 @@ precision = 1e-7 period = 0.1 ``` -You may need to provide the user that ntpd-rs will run as the permissions to read from this device. Assuming you installed from our packages, you can do this by adding the following udev rule (typically put in a place like `/etc/udev/rules.d/99-ntpd-rs-pps.rules`): +You may need to provide the user that Statime will run as the permissions to read from this device. Assuming you installed from our packages, you can do this by adding the following udev rule (typically put in a place like `/etc/udev/rules.d/99-statime-pps.rules`): ``` -KERNEL=="pps0", GROUP="ntpd-rs", MODE="0640" +KERNEL=="pps0", GROUP="statime", MODE="0640" ``` -This rule ensures that the pps0 device allows read access from the `ntpd-rs` group once it is created by udev at boot. To apply it without having to reboot run +This rule ensures that the pps0 device allows read access from the `statime` group once it is created by udev at boot. To apply it without having to reboot run ```sh sudo udevadm control --reload sudo udevadm trigger /dev/pps0 diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 760743bbe..bbb827698 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -2,11 +2,11 @@ ## Installers & Packages -The recommended way of installing ntpd-rs is through an installer or package manager for your system. +The recommended way of installing Statime is through an installer or package manager for your system. ### Linux -We recommend the packages from our [release page](https://github.com/pendulum-project/ntpd-rs/releases). The package takes care of putting the configuration in the right place and setting up the recommended users and permissions. The default configuration file is located at `/etc/statime/statime.toml` +We recommend the packages from our [release page](https://github.com/trifectatechfoundation/statime/releases). The package takes care of putting the configuration in the right place and setting up the recommended users and permissions. The default configuration file is located at `/etc/statime/statime.toml` On a Debian based Linux, the `.deb` package can be installed with ```console @@ -16,12 +16,12 @@ $ sudo apt install /path/to/deb/file.deb On a Red Hat based Linux, the `.rpm` package can be installed with ```console $ sudo dnf install /path/to/rpm/file.rpm -$ sudo systemctl start ntpd-rs +$ sudo systemctl start statime ``` ### FreeBSD -The ntpd-rs binary is available on [ports](https://www.freshports.org/net/ntpd-rs/). The default configuration file is located at `%%ETCDIR%%/statime.toml`, which typically resolves to `/usr/local/etc/statime/statime.toml`. +The Statime binary is available on [ports](https://www.freshports.org/net/ntpd-rs/). The default configuration file is located at `%%ETCDIR%%/statime.toml`, which typically resolves to `/usr/local/etc/statime/statime.toml`. ### macOS @@ -30,10 +30,10 @@ There is no package or installer for macOS at the moment. ## Install From Source On platforms without an installer or package, building from source is an option. -ntpd-rs is written in rust. We strongly recommend using [rustup] to install a +Statime is written in rust. We strongly recommend using [rustup] to install a rust toolchain, because the version provided by system package managers tends to be out of date. Be sure to use a recent version of the rust compiler. To build -ntpd-rs run +Statime run ```sh cargo build --release @@ -69,18 +69,18 @@ It is by far the easiest to have your operating system and standard tools take c - ensure that no competing NTP daemon is running - ensure that the daemon is started on startup -- handling the ntpd-rs logs +- handling the Statime logs Below are configurations for Linux (using `SystemD`) and FreeBSD (using a .rc file). #### Linux + SystemD -This is the SystemD configuration used by the ntpd-rs Linux installer. +This is the SystemD configuration used by the Statime Linux installer. ```ini [Unit] -Description=Rust Network Time Service -Documentation=https://github.com/pendulum-project/ntpd-rs +Description=Time Synchronization Daemon (Statime) +Documentation=https://github.com/trifectatechfoundation/statime After=network-online.target Wants=network-online.target Conflicts=systemd-timesyncd.service ntp.service chrony.service @@ -90,9 +90,9 @@ Type=notify Restart=no ExecStart=/usr/local/bin/statime-daemon Environment="RUST_LOG=info" -RuntimeDirectory=ntpd-rs -User=ntpd-rs -Group=ntpd-rs +RuntimeDirectory=statime +User=statime +Group=statime AmbientCapabilities=CAP_SYS_TIME # Note: when running a server on the default port 123, permissions to bind to # low (<1024) ports is also needed, which can be given with @@ -102,18 +102,18 @@ AmbientCapabilities=CAP_SYS_TIME WantedBy=multi-user.target ``` -Note that this requires an ntpd-rs user to be present on the system, which can be created with +Note that this requires a `statime` user to be present on the system, which can be created with ```sh -sudo adduser --system --home /var/lib/statime/ --group ntpd-rs +sudo adduser --system --home /var/lib/statime/ --group statime ``` or if your system doesn't have adduser ```sh -sudo useradd --home-dir /var/lib/statime --system --create-home --user-group ntpd-rs +sudo useradd --home-dir /var/lib/statime --system --create-home --user-group statime ``` This user must have access to the configuration folder: ```sh -sudo chown ntpd-rs:ntpd-rs /etc/statime/statime.toml +sudo chown statime:statime /etc/statime/statime.toml sudo chmod 0644 /etc/nstatime/statime.toml ``` @@ -138,7 +138,7 @@ load_rc_config $name ntp_daemon_enable=${ntp_daemon_enable-"NO"} ntp_daemon_config=${ntp_daemon_config-"%%ETCDIR%%/statime.toml"} -ntp_daemon_socket=${ntp_daemon_socket-"/var/run/ntpd-rs"} +ntp_daemon_socket=${ntp_daemon_socket-"/var/run/statime"} command="/usr/bin/true" procname="/usr/sbin/daemon" diff --git a/docs/guide/migrating-chrony.md b/docs/guide/migrating-chrony.md index 778947817..55035cf46 100644 --- a/docs/guide/migrating-chrony.md +++ b/docs/guide/migrating-chrony.md @@ -1,12 +1,12 @@ # Migrating from chrony -Both chrony and ntpd-rs can serve a similar role on Unix systems. This guide aims to help those migrating machines currently running chrony to ntpd-rs. We assume some experience with the [chrony configuration format](https://chrony-project.org/doc/4.3/chrony.conf.html). A user with no or little chrony experience may be better off following our [getting started guide](getting-started.md). +Both chrony and Statime can serve a similar role on Unix systems. This guide aims to help those migrating machines currently running chrony to Statime. We assume some experience with the [chrony configuration format](https://chrony-project.org/doc/4.3/chrony.conf.html). A user with no or little chrony experience may be better off following our [getting started guide](getting-started.md). -Before we start with the specifics on how to convert individual directives, first a few notes. In contrast with the chrony configuration format, which acts like a list of commands to the client, the ntpd-rs configuration is a [TOML](https://toml.io/) file. In particular, this means configuration is done by giving values for properties. As such, fields cannot be repeated unless they are part of a list, such as with the `[[source]]` sections and `[[server]]` sections. Comments can be added by starting them with a `#`. The remainder of the line is then ignored. +Before we start with the specifics on how to convert individual directives, first a few notes. In contrast with the chrony configuration format, which acts like a list of commands to the client, the Statime configuration is a [TOML](https://toml.io/) file. In particular, this means configuration is done by giving values for properties. As such, fields cannot be repeated unless they are part of a list, such as with the `[[source]]` sections and `[[server]]` sections. Comments can be added by starting them with a `#`. The remainder of the line is then ignored. -Please note that for some of the settings below, ntpd-rs and chrony use different defaults. When converting a configuration, please pay particular attention to `minsources`/`minimum-agreeing-sources`, `maxstep` and the corresponding `-panic-thresholds`, and any settings for NTS server functionality. Validation of the resulting ntpd-rs configuration can be done with `statime validate -c `, which should at least catch the most egregious errors. +Please note that for some of the settings below, Statime and chrony use different defaults. When converting a configuration, please pay particular attention to `minsources`/`minimum-agreeing-sources`, `maxstep` and the corresponding `-panic-thresholds`, and any settings for NTS server functionality. Validation of the resulting Statime configuration can be done with `statime validate -c `, which should at least catch the most egregious errors. -This guide does not go into detail on all of chrony's configuration directives, but rather focusses on those most important for successful migration. If a directive is not mentioned here, there may still be ntpd-rs options in the [configuration reference](../man/statime.toml.5.md) that achieve the desired effect. Note that not all functionality of chrony is currently supported, a short overview of major differences is given [at the end of this document](#non-supported-features) +This guide does not go into detail on all of chrony's configuration directives, but rather focusses on those most important for successful migration. If a directive is not mentioned here, there may still be Statime options in the [configuration reference](../man/statime.toml.5.md) that achieve the desired effect. Note that not all functionality of chrony is currently supported, a short overview of major differences is given [at the end of this document](#non-supported-features) ## Time sources @@ -32,60 +32,60 @@ mode="nts" address="
" ``` -If the server directive contains poll limits (`maxpoll` or `minpoll`), these cannot be specified on a per-server basis in ntpd-rs. The best approach is to determine values acceptable for all time sources and apply these via source defaults: +If the server directive contains poll limits (`maxpoll` or `minpoll`), these cannot be specified on a per-server basis in Statime. The best approach is to determine values acceptable for all time sources and apply these via source defaults: ```toml [source-defaults] poll-interval-limits = { min = , max = } initial-poll-interval = ``` -There is no support for bursting in ntpd-rs yet. When any bursting directive (`burst` or `iburst`) is present, these usually can be ignored, although if custom poll limits are in place, these may need to be rethought. +There is no support for bursting in Statime yet. When any bursting directive (`burst` or `iburst`) is present, these usually can be ignored, although if custom poll limits are in place, these may need to be rethought. -For NTS, if a custom certificate set is configured for a source via the `certset` directive, these can be provided via the ntpd-rs `certificate_authority` option. This expects a path to a file containing all the accepted root certificates for the source accepted in addition to the system certificates. +For NTS, if a custom certificate set is configured for a source via the `certset` directive, these can be provided via the Statime `certificate_authority` option. This expects a path to a file containing all the accepted root certificates for the source accepted in addition to the system certificates. -ntpd-rs has no equivalent of chrony's `nocerttimecheck` directive. Certificates presented by NTS key exchange servers are always checked against the current system time, including their activation and expiration times. On systems without a (working) real time clock, the system time at boot may lie outside the validity period of the server certificates, in which case NTS sources cannot be used until the clock has been set by other means. Possible approaches for such systems are: +Statime has no equivalent of chrony's `nocerttimecheck` directive. Certificates presented by NTS key exchange servers are always checked against the current system time, including their activation and expiration times. On systems without a (working) real time clock, the system time at boot may lie outside the validity period of the server certificates, in which case NTS sources cannot be used until the clock has been set by other means. Possible approaches for such systems are: - Restore an approximate time early during boot, for example with `fake-hwclock` or the clock file mechanism of `systemd-timesyncd`, so that the clock is at least as recent as the last shutdown. - Configure additional non-NTS sources that allow the clock to be set initially. Note that this reintroduces the risk of unauthenticated time sources that NTS is meant to protect against, so take this into account when choosing `minimum-agreeing-sources` and the panic thresholds. ### Pool directives -Pools configured via the pool directive can be added to the ntpd-rs configuration via +Pools configured via the pool directive can be added to the Statime configuration via ```toml [[pool]] mode="pool" address="
" ``` -If the pool directive specifies `maxsources`, this value can be configured in ntpd-rs via the `count` property. The default (4) is the same between ntpd-rs and chrony. +If the pool directive specifies `maxsources`, this value can be configured in Statime via the `count` property. The default (4) is the same between Statime and chrony. -If the pool directive contains poll limits (`maxpoll` or `minpoll`), these cannot be specified on a per-server basis in ntpd-rs. The best approach is to determine values acceptable for all time sources and apply these via source defaults: +If the pool directive contains poll limits (`maxpoll` or `minpoll`), these cannot be specified on a per-server basis in Statime. The best approach is to determine values acceptable for all time sources and apply these via source defaults: ```toml [source-defaults] poll-interval-limits = { min = , max = } initial-poll-interval = ``` -There is currently no support for bursting in ntpd-rs. When any bursting option (`burst` or `iburst`) is present, these usually can be ignored, although if custom poll limits are in place, these may need to be relaxed. +There is currently no support for bursting in Statime. When any bursting option (`burst` or `iburst`) is present, these usually can be ignored, although if custom poll limits are in place, these may need to be relaxed. ### Time source directives -Symmetric peer modes are not supported in ntpd-rs, and are unlikely to be supported in the future. When migrating a configuration with symmetric peer connections, we recommend replacing these with client-server mode connections on both clients (see also [Server directives](#server-directives) above). +Symmetric peer modes are not supported in Statime, and are unlikely to be supported in the future. When migrating a configuration with symmetric peer connections, we recommend replacing these with client-server mode connections on both clients (see also [Server directives](#server-directives) above). ### Refclock directives -The current version of ntpd-rs does not yet support local reference clocks, but this feature is on our roadmap. If you are interested in migrating a configuration using local reference clocks, we would be interested in hearing the details. This information can help guide our implementation effort. +The current version of Statime does not yet support local reference clocks, but this feature is on our roadmap. If you are interested in migrating a configuration using local reference clocks, we would be interested in hearing the details. This information can help guide our implementation effort. ## Time synchronization options -The minimum number of sources needed for time synchronization in ntpd-rs is configured through `minimum-agreeing-sources`: +The minimum number of sources needed for time synchronization in Statime is configured through `minimum-agreeing-sources`: ```toml [synchronization] minimum-agreeing-sources = ``` -Note that although the effect of this option is the same as chrony's `minsources`, the default in ntpd-rs is 3, rather than the default 1 source required by chrony. Although 3 is recommended for security, it may not be appropriate for all configurations, particularly configurations where few remote sources are configured. +Note that although the effect of this option is the same as chrony's `minsources`, the default in Statime is 3, rather than the default 1 source required by chrony. Although 3 is recommended for security, it may not be appropriate for all configurations, particularly configurations where few remote sources are configured. -Chrony can limit the maximum time change with the `maxchange` directive. ntpd-rs allows similar restrictions to be enforced through a number of panic thresholds. Steps at startup are controlled through the `startup-panic-threshold`, whilst steps during normal operation are controlled with `single-step-panic-threshold` and `accumulated-step-panic-threshold`. In contrast to chrony, these do not allow ignoring of the first few occurrences, and more importantly, have finite default values: +Chrony can limit the maximum time change with the `maxchange` directive. Statime allows similar restrictions to be enforced through a number of panic thresholds. Steps at startup are controlled through the `startup-panic-threshold`, whilst steps during normal operation are controlled with `single-step-panic-threshold` and `accumulated-step-panic-threshold`. In contrast to chrony, these do not allow ignoring of the first few occurrences, and more importantly, have finite default values: ```toml [synchronization] single-step-panic-threshold = 1000 @@ -93,13 +93,13 @@ startup-step-panic-threshold = { forward="inf", backward = 86400 } accumulated-step-panic-threshold = "inf" ``` -Chrony and ntpd-rs use different algorithms for synchronizing the time. This means that options for tuning filtering of the time differ significantly, and we cannot offer precise guidance on how to translate the chrony parameters to values for ntpd-rs. When migrating a configuration that tunes chrony's algorithm, one should take the intent of the tuning and use that as guidance when choosing which [time synchronization options](../man/statime.toml.5.md#synchronization) to change. +Chrony and Statime use different algorithms for synchronizing the time. This means that options for tuning filtering of the time differ significantly, and we cannot offer precise guidance on how to translate the chrony parameters to values for Statime. When migrating a configuration that tunes chrony's algorithm, one should take the intent of the tuning and use that as guidance when choosing which [time synchronization options](../man/statime.toml.5.md#synchronization) to change. -When tuning the synchronization algorithm, it is important to note a major philosophical difference between chrony and ntpd-rs. For chrony, the majority of the algorithm tuning parameters are set on an individual time source. Within ntpd-rs, all control of the filtering is done via global parameters. Although we do not expect this to be the case, should there be specific parameters you would wish to configure on a per-source basis, please let us know so we can consider this for future releases. +When tuning the synchronization algorithm, it is important to note a major philosophical difference between chrony and Statime. For chrony, the majority of the algorithm tuning parameters are set on an individual time source. Within Statime, all control of the filtering is done via global parameters. Although we do not expect this to be the case, should there be specific parameters you would wish to configure on a per-source basis, please let us know so we can consider this for future releases. ## Server configuration -Server configuration in ntpd-rs works quite a bit differently from chrony. Rather than enabling time server functionality by `allow`ing remote connections to the server, one or more serving instances can be individually configured. Each of these comes with its own allow and deny list. +Server configuration in Statime works quite a bit differently from chrony. Rather than enabling time server functionality by `allow`ing remote connections to the server, one or more serving instances can be individually configured. Each of these comes with its own allow and deny list. The subnets to allow or deny must be specified in CIDR notation (an IP address followed by a slash and the number of masked bits, for example `127.0.0.1/8` or `192.168.1.1/24`) @@ -122,7 +122,7 @@ filter = [ action = "deny" ``` -The allow and deny list configurations are both optional in ntpd-rs. By default, a server accepts traffic from anywhere. When configuring both allow and deny lists, ntpd-rs will first check if a remote is on the deny list. Only if this is not the case will the allow list be considered. This ordering needs to be taken into account when translating interleaved combinations of chrony's `allow` and `deny` commands. +The allow and deny list configurations are both optional in Statime. By default, a server accepts traffic from anywhere. When configuring both allow and deny lists, Statime will first check if a remote is on the deny list. Only if this is not the case will the allow list be considered. This ordering needs to be taken into account when translating interleaved combinations of chrony's `allow` and `deny` commands. NTS can be enabled for a server by configuring an NTS key exchange server: ```toml @@ -131,7 +131,7 @@ listen = ":4460" certificate-chain-path = private-key-path = ``` -Here the names of the corresponding chrony directives are used on the right-hand side of the assignment. Note that unlike chrony, ntpd-rs does not have a default IP address on which it listens for NTS-KE traffic: this need to be provided explicitly. The port is optional however and defaults to the standard value 4460. +Here the names of the corresponding chrony directives are used on the right-hand side of the assignment. Note that unlike chrony, Statime does not have a default IP address on which it listens for NTS-KE traffic: this need to be provided explicitly. The port is optional however and defaults to the standard value 4460. The keys used to encrypt the cookies are ephemeral by default. If these should be kept across reboots of the server, the path for storing these can be configured: ```toml @@ -149,19 +149,19 @@ stale-key-count = key-rotation-interval = ``` -Sharing the keys with which the NTS cookies are encrypted between multiple ntpd-rs servers is not yet supported. +Sharing the keys with which the NTS cookies are encrypted between multiple Statime servers is not yet supported. -If a local stratum for the server is configured through `local stratum`, this can be configured in ntpd-rs through the `local-stratum` key: +If a local stratum for the server is configured through `local stratum`, this can be configured in Statime through the `local-stratum` key: ```toml [synchronization] local-stratum = ``` -Broadcast mode is not supported in ntpd-rs. If this is used in your current setup, configuring the NTP server via DHCP instead may be an alternative. Note that using broadcast mode may leave you more vulnerable to security issues. +Broadcast mode is not supported in Statime. If this is used in your current setup, configuring the NTP server via DHCP instead may be an alternative. Note that using broadcast mode may leave you more vulnerable to security issues. ## Non-supported features -Not all functionality in chrony currently has an equivalent in ntpd-rs. In particular, the following major features currently don't have good alternatives in ntpd-rs: +Not all functionality in chrony currently has an equivalent in Statime. In particular, the following major features currently don't have good alternatives in Statime: - Local hardware devices as time sources. - Support for NTP MAC authentication. @@ -169,4 +169,4 @@ Not all functionality in chrony currently has an equivalent in ntpd-rs. In parti - Acting as a source of leap second data. - Skipping certificate time checks for NTS (chrony's `nocerttimecheck`), see [Server directives](#server-directives). -If any of these features are critical for your use case, ntpd-rs might not be an option for you yet. Please let us know if you miss these features or want to sponsor any of them, as this helps us prioritise our work. +If any of these features are critical for your use case, Statime might not be an option for you yet. Please let us know if you miss these features or want to sponsor any of them, as this helps us prioritise our work. diff --git a/docs/guide/migrating-ntpd.md b/docs/guide/migrating-ntpd.md index 9099ae4d2..eafd14be9 100644 --- a/docs/guide/migrating-ntpd.md +++ b/docs/guide/migrating-ntpd.md @@ -1,16 +1,16 @@ # Migrating from ntpd -Both [ntpd](https://www.ntp.org/), the NTP reference implementation, and ntpd-rs can serve a similar role on Unix systems. This is a guide for converting a ntpd configuration into a ntpd-rs configuration. We assume some experience with the [ntpd configuration format](https://www.ntp.org/documentation/4.2.8-series/comdex/). A user with no or little ntpd experience may be better of following our [getting started guide](getting-started.md). +Both [ntpd](https://www.ntp.org/), the NTP reference implementation, and Statime can serve a similar role on Unix systems. This is a guide for converting a ntpd configuration into a Statime configuration. We assume some experience with the [ntpd configuration format](https://www.ntp.org/documentation/4.2.8-series/comdex/). A user with no or little ntpd experience may be better of following our [getting started guide](getting-started.md). -Configuration for ntpd uses a custom format that functions as a list of commands. In contrast, ntpd-rs uses a configuration file in the `.toml` format that gives values to properties. That means that in most cases fields cannot be repeated. Comments can be added by starting them with a `#`. The remainder of the line is then ignored. +Configuration for ntpd uses a custom format that functions as a list of commands. In contrast, Statime uses a configuration file in the `.toml` format that gives values to properties. That means that in most cases fields cannot be repeated. Comments can be added by starting them with a `#`. The remainder of the line is then ignored. -An `ntpd-rs` configuration can be validated with `statime validate -c `. This will check all field names, and in some cases validates that a value is within the range of valid values for that property. +A Statime configuration can be validated with `statime validate -c `. This will check all field names, and in some cases validates that a value is within the range of valid values for that property. -This guide will not go into detail on all of ntpd's configuration directives, but rather focus on those most important for successful migration. If a particular directive is not mentioned here, there may still be ntpd-rs options in the [configuration reference](../man/statime.toml.5.md) that achieve the desired effect. Note that not all functionality of ntpd is currently supported, a short overview of major differences is given [at the end of this document](#unsupported-features). +This guide will not go into detail on all of ntpd's configuration directives, but rather focus on those most important for successful migration. If a particular directive is not mentioned here, there may still be Statime options in the [configuration reference](../man/statime.toml.5.md) that achieve the desired effect. Note that not all functionality of ntpd is currently supported, a short overview of major differences is given [at the end of this document](#unsupported-features). ## Time sources -The `server` and `pool` commands have a direct equivalent in ntpd-rs: +The `server` and `pool` commands have a direct equivalent in Statime: ```toml # ntpd @@ -18,7 +18,7 @@ server 0.pool.ntp.org server 1.pool.ntp.org pool pool.ntp.org -# ntpd-rs +# statime [[source]] mode = "server" address = "0.pool.ntp.org" @@ -33,33 +33,33 @@ address = "pool.ntp.org" count = 4 ``` -A source in `pool` mode must explicitly define an integer `count`, the maximum number of connections from this pool. The ntpd-rs daemon will actively try to keep the pool "filled": new connections will be spun up if a source from the pool is unreachable. +A source in `pool` mode must explicitly define an integer `count`, the maximum number of connections from this pool. The Statime daemon will actively try to keep the pool "filled": new connections will be spun up if a source from the pool is unreachable. -The symmetric and broadcasting association modes are deliberately not supported in ntpd-rs because these modes have security issues. The `peer` command can be substituted with a standard `server` source. For the `broadcast` command, configuring the NTP server via DHCP instead may be an alternative +The symmetric and broadcasting association modes are deliberately not supported in Statime because these modes have security issues. The `peer` command can be substituted with a standard `server` source. For the `broadcast` command, configuring the NTP server via DHCP instead may be an alternative -There is no direct equivalent of ntpd's `maxpoll` and `minpoll` flags that can be configured on a per-source basis. Instead, ntpd-rs defines poll interval bounds globally for all time sources: +There is no direct equivalent of ntpd's `maxpoll` and `minpoll` flags that can be configured on a per-source basis. Instead, Statime defines poll interval bounds globally for all time sources: ```toml [source-defaults] poll-interval-limits = { min = , max = } initial-poll-interval = ``` -There is no support for bursting in ntpd-rs yet, but the ntpd-rs algorithm is able to synchronize much more quickly (with fewer measurements) than ntpd's algorithm. Therefore, if any bursting directive (`burst` or `iburst`) is present, these usually can be ignored when translating configurations. In some cases, if strict custom poll limits are in place, these may need to be relaxed. +There is no support for bursting in Statime yet, but the Statime algorithm is able to synchronize much more quickly (with fewer measurements) than ntpd's algorithm. Therefore, if any bursting directive (`burst` or `iburst`) is present, these usually can be ignored when translating configurations. In some cases, if strict custom poll limits are in place, these may need to be relaxed. ### Reference clocks -The current version of ntpd-rs does not yet support local reference clocks, but this feature is on our roadmap. If you are interested in migrating a configuration using local reference clocks, we would be interested in hearing the details. This information will help guide our implementation effort. +The current version of Statime does not yet support local reference clocks, but this feature is on our roadmap. If you are interested in migrating a configuration using local reference clocks, we would be interested in hearing the details. This information will help guide our implementation effort. ## Time synchronization options -The minimum number of time sources needed for time synchronization in ntpd-rs is configured through `minimum-agreeing-sources`: +The minimum number of time sources needed for time synchronization in Statime is configured through `minimum-agreeing-sources`: ```toml [synchronization] minimum-agreeing-sources = ``` If fewer agreeing source are available, no synchronization is performed and the clock will drift. This option is a combination of ntpd's `minclock` and `minsane`. Its default value is 3, the recommended value from a security perspective. In ntpd, a default of 3 is used for `minclock` and 1 for `minsane`. -Through the `tinker` command's `step` and `stepout` flags, ntpd allows limiting of the maximum change in time made. Although not entirely the same in functionality, ntpd-rs allows similar restrictions to be enforced through a number of panic thresholds. Steps at startup are controlled through the `startup-panic-threshold`, whilst steps during normal operation are controlled with `single-step-panic-threshold` and `accumulated-step-panic-threshold`. +Through the `tinker` command's `step` and `stepout` flags, ntpd allows limiting of the maximum change in time made. Although not entirely the same in functionality, Statime allows similar restrictions to be enforced through a number of panic thresholds. Steps at startup are controlled through the `startup-panic-threshold`, whilst steps during normal operation are controlled with `single-step-panic-threshold` and `accumulated-step-panic-threshold`. ```toml [synchronization] single-step-panic-threshold = 1000 @@ -67,13 +67,13 @@ startup-step-panic-threshold = { forward="inf", backward = 86400 } accumulated-step-panic-threshold = "inf" ``` -ntpd and ntpd-rs use different algorithms for synchronizing the time. This means that options for tuning filtering of the time differ significantly, and we cannot offer precise guidance on how to translate the ntpd parameters to values for ntpd-rs. When migrating a configuration that tunes ntpd's algorithm, one should take the intent of the tuning and use that as guidance when choosing which of ntpd-rs's [time synchronization options](../man/statime.toml.5.md#synchronization) to change. +ntpd and Statime use different algorithms for synchronizing the time. This means that options for tuning filtering of the time differ significantly, and we cannot offer precise guidance on how to translate the ntpd parameters to values for Statime. When migrating a configuration that tunes ntpd's algorithm, one should take the intent of the tuning and use that as guidance when choosing which of Statime's [time synchronization options](../man/statime.toml.5.md#synchronization) to change. ## Server Configuration & Access Control The [`restrict` command](https://www.ntp.org/documentation/4.2.8-series/accopt/) is used in ntpd to deny requests from a client. In ntpd this is a global setting. A flag configures what happens with connections from this client. For instance, `ignore` will silently ignore the request, while `kod` sends a response to the client that notifies it that its request is denied. -This logic is expressed differently in ntpd-rs. A specific server can be configured to have a `denylist` and an `allowlist`. +This logic is expressed differently in Statime. A specific server can be configured to have a `denylist` and an `allowlist`. The subnets to allow or deny must be specified in CIDR notation (an IP address followed by a slash and the number of masked bits, for example `127.0.0.1/8` or `192.168.1.1/24`) @@ -96,14 +96,14 @@ filter = [ action = "deny" ``` -The allow and deny list configurations are both optional in ntpd-rs. By default, if a server is configured it will accept traffic from anywhere. When configuring both allow and deny lists, ntpd-rs will first check if a remote is on the deny list. Only if this is not the case will the allow list be considered. +The allow and deny list configurations are both optional in Statime. By default, if a server is configured it will accept traffic from anywhere. When configuring both allow and deny lists, Statime will first check if a remote is on the deny list. Only if this is not the case will the allow list be considered. The `allowlist.action` and `denylist.action` properties can have two values: - `ignore` corresponds to ntpd's `ignore` and silently ignores the request - `deny` corresponds to ntpd's `kod` and sends a deny kiss-o'-death packet -The stratum can be configured in ntpd-rs with the `local-stratum` key: +The stratum can be configured in Statime with the `local-stratum` key: ```toml [synchronization] local-stratum = @@ -111,11 +111,11 @@ local-stratum = ## Unsupported features -Not all functionality in ntpd currently has an equivalent in ntpd-rs. In particular, the following major features currently don't have good alternatives in ntpd-rs: +Not all functionality in ntpd currently has an equivalent in Statime. In particular, the following major features currently don't have good alternatives in Statime: - Local hardware devices as time sources. - Support for NTP MAC authentication. - Marking subsets of sources as more trusted than others - Protocol modes beside server and client - Bursting -If any of these features are critical for your use case, ntpd-rs might not be an option for you yet. Please let us know if you miss these features or want to sponsor any of them, as this helps us prioritise our work. +If any of these features are critical for your use case, Statime might not be an option for you yet. Please let us know if you miss these features or want to sponsor any of them, as this helps us prioritise our work. diff --git a/docs/guide/migrating-ntpsec.md b/docs/guide/migrating-ntpsec.md index 31d9952dc..0fbca79e2 100644 --- a/docs/guide/migrating-ntpsec.md +++ b/docs/guide/migrating-ntpsec.md @@ -1,18 +1,18 @@ # Migrating from NTPsec -Both NTPsec and ntpd-rs can serve a similar role on Unix systems. This guide is aimed to help those migrating machines currently running ntpsec to ntpd-rs. We assume some experience with the [NTPsec configuration format](https://docs.ntpsec.org/latest/ntp_conf.html). A user with no or little NTPsec experience may be better off following our [getting started guide](getting-started.md). +Both NTPsec and Statime can serve a similar role on Unix systems. This guide is aimed to help those migrating machines currently running ntpsec to Statime. We assume some experience with the [NTPsec configuration format](https://docs.ntpsec.org/latest/ntp_conf.html). A user with no or little NTPsec experience may be better off following our [getting started guide](getting-started.md). -Configuration for NTPsec uses a custom format that functions as a list of commands. In contrast, ntpd-rs uses a configuration file in the `.toml` format that gives values to properties. That means that in most cases fields cannot be repeated. Comments can be added by starting them with a `#`. The remainder of the line is then ignored. +Configuration for NTPsec uses a custom format that functions as a list of commands. In contrast, Statime uses a configuration file in the `.toml` format that gives values to properties. That means that in most cases fields cannot be repeated. Comments can be added by starting them with a `#`. The remainder of the line is then ignored. -An `ntpd-rs` configuration can be validated with `statime validate -c `. This will check all field names, and in some cases validates that a value is within the range of valid values for that property. +A Statime configuration can be validated with `statime validate -c `. This will check all field names, and in some cases validates that a value is within the range of valid values for that property. -This guide will not go into detail on all of NTPsec's configuration directives, but rather focus on those most important for successful migration. If a particular directive is not mentioned here, there may still be ntpd-rs options in the [configuration reference](../man/statime.toml.5.md) that achieve the desired effect. Note that not all functionality of NTPsec is currently supported, a short overview of major differences is given [at the end of this document](#unsupported-features) +This guide will not go into detail on all of NTPsec's configuration directives, but rather focus on those most important for successful migration. If a particular directive is not mentioned here, there may still be Statime options in the [configuration reference](../man/statime.toml.5.md) that achieve the desired effect. Note that not all functionality of NTPsec is currently supported, a short overview of major differences is given [at the end of this document](#unsupported-features) ## Time sources ### Server entries -The `server` and `pool` commands have a direct equivalent in ntpd-rs: +The `server` and `pool` commands have a direct equivalent in Statime: ```toml # NTPsec @@ -20,7 +20,7 @@ server 0.pool.ntp.org server 1.pool.ntp.org pool pool.ntp.org -# ntpd-rs +# statime [[source]] mode = "server" address = "0.pool.ntp.org" @@ -35,10 +35,10 @@ address = "pool.ntp.org" count = 4 ``` -A source in `pool` mode must explicitly define an integer `count`, the maximum number of connections from this pool. The ntpd-rs daemon will actively try to keep the pool "filled": new connections will be spun up if a source from the pool is unreachable. +A source in `pool` mode must explicitly define an integer `count`, the maximum number of connections from this pool. The Statime daemon will actively try to keep the pool "filled": new connections will be spun up if a source from the pool is unreachable. For server directives with NTS, these can be converted to @@ -47,7 +47,7 @@ For server directives with NTS, these can be converted to server ntp.time.nl nts server ntp.example.com nts ca path/to/certificate/authority.pem -# ntpd-rs +# statime [[source]] mode="nts" address="ntp.time.nl" @@ -58,29 +58,29 @@ address="ntp.example.com" certificate_authority = "path/to/certificate/authority.pem" ``` -There is no direct equivalent of NTPsec's `maxpoll` and `minpoll` flags that can be configured on a per-source basis. Instead, ntpd-rs defines poll interval bounds globally for all time sources: +There is no direct equivalent of NTPsec's `maxpoll` and `minpoll` flags that can be configured on a per-source basis. Instead, Statime defines poll interval bounds globally for all time sources: ```toml [source-defaults] poll-interval-limits = { min = , max = } initial-poll-interval = ``` -There is no support for bursting in ntpd-rs yet, but the ntpd-rs algorithm is able to synchronize much more quickly (with fewer measurements) than NTPsec's algorithm. Therefore, if any bursting directive (`burst` or `iburst`) is present, these usually can be ignored when translating configurations. In some cases, if strict custom poll limits are in place, these may need to be relaxed. +There is no support for bursting in Statime yet, but the Statime algorithm is able to synchronize much more quickly (with fewer measurements) than NTPsec's algorithm. Therefore, if any bursting directive (`burst` or `iburst`) is present, these usually can be ignored when translating configurations. In some cases, if strict custom poll limits are in place, these may need to be relaxed. ### Reference clocks -The current version of ntpd-rs does not yet support local reference clocks, but this feature is on our roadmap. If you are interested in migrating a configuration using local reference clocks, we would be interested in hearing the details. This information will help guide our implementation effort. +The current version of Statime does not yet support local reference clocks, but this feature is on our roadmap. If you are interested in migrating a configuration using local reference clocks, we would be interested in hearing the details. This information will help guide our implementation effort. ## Time synchronization options -The minimum number of time sources needed for time synchronization in ntpd-rs is configured through `minimum-agreeing-sources`: +The minimum number of time sources needed for time synchronization in Statime is configured through `minimum-agreeing-sources`: ```toml [synchronization] minimum-agreeing-sources = ``` If fewer agreeing source are available, no synchronization is performed and the clock will drift. This option is a combination of ntpd's `minclock` and `minsane`. Its default value is 3, the recommended value from a security perspective. In ntpd, a default of 3 is used for `minclock` and 1 for `minsane`. -Through the `tinker` command's `step` and `stepout` flags, NTPsec allows limiting of the maximum change in time made. Although not entirely the same in functionality, ntpd-rs allows similar restrictions to be enforced through a number of panic thresholds. Steps at startup are controlled through the `startup-panic-threshold`, whilst steps during normal operation are controlled with `single-step-panic-threshold` and `accumulated-step-panic-threshold`. +Through the `tinker` command's `step` and `stepout` flags, NTPsec allows limiting of the maximum change in time made. Although not entirely the same in functionality, Statime allows similar restrictions to be enforced through a number of panic thresholds. Steps at startup are controlled through the `startup-panic-threshold`, whilst steps during normal operation are controlled with `single-step-panic-threshold` and `accumulated-step-panic-threshold`. ```toml [synchronization] single-step-panic-threshold = 1000 @@ -88,13 +88,13 @@ startup-step-panic-threshold = { forward="inf", backward = 86400 } accumulated-step-panic-threshold = "inf" ``` -NTPsec and ntpd-rs use different algorithms for synchronizing the time. This means that options for tuning filtering of the time differ significantly, and we cannot offer precise guidance on how to translate the NTPsec parameters to values for ntpd-rs. When migrating a configuration that tunes NTPsec's algorithm, one should take the intent of the tuning and use that as guidance when choosing which of ntpd-rs's [time synchronization options](../man/statime.toml.5.md#synchronization) to change. +NTPsec and Statime use different algorithms for synchronizing the time. This means that options for tuning filtering of the time differ significantly, and we cannot offer precise guidance on how to translate the NTPsec parameters to values for Statime. When migrating a configuration that tunes NTPsec's algorithm, one should take the intent of the tuning and use that as guidance when choosing which of Statime's [time synchronization options](../man/statime.toml.5.md#synchronization) to change. ## Server Configuration & Access Control The `restrict` command is used in NTPsec to deny requests from a client. In NTPsec this is a global setting. A flag configures what happens with connections from this client. For instance, `ignore` will silently ignore the request, while `kod` sends a response to the client that notifies it that its request is denied. -This logic is expressed differently in ntpd-rs. A specific server can be configured to have a `denylist` and an `allowlist`. +This logic is expressed differently in Statime. A specific server can be configured to have a `denylist` and an `allowlist`. The subnets to allow or deny must be specified in CIDR notation (an IP address followed by a slash and the number of masked bits, for example `127.0.0.1/8` or `192.168.1.1/24`) @@ -117,14 +117,14 @@ filter = [ action = "deny" ``` -The allow and deny list configurations are both optional in ntpd-rs. By default, if a server is configured it will accept traffic from anywhere. When configuring both allow and deny lists, ntpd-rs will first check if a remote is on the deny list. Only if this is not the case will the allow list be considered. +The allow and deny list configurations are both optional in Statime. By default, if a server is configured it will accept traffic from anywhere. When configuring both allow and deny lists, Statime will first check if a remote is on the deny list. Only if this is not the case will the allow list be considered. The `allowlist.action` and `denylist.action` properties can have two values: - `ignore` corresponds to NTPsec's `ignore` and silently ignores the request - `deny` corresponds to NTPsec's `kod` and sends a deny kiss-o'-death packet -The stratum can be configured in ntpd-rs with the `local-stratum` key: +The stratum can be configured in Statime with the `local-stratum` key: ```toml [synchronization] local-stratum = @@ -141,14 +141,14 @@ NTS can be enabled for a server by configuring an NTS key exchange server: nts key /etc/letsencrypt/live/ntp.example.com/privkey.pem nts cert /etc/letsencrypt/live/ntp.example.com/fullchain.pem -# ntpd-rs +# statime [[nts-ke-server]] listen = ": certificate-chain-path = "/etc/letsencrypt/live/ntp.example.com/fullchain.pem" private-key-path = "/etc/letsencrypt/live/ntp.example.com/privkey.pem" ``` -Note that unlike NTPsec, ntpd-rs does not have a default IP address on which it listens for NTS-KE traffic: it needs to be provided explicitly. The port is optional and defaults to the standard value 4460. +Note that unlike NTPsec, Statime does not have a default IP address on which it listens for NTS-KE traffic: it needs to be provided explicitly. The port is optional and defaults to the standard value 4460. The keys used to sign the cookies is kept in memory, but can additionally be stored to a file (so they are preserved after a restart). @@ -156,7 +156,7 @@ The keys used to sign the cookies is kept in memory, but can additionally be sto # NTPsec nts cookie /var/lib/ntp/nts-keys -# ntpd-rs +# statime [keyset] key_storage_path = "/var/lib/ntp/nts-keys" ``` @@ -171,15 +171,15 @@ key-rotation-interval = ``` Note that the defaults for these settings mean that cookies for the server are only valid for slightly more than 1 week. -Sharing the keys with which the NTS cookies are encrypted between multiple ntpd-rs servers is not yet supported. +Sharing the keys with which the NTS cookies are encrypted between multiple Statime servers is not yet supported. ## Unsupported features -Not all functionality in NTPsec currently has an equivalent in ntpd-rs. In particular, the following major features currently don't have good alternatives in ntpd-rs: +Not all functionality in NTPsec currently has an equivalent in Statime. In particular, the following major features currently don't have good alternatives in Statime: - Local hardware devices as time sources. - Support for NTP MAC authentication. - Marking subsets of sources as more trusted than others. - Bursting -If any of these features are critical for your use case, ntpd-rs might not be an option for you yet. Please let us know if you miss these features or want to sponsor any of them, as this helps us prioritise our work. +If any of these features are critical for your use case, Statime might not be an option for you yet. Please let us know if you miss these features or want to sponsor any of them, as this helps us prioritise our work. diff --git a/docs/guide/ntpv5.md b/docs/guide/ntpv5.md index 1b5cfdde6..027bbc1e7 100644 --- a/docs/guide/ntpv5.md +++ b/docs/guide/ntpv5.md @@ -8,14 +8,14 @@ differences: details that were in the previous versions (none of the major NTP implementations follow these details precisely, as they are known to be suboptimal). -- Support for anything but client and server modes is dropped (ntpd-rs already +- Support for anything but client and server modes is dropped (Statime already only supports these modes). - Fields in the NTP server and client messages have been defined more clearly. - NTPv5 has a better mechanism for handling loop detection. - Several other minor improvements and changes. All of this taken together, we believe that NTPv5 is a significant improvement -over NTPv4. Because of this, you can already use ntpd-rs as an NTPv5 client or +over NTPv4. Because of this, you can already use Statime as an NTPv5 client or server, but this functionality is still experimental and is not enabled by default. @@ -23,7 +23,7 @@ Version 5 of the NTP protocol is however not backwards compatible with earlier versions of the protocol, given that some of the fields changed. This is why an upgrade mechanism is introduced in NTPv5, that allows a client to start with a NTPv4 packet, and allows the server to upgrade the client to NTPv5. The following -sections describe how to enable this experimental NTPv5 support in ntpd-rs when +sections describe how to enable this experimental NTPv5 support in Statime when used as a client and when used as a server. !!! Warning diff --git a/docs/guide/nts-pool.md b/docs/guide/nts-pool.md index 8d46e6119..9db9fdefe 100644 --- a/docs/guide/nts-pool.md +++ b/docs/guide/nts-pool.md @@ -7,9 +7,9 @@ pool for servers supporting NTS has recently been set up at ## Using the SRV variant of the pool -NTPD-rs versions 1.8.0 and later support using the SRV variant of the -experimental pool. They can use the pool by adding the following source to -their configuration: +Statime versions 1.8.0 (still called ntpd-rs at that time) and later support +using the SRV variant of the experimental pool. They can use the pool by adding +the following source to their configuration: ```toml [[source]] mode = "nts-pool" @@ -21,19 +21,20 @@ Note that SRV pool support is still experimental and usage of it may trigger bug ## Participating in the NTS pool -NTPD-rs versions newer than 1.7.0-alpha.20251003 support being added to this -pool. This guide will assume you are running a version more recent than this, -and have already setup an NTS server using the instructions in [our NTS guide](./nts.md). +Statime versions newer than 1.7.0-alpha.20251003 (still called ntpd-rs at that +time) support being added to this pool. This guide will assume you are running +a version more recent than this, and have already setup an NTS server using the +instructions in [our NTS guide](./nts.md). ### Adding your server To add an NTS server to the pool, on the pool website add the domain name of the server on the `Time sources` page after logging in. The pool will give you an authentication key the pool will use to authenticate itself to your NTS -server. This key will need to be added to the ntpd-rs configuration to allow +server. This key will need to be added to the Statime configuration to allow the pool to handle NTS key exchange connections for your server. -To add this key, modify the ntpd-rs configuration at `/etc/statime/statime.toml`, +To add this key, modify the Statime configuration at `/etc/statime/statime.toml`, adding to the `[[nts-ke-server]]` section the following: ```toml accepted-pool-authentication-tokens = [""] diff --git a/docs/guide/nts.md b/docs/guide/nts.md index 36694f4c6..6ec7b29f3 100644 --- a/docs/guide/nts.md +++ b/docs/guide/nts.md @@ -17,7 +17,7 @@ encrypted. Third parties can thus see what the exchanged time information was, but they cannot modify it. ## Using an NTS source -You can use existing public NTS servers with ntpd-rs by simply adding a source +You can use existing public NTS servers with Statime by simply adding a source with mode `nts`. For example, [netnod] has public NTS servers, to use them you simply configure a source like this: @@ -44,7 +44,7 @@ certificate-authority = "/path/to/certificate/authority.pem" !!! Warning - The ntpd-rs daemon does not support self-signed certificates. Servers that + The Statime daemon does not support self-signed certificates. Servers that only have a self-signed certificate cannot be used. Either setup a private certificate authority and use that CA to sign the certificate for the server, or choose an alternative NTS server. @@ -100,7 +100,7 @@ private-key-path = "/path/to/private.key" !!! Note - The ntpd-rs daemon currently does not support running an NTS server without + The Statime daemon currently does not support running an NTS server without an associated domain name through which its clients reach it. If you are setting up your own private CA, you can however setup a local domain name (e.g. `example-nts.local`), such as one configured through `/etc/hosts`. @@ -158,7 +158,7 @@ Once you've installed certbot, you can run a simple command to get a certificate for your domain, replacing the email address and domain name with your own: ```sh -certbot certonly --standalone -n --email "[you@example.com]" --agree-tos -d "[time.example.com]" --deploy-hook "systemctl restart ntpd-rs" +certbot certonly --standalone -n --email "[you@example.com]" --agree-tos -d "[time.example.com]" --deploy-hook "systemctl restart statime" ``` The command above assumes that traffic from TCP port 80 can be received from the @@ -170,8 +170,8 @@ guide. Please read the [certbot documentation][3] for more details. Certbot automatically sets up a task that renews these certificates, because Let's Encrypt certificates are valid for only 90 days. The `--deploy-hook` -argument tells certbot to restart the ntpd-rs daemon whenever a new certificate -is issued, because ntpd-rs does not automatically reload the certificate files. +argument tells certbot to restart the Statime daemon whenever a new certificate +is issued, because Statime does not automatically reload the certificate files. We can now update our configuration with the paths of the generated certificate files (replacing the domain name with the domain name for which you requested a @@ -184,7 +184,7 @@ certificate-chain-path = "/etc/letsencrypt/live/[time.example.com]/fullchain.pem private-key-path = "/etc/letsencrypt/live/[time.example.com]/privkey.pem" ``` -Finally, restart the ntpd-rs daemon using `systemctl restart ntpd-rs`. Your +Finally, restart the Statime daemon using `systemctl restart statime`. Your server should now be able to handle NTS traffic! [3]: https://eff-certbot.readthedocs.io/en/stable/using.html @@ -211,12 +211,12 @@ with your own as before): ```sh cat <<'EOF' > /etc/cron.daily/renew-certificate #!/usr/bin/env bash -lego --email "[you@example.com]" --http --domains "[time.example.com]" --accept-tos --path /var/lib/lego renew --renew-hook "systemctl restart ntpd-rs +lego --email "[you@example.com]" --http --domains "[time.example.com]" --accept-tos --path /var/lib/lego renew --renew-hook "systemctl restart statime EOF chmod +x /etc/cron.daily/renew-certificate ``` -Because the ntpd-rs daemon does not automatically restart whenever the +Because the Statime daemon does not automatically restart whenever the certificates are updated, we instruct lego to restart our daemon using the `--renew-hook` argument. @@ -238,7 +238,7 @@ certificate-chain-path = "/var/lib/lego/certificates/[time.example.com].crt" private-key-path = "/var/lib/lego/certificates/[time.example.com].key" ``` -Finally, restart the ntpd-rs daemon using `systemctl restart ntpd-rs`. Your +Finally, restart the Statime daemon using `systemctl restart statime`. Your server should now be able to handle NTS traffic! [4]: https://github.com/go-acme/lego diff --git a/docs/guide/security-guidance.md b/docs/guide/security-guidance.md index 94367acda..09b9dd5bf 100644 --- a/docs/guide/security-guidance.md +++ b/docs/guide/security-guidance.md @@ -1,32 +1,32 @@ -# Hardening ntpd-rs +# Hardening Statime -A correct system clock is critical for both security and the proper functioning of software. For instance, determining the validity of a TLS certificate relies on the system time. Running and debugging a distributed system is much easier, and in some cases only feasible, when the machines are all synchronized. This guide provides some guidance on what to think about when hardening ntpd-rs for your setup. +A correct system clock is critical for both security and the proper functioning of software. For instance, determining the validity of a TLS certificate relies on the system time. Running and debugging a distributed system is much easier, and in some cases only feasible, when the machines are all synchronized. This guide provides some guidance on what to think about when hardening Statime for your setup. ## The Availability - Correctness tradeoff -When hardening ntpd-rs, one of the larger challenges is a fundamental tradeoff between: +When hardening Statime, one of the larger challenges is a fundamental tradeoff between: -- availability of synchronization: ntpd-rs should actively and continually synchronize with external sources -- risk of missteering: ntpd-rs should not blindly follow external sources: they may be compromised +- availability of synchronization: Statime should actively and continually synchronize with external sources +- risk of missteering: Statime should not blindly follow external sources: they may be compromised Many of the measures against missteering increase the risk of unavailability and vice versa. You must decide what the correct balance is for your use case. For instance, the risk of missteering is large if your system deals with public key cryptography. The security of the current web certificate system hinges on having a rough (<1day) consensus on what time it is. Similarly, the security and functioning of your applications may also be affected. A tradeoff that limits the risk of missteering is probably the correct choice. -On the other hand, a lack of synchronization can cause issues in a distributed system. Such systems require a small upper bound on the time difference between the machines they run on. When time synchronization fails the clocks can quickly drift outside of these bounds and the system may fail. Furthermore, it may be most important that the machines are synchronized with each other, not necessarily that they use the true time. Configuring ntpd-rs for maximum availability seems the best approach for this scenario. +On the other hand, a lack of synchronization can cause issues in a distributed system. Such systems require a small upper bound on the time difference between the machines they run on. When time synchronization fails the clocks can quickly drift outside of these bounds and the system may fail. Furthermore, it may be most important that the machines are synchronized with each other, not necessarily that they use the true time. Configuring Statime for maximum availability seems the best approach for this scenario. Since there is no universally best solution to this tradeoff, you as the end user will have to consider which of these factors weighs more heavily, and adjust your configuration accordingly. ## Limiting incorrect steering -Ntpd-rs can query multiple remote time servers for the current time. This allows it to detect and discard outliers that provide an incorrect time. The synchronization algorithm always requires a strict majority of the reachable servers (those that it is able to actively communicate with) to agree on the current time before making adjustments to the clock. Furthermore, to prevent an attacker to just reduce the available servers to only its own through denial of service attacks, the minimum number of agreeing servers can also be configured through `minimum-agreeing-sources`. +Statime can query multiple remote time servers for the current time. This allows it to detect and discard outliers that provide an incorrect time. The synchronization algorithm always requires a strict majority of the reachable servers (those that it is able to actively communicate with) to agree on the current time before making adjustments to the clock. Furthermore, to prevent an attacker to just reduce the available servers to only its own through denial of service attacks, the minimum number of agreeing servers can also be configured through `minimum-agreeing-sources`. -In its operation, ntpd-rs influences the clock in two ways: +In its operation, Statime influences the clock in two ways: * **frequency adjustment:** ntdp-rs can adjust the clock frequency to compensate for hardware inaccuracies and to slowly correct small offsets to the system clock. This process can change the clock by in the worst case at most $1000$ microseconds every second, meaning that any incorrect steering of frequency will need at least 1000 days to reach an offset of 1 day. * **step adjustment** the second method of steering is stepping the clock. This allows for compensation of larger errors, but also provides more opportunity to an attacker for introducing large errors to the system clock. -Frequency adjustments are essentially impossible to exploit by an attacker. The threat lies in big step adjustments. To prevent incorrect step adjustments, ntpd-rs allows the configuration of step limits. When these limits are exceeded, the daemon assumes that an unrecoverable problem has occurred and aborts. That means no synchronization will occur and the system's time will drift. +Frequency adjustments are essentially impossible to exploit by an attacker. The threat lies in big step adjustments. To prevent incorrect step adjustments, Statime allows the configuration of step limits. When these limits are exceeded, the daemon assumes that an unrecoverable problem has occurred and aborts. That means no synchronization will occur and the system's time will drift. The step limits come in three variants: @@ -36,7 +36,7 @@ The step limits come in three variants: What values to choose for these thresholds depends on what the expected maximum offset of the system clock will be during normal operations and startup. -Again, note that the thresholds are enforced through ntpd-rs aborting when they are exceeded. Hence, strict values for these will limit the daemons ability to automatically adjust to sudden changes to the clock, potentially decreasing availability of the time synchronization. +Again, note that the thresholds are enforced through Statime aborting when they are exceeded. Hence, strict values for these will limit the daemons ability to automatically adjust to sudden changes to the clock, potentially decreasing availability of the time synchronization. When aborting due to the above thresholds, a log message along the lines of the one below is shown: ``` @@ -45,15 +45,15 @@ When aborting due to the above thresholds, a log message along the lines of the If the clock is significantly wrong, the force-sync command in [statime](../man/statime.8.md) can be used to manually correct the systemclock back to a reasonable starting point. -### The risks of rebooting ntpd-rs +### The risks of rebooting Statime -Because the `startup-step-panic-threshold` is typically higher than the `single-step-panic-threshold`, rebooting ntpd-rs makes bigger step adjustments possible. Furthermore, rebooting clears the total accumulated step, and repeated reboots can allow an attacker to bypass the protections offered by `accumulated-step-panic-threshold`. +Because the `startup-step-panic-threshold` is typically higher than the `single-step-panic-threshold`, rebooting Statime makes bigger step adjustments possible. Furthermore, rebooting clears the total accumulated step, and repeated reboots can allow an attacker to bypass the protections offered by `accumulated-step-panic-threshold`. -For these reasons we recommend to not automatically restart ntpd-rs. Rather, an administrator should check on a stopped ntpd-rs process to determine whether a restart is benign at the current point in time or if it could worsen an ongoing attack. In the latter case, the attack must first be mitigated before allowing the ntpd-rs daemon to restart. +For these reasons we recommend to not automatically restart Statime. Rather, an administrator should check on a stopped Statime process to determine whether a restart is benign at the current point in time or if it could worsen an ongoing attack. In the latter case, the attack must first be mitigated before allowing the Statime daemon to restart. ## Increasing availability -The best way to increase availability of time synchronization is to increase the number of servers ntpd-rs queries for the current time. When combined with a (relatively) small value for `minimum-agreeing-sources`, this will allow ntpd-rs to keep synchronizing the local time even if multiple upstream servers fail. +The best way to increase availability of time synchronization is to increase the number of servers Statime queries for the current time. When combined with a (relatively) small value for `minimum-agreeing-sources`, this will allow Statime to keep synchronizing the local time even if multiple upstream servers fail. For servers being completely unavailable, this is the difference between the number of configured time sources and `minimum-agreeing-sources`. However, note that at most half the servers can fail with incorrect time information before impacting time synchronization. @@ -71,13 +71,13 @@ means that the client is not steering the clock and may indicate a problem with ## Configuration, logs and observability -There are more aspects of ntpd-rs besides clock steering that must be considered for secure operations. +There are more aspects of Statime besides clock steering that must be considered for secure operations. -The clock steering is based on the ntpd-rs configuration file. If an attacker can modify this configuration file, all protections configured in it are meaningless. We recommend that operating system facilities (e.g. permissions) be used to restrict who can edit the configuration and, depending on what threats are expected, who can read it. +The clock steering is based on the Statime configuration file. If an attacker can modify this configuration file, all protections configured in it are meaningless. We recommend that operating system facilities (e.g. permissions) be used to restrict who can edit the configuration and, depending on what threats are expected, who can read it. Similarly, for logs it is recommended to restrict who can read the logs. It is also strongly advisable to configure log rotation and limits on the maximum size of the log through the systems logging facilities, to prevent logs from accidentally becoming so large as to impede normal system operation. When configured with a `log-level` of info or higher, the daemon should not log in direct response to random network traffic. However, log output is proportional to the number of remote time sources configured. -Furthermore, the ntpd-rs daemon can be configured to expose two sockets: +Furthermore, the Statime daemon can be configured to expose two sockets: - The observe socket is read-only and exposes some of the source and clock algorithm state. diff --git a/docs/guide/server-setup.md b/docs/guide/server-setup.md index b13e43ad1..a2ee57698 100644 --- a/docs/guide/server-setup.md +++ b/docs/guide/server-setup.md @@ -1,13 +1,13 @@ # Setting up an NTP server -By default, ntpd-rs only acts as an NTP client, and doesn't serve time on any -network interface. To enable ntpd-rs as a server, the following can be added to +By default, Statime only acts as an NTP client, and doesn't serve time on any +network interface. To enable Statime as a server, the following can be added to the configuration: ```toml [[server]] listen = "0.0.0.0:123" ``` -This will cause ntpd-rs to listen on all network interfaces on UDP port 123 for +This will cause Statime to listen on all network interfaces on UDP port 123 for NTP client requests. If you only want to listen on a specific network interface, change `0.0.0.0` to the IP address of that interface. @@ -49,9 +49,9 @@ The deny list uses the same CIDR notion as the allow list, and can also be used to block subnets. Connections from IP addresses contained in the deny list will always be blocked, even if they also happen to be in the allow list. -The allow and deny list configurations are both optional in ntpd-rs. By +The allow and deny list configurations are both optional in Statime. By default, if a server is configured it will accept traffic from anywhere. When -configuring both allow and deny lists, ntpd-rs will first check if a remote is +configuring both allow and deny lists, Statime will first check if a remote is on the deny list. Only if this is not the case will the allow list be considered. @@ -67,4 +67,3 @@ available as part of the [NTP pool](https://www.ntppool.org). Please note that this can have significant long-term impact in terms of NTP traffic to that particular IP address. Please read [the join instructions](https://www.ntppool.org/en/join.html) carefully before joining the pool. - diff --git a/docs/index.md b/docs/index.md index cf13fb2aa..ee63332df 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,15 +1,16 @@ -# ntpd-rs +# Statime -Welcome to ntpd-rs, a full-featured NTP server and client implementation, -including NTS support. The documentation is divided into several sections. For -new users of ntpd-rs we recommend to start with the [getting started guide][1]. -If you already have experience with other NTP software, you may want to start +Welcome to Statime, a full-featured time synchronization server and client +implementation, including support for NTP, NTS and CSPTP. The documentation is +divided into several sections. For new users of Statime we recommend to start +with the [getting started guide][1]. If you already have experience with other +time synchronization software such as NTP or PTP software, you may want to start with one of the specific migration guides in the *Guide* section of the documentation. -If you are looking for a reference level explanation of functions in ntpd-rs we +If you are looking for a reference level explanation of functions in Statime we recommend looking at the *Man Pages* section. Finally, if you are looking at how -ntpd-rs development is organized, please take a look at the *Development* +Statime development is organized, please take a look at the *Development* section of the documentation. [1]: ./guide/getting-started.md diff --git a/docs/man/statime-daemon.8.md b/docs/man/statime-daemon.8.md index 1d748bd36..ccf0df7d6 100644 --- a/docs/man/statime-daemon.8.md +++ b/docs/man/statime-daemon.8.md @@ -1,10 +1,10 @@ # NAME -`statime-daemon` - ntpd-rs Network Time Protocol service daemon +`statime-daemon` - Statime Time Synchronization Daemon # SYNOPSIS @@ -14,18 +14,19 @@ title: STATIME-DAEMON(8) ntpd-rs 2.0.0-alpha.20261113 | ntpd-rs # DESCRIPTION -`statime-daemon` is the Network Time Protocol (NTP) service daemon for ntpd-rs, an -NTP implementation with a focus on security and stability. The `statime-daemon` can -be configured as both an NTP client and an NTP server. The daemon also works -with the Network Time Security (NTS) protocol. Details of the configuration -of the daemon and implementation details can be found in statime.toml(5), where -several concepts of the statime-daemon are also explained. +`statime-daemon` is the time synchronization service daemon for Statime, an +implementation with a focus on security and stability. The `statime-daemon` can +be configured as both a client and server for different protocols, including +NTP and CSPTP. The daemon also works with the Network Time Security (NTS) +protocol. Details of the configuration of the daemon and implementation details +can be found in statime.toml(5), where several concepts of the statime-daemon +are also explained. # OPTIONS `-c` *path*, `--config`=*path* : The configuration file path for the statime-daemon where settings for the - configuration of ntpd-rs are stored. If not specified the default + configuration of Statime are stored. If not specified the default configuration file is `/etc/statime/statime.toml`. `-h`, `--help` diff --git a/docs/man/statime-metrics.8.md b/docs/man/statime-metrics.8.md index eb59215a7..b2624fd0d 100644 --- a/docs/man/statime-metrics.8.md +++ b/docs/man/statime-metrics.8.md @@ -1,10 +1,10 @@ # NAME -`statime-metrics` - Prometheus/OpenMetrics exporter for the ntpd-rs daemon +`statime-metrics` - Prometheus/OpenMetrics exporter for the Statime daemon # SYNOPSIS @@ -14,7 +14,7 @@ title: STATIME-METRICS(8) ntpd-rs 2.0.0-alpha.20261113 | ntpd-rs # DESCRIPTION -Exports the status metrics from the ntpd-rs daemon as Prometheus/OpenMetrics +Exports the status metrics from the Statime daemon as Prometheus/OpenMetrics via an HTTP socket. # OPTIONS diff --git a/docs/man/statime.8.md b/docs/man/statime.8.md index 326e37ae6..527fcd09f 100644 --- a/docs/man/statime.8.md +++ b/docs/man/statime.8.md @@ -1,10 +1,10 @@ # NAME -`statime` - management client for the ntpd-rs statime-daemon process +`statime` - management client for statime-daemon # SYNOPSIS @@ -17,7 +17,7 @@ title: STATIME(8) ntpd-rs 2.0.0-alpha.20261113 | ntpd-rs # DESCRIPTION The `statime` management client allows management of some aspects of the -ntpd-rs daemon. Currently the management client only allows displaying the +Statime daemon. Currently the management client only allows displaying the current status of the daemon and validating a configuration file for usage with the daemon. diff --git a/docs/man/statime.toml.5.md b/docs/man/statime.toml.5.md index bd82e27cc..cfa27841c 100644 --- a/docs/man/statime.toml.5.md +++ b/docs/man/statime.toml.5.md @@ -1,14 +1,14 @@ # NAME -`statime.toml` - configuration file for the ntpd-rs statime-daemon +`statime.toml` - configuration file for statime-daemon # DESCRIPTION -The configuration of the ntpd-rs daemon is controlled through a number of TOML +The configuration of the Statime daemon is controlled through a number of TOML configuration files. The primary configuration file is loaded from `/etc/statime/statime.toml`, unless otherwise specified on the command line when starting the daemon. It can specify a folder containing further configuration @@ -23,18 +23,18 @@ whilst numbers and boolean values like true/false are placed without any quotes. This document will provide example values for all settings. A full specification of the syntax of toml files can be found at [toml.io](https://toml.io). -The ntpd-rs configuration is split up into several sections. Each of these +The Statime configuration is split up into several sections. Each of these sections controls a separate aspect of the daemons operations. Most settings have defaults, which are shown in brackets as (**emphasized**). This document organizes all settings by section. # EXPERIMENTAL FEATURES -The ntpd-rs daemon supports a number of features which are experimental. Such +The Statime daemon supports a number of features which are experimental. Such features may change between versions in ways which are backwards incompatible. Settings related to such features will be marked in this documentation. Note that a configuration using such settings may not work with future versions -of ntpd-rs. +of Statime. # SPECIFICATION OF DURATIONS @@ -134,7 +134,7 @@ server. The following source types are currently supported: `sock` : A sock source connects to a GPSd socket to get timing data from GPS - receivers. Note that GPSd must be (re-)started after starting ntpd-rs for + receivers. Note that GPSd must be (re-)started after starting Statime for GPSd to connect to the socket. `pps` @@ -151,7 +151,7 @@ server. The following source types are currently supported: A source has the following configuration options: `type` = *type* -: Specify one of the source types that ntpd-rs supports: `ntp`, `ntp-pool`, +: Specify one of the source types that Statime supports: `ntp`, `ntp-pool`, `sock`, `pps`, or `csptp`. Note that `csptp` sources are experimental. `nts` = *bool* (**false**) @@ -473,7 +473,7 @@ supported: A source has the following configuration options: `type` = *server type* -: Specify one of the server types ntpd-rs supports. Must be one of `ntp`, +: Specify one of the server types Statime supports. Must be one of `ntp`, `ntske`, or `csptp`. Note that `csptp` servers are experimental and may change in backwards incompatible ways. @@ -602,7 +602,7 @@ A source has the following configuration options: In NTS secured NTP traffic, the client communicates to the server which keys to use through a cookie which it received from the server at an earlier time. In -ntpd-rs, these cookies contain encrypted versions of the NTS keys. The settings +Statime, these cookies contain encrypted versions of the NTS keys. The settings here control the generation and storage of these keys when acting as an NTP secured NTS server or NTS key exchange server. diff --git a/docs/precompiled/man/statime-daemon.8 b/docs/precompiled/man/statime-daemon.8 index 9d6ae0902..a309eba0f 100644 --- a/docs/precompiled/man/statime-daemon.8 +++ b/docs/precompiled/man/statime-daemon.8 @@ -14,11 +14,11 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "STATIME-DAEMON" "8" "" "ntpd-rs 2.0.0-alpha.20261113" "ntpd-rs" +.TH "STATIME-DAEMON" "8" "" "Statime 2.0.0-alpha.20261113" "Statime" .hy .SH NAME .PP -\f[V]statime-daemon\f[R] - ntpd-rs Network Time Protocol service daemon +\f[V]statime-daemon\f[R] - Statime Time Synchronization Daemon .SH SYNOPSIS .PP \f[V]statime-daemon\f[R] [\f[V]-c\f[R] \f[I]path\f[R]] [\f[V]-l\f[R] @@ -33,11 +33,10 @@ \f[V]statime-daemon\f[R] \f[V]-v\f[R] .SH DESCRIPTION .PP -\f[V]statime-daemon\f[R] is the Network Time Protocol (NTP) service -daemon for ntpd-rs, an NTP implementation with a focus on security and -stability. -The \f[V]statime-daemon\f[R] can be configured as both an NTP client and -an NTP server. +\f[V]statime-daemon\f[R] is the time synchronization service daemon for +Statime, an implementation with a focus on security and stability. +The \f[V]statime-daemon\f[R] can be configured as both a client and +server for different protocols, including NTP and CSPTP. The daemon also works with the Network Time Security (NTS) protocol. Details of the configuration of the daemon and implementation details can be found in statime.toml(5), where several concepts of the @@ -46,7 +45,7 @@ statime-daemon are also explained. .TP \f[V]-c\f[R] \f[I]path\f[R], \f[V]--config\f[R]=\f[I]path\f[R] The configuration file path for the statime-daemon where settings for -the configuration of ntpd-rs are stored. +the configuration of Statime are stored. If not specified the default configuration file is \f[V]/etc/statime/statime.toml\f[R]. .TP diff --git a/docs/precompiled/man/statime-metrics.8 b/docs/precompiled/man/statime-metrics.8 index 6037badab..13b73c16f 100644 --- a/docs/precompiled/man/statime-metrics.8 +++ b/docs/precompiled/man/statime-metrics.8 @@ -14,12 +14,12 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "STATIME-METRICS" "8" "" "ntpd-rs 2.0.0-alpha.20261113" "ntpd-rs" +.TH "STATIME-METRICS" "8" "" "Statime 2.0.0-alpha.20261113" "Statime" .hy .SH NAME .PP \f[V]statime-metrics\f[R] - Prometheus/OpenMetrics exporter for the -ntpd-rs daemon +Statime daemon .SH SYNOPSIS .PP \f[V]statime-metrics\f[R] [\f[V]-c\f[R] \f[I]path\f[R]] @@ -33,7 +33,7 @@ ntpd-rs daemon \f[V]statime-metrics\f[R] \f[V]-v\f[R] .SH DESCRIPTION .PP -Exports the status metrics from the ntpd-rs daemon as +Exports the status metrics from the Statime daemon as Prometheus/OpenMetrics via an HTTP socket. .SH OPTIONS .TP diff --git a/docs/precompiled/man/statime.8 b/docs/precompiled/man/statime.8 index c753f40fb..1811b4e79 100644 --- a/docs/precompiled/man/statime.8 +++ b/docs/precompiled/man/statime.8 @@ -14,12 +14,11 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "STATIME" "8" "" "ntpd-rs 2.0.0-alpha.20261113" "ntpd-rs" +.TH "STATIME" "8" "" "Statime 2.0.0-alpha.20261113" "Statime" .hy .SH NAME .PP -\f[V]statime\f[R] - management client for the ntpd-rs statime-daemon -process +\f[V]statime\f[R] - management client for statime-daemon .SH SYNOPSIS .PP \f[V]statime\f[R] validate [\f[V]-c\f[R] \f[I]path\f[R]] @@ -43,7 +42,7 @@ process .SH DESCRIPTION .PP The \f[V]statime\f[R] management client allows management of some -aspects of the ntpd-rs daemon. +aspects of the Statime daemon. Currently the management client only allows displaying the current status of the daemon and validating a configuration file for usage with the daemon. diff --git a/docs/precompiled/man/statime.toml.5 b/docs/precompiled/man/statime.toml.5 index 78e79309f..b6980cdb7 100644 --- a/docs/precompiled/man/statime.toml.5 +++ b/docs/precompiled/man/statime.toml.5 @@ -14,15 +14,14 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "STATIME.TOML" "5" "" "ntpd-rs 2.0.0-alpha.20261113" "ntpd-rs" +.TH "STATIME.TOML" "5" "" "Statime 2.0.0-alpha.20261113" "Statime" .hy .SH NAME .PP -\f[V]statime.toml\f[R] - configuration file for the ntpd-rs -statime-daemon +\f[V]statime.toml\f[R] - configuration file for statime-daemon .SH DESCRIPTION .PP -The configuration of the ntpd-rs daemon is controlled through a number +The configuration of the Statime daemon is controlled through a number of TOML configuration files. The primary configuration file is loaded from \f[V]/etc/statime/statime.toml\f[R], unless otherwise specified on the @@ -42,7 +41,7 @@ This document will provide example values for all settings. A full specification of the syntax of toml files can be found at toml.io (https://toml.io). .PP -The ntpd-rs configuration is split up into several sections. +The Statime configuration is split up into several sections. Each of these sections controls a separate aspect of the daemons operations. Most settings have defaults, which are shown in brackets as @@ -50,12 +49,12 @@ Most settings have defaults, which are shown in brackets as This document organizes all settings by section. .SH EXPERIMENTAL FEATURES .PP -The ntpd-rs daemon supports a number of features which are experimental. +The Statime daemon supports a number of features which are experimental. Such features may change between versions in ways which are backwards incompatible. Settings related to such features will be marked in this documentation. Note that a configuration using such settings may not work with future -versions of ntpd-rs. +versions of Statime. .SH SPECIFICATION OF DURATIONS .PP Various configuration settings of the daemon set some kind of duration @@ -169,7 +168,7 @@ the pool. \f[V]sock\f[R] A sock source connects to a GPSd socket to get timing data from GPS receivers. -Note that GPSd must be (re-)started after starting ntpd-rs for GPSd to +Note that GPSd must be (re-)started after starting Statime for GPSd to connect to the socket. .TP \f[V]pps\f[R] @@ -188,7 +187,7 @@ linux. A source has the following configuration options: .TP \f[V]type\f[R] = \f[I]type\f[R] -Specify one of the source types that ntpd-rs supports: \f[V]ntp\f[R], +Specify one of the source types that Statime supports: \f[V]ntp\f[R], \f[V]ntp-pool\f[R], \f[V]sock\f[R], \f[V]pps\f[R], or \f[V]csptp\f[R]. Note that \f[V]csptp\f[R] sources are experimental. .TP @@ -568,7 +567,7 @@ incompatible ways. A source has the following configuration options: .TP \f[V]type\f[R] = \f[I]server type\f[R] -Specify one of the server types ntpd-rs supports. +Specify one of the server types Statime supports. Must be one of \f[V]ntp\f[R], \f[V]ntske\f[R], or \f[V]csptp\f[R]. Note that \f[V]csptp\f[R] servers are experimental and may change in backwards incompatible ways. @@ -734,7 +733,7 @@ in backwards incompatible ways. In NTS secured NTP traffic, the client communicates to the server which keys to use through a cookie which it received from the server at an earlier time. -In ntpd-rs, these cookies contain encrypted versions of the NTS keys. +In Statime, these cookies contain encrypted versions of the NTS keys. The settings here control the generation and storage of these keys when acting as an NTP secured NTS server or NTS key exchange server. .TP diff --git a/pkg/apparmor/pendulum b/pkg/apparmor/pendulum index 47a7225d8..e4f90b002 100644 --- a/pkg/apparmor/pendulum +++ b/pkg/apparmor/pendulum @@ -9,7 +9,7 @@ include # but for development this profile is easier to work with. # # Load it using `apparmor_parser -r pkg/apparmor/pendulum` -# and then apply it using `aa-exec -p pendulum -- ` +# and then apply it using `aa-exec -p pendulum -- ` # profile pendulum flags=(enforce) { include @@ -27,9 +27,9 @@ profile pendulum flags=(enforce) { /run/statime/** rw, - # NOTE: this is for development only, assuming ntpd-rs is checked out in your home folder - @{HOME}/ntpd-rs/** r, - @{HOME}/**/ntpd-rs/** r, + # NOTE: this is for development only, assuming Statime is checked out in your home folder + @{HOME}/statime/** r, + @{HOME}/**/statime/** r, # NOTE: site-specific additions and overrides; this should probably also be something like # local/home.usr.sbin.statime-daemon if we turn this into an attached profile diff --git a/pps-time/README.md b/pps-time/README.md index b59194657..9af60328c 100644 --- a/pps-time/README.md +++ b/pps-time/README.md @@ -1,5 +1,5 @@ # PPS Time -A Rust interface for Pulse Per Second (PPS) devices, based on [RFC 2783](https://datatracker.ietf.org/doc/html/rfc2783). This crate is part of [Project Pendulum](https://github.com/pendulum-project), and is used in [ntpd-rs](https://github.com/pendulum-project/ntpd-rs). +A Rust interface for Pulse Per Second (PPS) devices, based on [RFC 2783](https://datatracker.ietf.org/doc/html/rfc2783). The `pps.rs` contains bindings that were automatically generated by rust-bindgen: ``` diff --git a/statime-netptp/src/lib.rs b/statime-netptp/src/lib.rs index 38c58aebd..28799b4d6 100644 --- a/statime-netptp/src/lib.rs +++ b/statime-netptp/src/lib.rs @@ -1,4 +1,4 @@ -//! Network handling for PTP/CSPTP in ntpd-rs/statime. +//! Network handling for PTP/CSPTP. //! //! This crate provides abstractions for dealing with the fact that both PTP //! and CSPTP need sockets with local bindings on ports 319 and 320. The @@ -7,12 +7,11 @@ //! one socket, making implementing of simultaneous use of PTP and CSPTP, as //! well as more than one CSPTP connection at the same time, easier. //! -//! This is mostly intended as an internal crate for the ntpd-rs/statime -//! ecosystem, though we plan to keep the version numbering consistent with -//! semver. Be aware that we might be making breaking changes fairly often -//! though when using this crate, and that we might not be receptive to changes -//! making it work better for your particular use case if those changes have no -//! value for ntpd-rs/statime ecosystem. +//! This is mostly intended as an internal crate, though we plan to keep the +//! version numbering consistent with semver. Be aware that we might be making +//! breaking changes fairly often though when using this crate, and that we +//! might not be receptive to changes making it work better for your particular +//! use case if those changes have no value for us. #![cfg(target_os = "linux")] use std::{ diff --git a/statime-ntp/Cargo.toml b/statime-ntp/Cargo.toml index 828be15cf..6fffbbbf0 100644 --- a/statime-ntp/Cargo.toml +++ b/statime-ntp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "statime-ntp" -description = "ntpd-rs packet parsing and algorithms" +description = "Statime packet parsing and algorithms" readme = "README.md" version = "0.1.0" edition.workspace = true diff --git a/statime-ntp/README.md b/statime-ntp/README.md index a32eb10a2..52a64072f 100644 --- a/statime-ntp/README.md +++ b/statime-ntp/README.md @@ -1,8 +1,8 @@ # statime-ntp -This crate contains packet parsing and algorithm code for ntpd-rs and is not +This crate contains packet parsing and algorithm code for Statime and is not intended as a public interface at this time. It follows the same version as the -main ntpd-rs crate, but that version is not intended to give any stability +main Statime crate, but that version is not intended to give any stability guarantee. Use at your own risk. -Please visit the [ntpd-rs](https://github.com/pendulum-project/ntpd-rs) project -for more information. +Please visit the [Statime](https://github.com/trifectatechfoundation/statime) +project for more information. diff --git a/statime-ntp/src/lib.rs b/statime-ntp/src/lib.rs index e04a68f1f..a9de04574 100644 --- a/statime-ntp/src/lib.rs +++ b/statime-ntp/src/lib.rs @@ -1,9 +1,9 @@ -//! This crate contains packet parsing and algorithm code for ntpd-rs and is not +//! This crate contains packet parsing and algorithm code for Statime and is not //! intended as a public interface at this time. It follows the same version as the -//! main ntpd-rs crate, but that version is not intended to give any stability +//! main Statime crate, but that version is not intended to give any stability //! guarantee. Use at your own risk. //! -//! Please visit the [ntpd-rs](https://github.com/pendulum-project/ntpd-rs) project +//! Please visit the [Statime](https://github.com/trifectatechfoundation/statime) project //! for more information. #![forbid(unsafe_code)] #![allow(missing_docs)] diff --git a/statime-ntp/test-keys/gen-cert.sh b/statime-ntp/test-keys/gen-cert.sh index 18bcfad08..d6a102adb 100755 --- a/statime-ntp/test-keys/gen-cert.sh +++ b/statime-ntp/test-keys/gen-cert.sh @@ -16,7 +16,7 @@ if [ -z "$1" ]; then exit fi -NAME="${1:-ntpd-rs.test}" +NAME="${1:-statime.test}" CA="${2:-testca}" FILENAME="${3:-$NAME}" diff --git a/statime-seccomp/Cargo.toml b/statime-seccomp/Cargo.toml index 7deb1d052..d656469a4 100644 --- a/statime-seccomp/Cargo.toml +++ b/statime-seccomp/Cargo.toml @@ -7,8 +7,8 @@ readme = "./NOTICE.md" publish = true rust-version = "1.95" # MSRV description = "Seccomp system call restricting for statime." -repository = "https://github.com/pendulum-project/ntpd-rs" -homepage = "https://github.com/pendulum-project/ntpd-rs" +repository = "https://github.com/trifectatechfoundation/statime" +homepage = "https://github.com/trifectatechfoundation/statime" [lints.rust] missing_docs = "deny" diff --git a/statime-seccomp/allowed.c b/statime-seccomp/allowed.c index 5ebb363ba..9660bac7a 100644 --- a/statime-seccomp/allowed.c +++ b/statime-seccomp/allowed.c @@ -143,7 +143,7 @@ SCMP_SYS(getresgid32), SCMP_SYS(clock_nanosleep), -// These additions are not found in NTPsec but are necessary for ntpd-rs. +// These additions are not found in NTPsec but are necessary for Statime. SCMP_SYS(sigaltstack), SCMP_SYS(epoll_create1), diff --git a/statime-wire/src/common/clock_quality.rs b/statime-wire/src/common/clock_quality.rs index 84711002e..bc6cf0b6f 100644 --- a/statime-wire/src/common/clock_quality.rs +++ b/statime-wire/src/common/clock_quality.rs @@ -31,7 +31,7 @@ impl Default for ClockQuality { clock_accuracy: ClockAccuracy::default(), // See 7.6.3.3 for the description of the calculation procedure. // We estimate clock variance of desktop to be no worse than - // 2^-23 seconds^2, based on experience from ntpd-rs + // 2^-23 seconds^2, based on experience from Statime offset_scaled_log_variance: 0x8000 - (23 * 256), } } diff --git a/statime.server.toml b/statime.server.toml index 12dbe97ab..413b6765a 100644 --- a/statime.server.toml +++ b/statime.server.toml @@ -21,7 +21,7 @@ count = 4 type = "ntp" listen = "[::]:123" -# Below are configured various thresholds beyond which ntpd-rs will not +# Below are configured various thresholds beyond which Statime will not # change the system clock. CHANGE THESE TO MATCH YOUR SECURITY NEEDS! # For guidance, see OPERATIONAL_CONSIDERATIONS.md [system-clock] diff --git a/statime/build.rs b/statime/build.rs index 6f4a1fd71..6601c09b8 100644 --- a/statime/build.rs +++ b/statime/build.rs @@ -13,7 +13,7 @@ fn main() { }; // use environment variable for the git commit rev if set - let git_rev = std::env::var("NTPD_RS_GIT_REV").ok(); + let git_rev = std::env::var("STATIME_GIT_REV").ok(); // allow usage of the GITHUB_SHA environment variable during CI let git_rev = if let Some(gr) = git_rev { @@ -38,7 +38,7 @@ fn main() { }; // use environment variable for the git commit date if set - let git_date = std::env::var("NTPD_RS_GIT_DATE").ok(); + let git_date = std::env::var("STATIME_GIT_DATE").ok(); // determine the date of the git commit (if there is any) let git_date = if let Some(gd) = git_date { @@ -65,11 +65,11 @@ fn main() { }; println!( - "cargo:rustc-env=NTPD_RS_GIT_REV={}", + "cargo:rustc-env=STATIME_GIT_REV={}", git_rev.unwrap_or("-".to_owned()) ); println!( - "cargo:rustc-env=NTPD_RS_GIT_DATE={}", + "cargo:rustc-env=STATIME_GIT_DATE={}", git_date.unwrap_or("-".to_owned()) ); println!("cargo:rustc-rerun-if-changed=.git/HEAD"); diff --git a/statime/src/daemon/config/mod.rs b/statime/src/daemon/config/mod.rs index a41659814..ff751645f 100644 --- a/statime/src/daemon/config/mod.rs +++ b/statime/src/daemon/config/mod.rs @@ -490,7 +490,7 @@ impl Config { SourceConfig::Csptp(_) => false, }) { warn!( - "Forcing a source into NTPv5, which is still a draft. There is no guarantee that the server will remain compatible with this or future versions of ntpd-rs." + "Forcing a source into NTPv5, which is still a draft. There is no guarantee that the server will remain compatible with this or future versions of Statime." ); ok = false; } diff --git a/statime/src/daemon/observer.rs b/statime/src/daemon/observer.rs index f7c13dd0c..a85670835 100644 --- a/statime/src/daemon/observer.rs +++ b/statime/src/daemon/observer.rs @@ -54,8 +54,8 @@ impl Default for ProgramData { fn default() -> Self { Self { version: env!("CARGO_PKG_VERSION").to_owned(), - build_commit: env!("NTPD_RS_GIT_REV").to_owned(), - build_commit_date: env!("NTPD_RS_GIT_DATE").to_owned(), + build_commit: env!("STATIME_GIT_REV").to_owned(), + build_commit_date: env!("STATIME_GIT_DATE").to_owned(), uptime_seconds: 0.0, now: Timestamp::from_seconds_nanos_since_unix_epoch(0, 0), } diff --git a/statime/src/metrics/exporter.rs b/statime/src/metrics/exporter.rs index 01b07f743..d1d3a4715 100644 --- a/statime/src/metrics/exporter.rs +++ b/statime/src/metrics/exporter.rs @@ -20,10 +20,10 @@ const USAGE_MSG: &str = "\ usage: statime-metrics [-c PATH] statime-metrics -h | statime-metrics -v"; -const DESCRIPTOR: &str = "statime-metrics - serve ntpd-rs openmetrics via http"; +const DESCRIPTOR: &str = "statime-metrics - serve Statime openmetrics via http"; const HELP_MSG: &str = "Options: - -c, --config=CONFIG ntpd-rs configuration file (default: + -c, --config=CONFIG Statime configuration file (default: /etc/statime/statime.toml) -h, --help display this help text -v, --version display version information"; @@ -331,7 +331,7 @@ mod tests { async fn deny_non_get_request() { let mut example = b"POST / HTTP/1.1\r\n\r\n".to_vec(); let mut cursor = Cursor::new(&mut example); - let res = handle_connection(&mut cursor, Path::new("/tmp/ntpd-rs.sock")).await; + let res = handle_connection(&mut cursor, Path::new("/tmp/statime.sock")).await; let err = res.unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::InvalidInput); assert_eq!(err.to_string(), "Expected GET request"); @@ -341,7 +341,7 @@ mod tests { async fn does_not_accept_large_requests() { let mut example = [1u8; 4096].to_vec(); let mut cursor = Cursor::new(&mut example); - let res = handle_connection(&mut cursor, Path::new("/tmp/ntpd-rs.sock")).await; + let res = handle_connection(&mut cursor, Path::new("/tmp/statime.sock")).await; let err = res.unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::InvalidInput); assert_eq!(err.to_string(), "Request too long"); diff --git a/utils/build-release.sh b/utils/build-release.sh index fb2324732..702276e1c 100755 --- a/utils/build-release.sh +++ b/utils/build-release.sh @@ -20,7 +20,7 @@ echo "--- Running on toolchain '${toolchain}', make sure the llvm-tools componen echo "--- Host target is '$host_target'" for target in "${targets[@]}"; do - dbg_sym_tar="ntpd-rs_dbg_$package_version-$target.tar.gz" + dbg_sym_tar="statime_dbg_$package_version-$target.tar.gz" echo "--- Calling cross for building statime package for target '$target'" cross build --target "$target" --package statime --release --features "${RELEASE_FEATURES:-}" diff --git a/utils/update-version.sh b/utils/update-version.sh index be73deacf..25c587326 100755 --- a/utils/update-version.sh +++ b/utils/update-version.sh @@ -34,10 +34,10 @@ echo "Updating rpm version in Cargo.toml" sed -i 's/^version = .* #MARKER: RPM-VERSION/version = "'"$RPM_VERSION"'" #MARKER: RPM-VERSION/' "$PROJECT_DIR"/statime/Cargo.toml echo "Updating version in man pages" -sed -i 's/^title: STATIME(8) ntpd-rs .*/title: STATIME(8) ntpd-rs '"$NEW_VERSION"' | ntpd-rs/' "$PROJECT_DIR"/docs/man/statime.8.md -sed -i 's/^title: STATIME-DAEMON(8) ntpd-rs .*/title: STATIME-DAEMON(8) ntpd-rs '"$NEW_VERSION"' | ntpd-rs/' "$PROJECT_DIR"/docs/man/statime-daemon.8.md -sed -i 's/^title: STATIME-METRICS(8) ntpd-rs .*/title: STATIME-METRICS(8) ntpd-rs '"$NEW_VERSION"' | ntpd-rs/' "$PROJECT_DIR"/docs/man/statime-metrics.8.md -sed -i 's/^title: STATIME.TOML(5) ntpd-rs .*/title: STATIME.TOML(5) ntpd-rs '"$NEW_VERSION"' | ntpd-rs/' "$PROJECT_DIR"/docs/man/statime.toml.5.md +sed -i 's/^title: STATIME(8) Statime .*/title: STATIME(8) Statime '"$NEW_VERSION"' | Statime/' "$PROJECT_DIR"/docs/man/statime.8.md +sed -i 's/^title: STATIME-DAEMON(8) Statime .*/title: STATIME-DAEMON(8) Statime '"$NEW_VERSION"' | Statime/' "$PROJECT_DIR"/docs/man/statime-daemon.8.md +sed -i 's/^title: STATIME-METRICS(8) Statime .*/title: STATIME-METRICS(8) Statime '"$NEW_VERSION"' | Statime/' "$PROJECT_DIR"/docs/man/statime-metrics.8.md +sed -i 's/^title: STATIME.TOML(5) Statime .*/title: STATIME.TOML(5) Statime '"$NEW_VERSION"' | Statime/' "$PROJECT_DIR"/docs/man/statime.toml.5.md echo "Rebuilding precompiled man pages" utils/generate-man.sh