#aws #ntp #ec2 #time

bin+lib clock-bound-d

A daemon to provide clients with an error bounded timestamp interval

2 releases

Uses new Rust 2021

0.1.1 Dec 29, 2021
0.1.0 Nov 1, 2021

#63 in Date and time

34 downloads per month

GPL-2.0-only

56KB
760 lines

Crates.io License: GPL v2

ClockBoundD

A daemon to provide clients with an error bounded timestamp interval.

Prerequisites

chronyd must be running in order to run ClockBoundD. If running on Amazon Linux 2, chronyd is already set as the default NTP daemon for you.

If running on Amazon EC2, see the EC2 User Guide for more information on installing Chrony and syncing to the Amazon Time Sync Service.

Installation

Cargo

ClockBoundD can be installed using Cargo. Instructions on how to install cargo can be found at doc.rust-lang.org.

If it's your first time installing Cargo on an AL2 EC2 instance you may need to also install gcc:

sudo yum install gcc

Run cargo install:

cargo install clock-bound-d

If cargo was installed with the rustup link above the default install location will be at

$HOME/.cargo/bin/clockboundd

Systemd configuration

If built from source using cargo, it is recommended to set up systemd to manage ClockBoundD.

Configuration Example:

  • Move binary to the location you want to run it from
sudo mv $HOME/.cargo/bin/clockboundd /usr/local/bin/clockboundd
  • Create system user that systemd can use
sudo useradd -r clockbound
  • Create unit file /usr/lib/systemd/system/clockboundd.service with the following contents
[Unit]
Description=ClockBoundD

[Service]
Type=simple
Restart=always
RestartSec=10
ExecStart=/usr/local/bin/clockboundd
RuntimeDirectory=clockboundd
WorkingDirectory=/run/clockboundd
User=clockbound

[Install]
WantedBy=multi-user.target
  • Reload systemd
sudo systemctl daemon-reload
  • Enable ClockBoundD to start at boot
sudo systemctl enable clockboundd
  • Start ClockBoundD now
sudo systemctl start clockboundd

You can then check the status of the service with:

systemctl status clockboundd

Usage

To communicate with ClockBoundD a client is required. A rust client library exists at ClockBoundC that an application can use to communicate with ClockBoundD.

Custom Client

If you want to create a custom client see Custom Client for more information.

Logging

By default, ClockBoundD logs to syslog at /var/log/daemon.log.

syslog logs can be viewed with journalctl:

journalctl -u clockboundd

Updating README

This README is generated via cargo-readme. Updating can be done by running:

cargo readme > README.md

Security

See CONTRIBUTING for more information.

License

Licensed under the GPL v2 license.

Dependencies

~6MB
~97K SLoC

a