beac0n / ruroco

Ruroco is a tool that lets you execute commands on a server by sending UDP packets. The commands are configured on the server side, so the client does not define what is going to be executed, it only picks from existing commands.
MIT License
526 stars 15 forks source link

How to handle clock sync issues on server vs client #8

Closed beac0n closed 1 month ago

alexxroche commented 2 months ago

Isn't that an issue for ntp ? ntpd and chronyd seem to manage to keep, even a poor quality clock in, a virtual host from drifting more than a second.

beac0n commented 2 months ago

Correct, but a linux host does not have to use ntp (maybe via smth like this: https://github.com/vpetrigo/sntpc).

So my idea was to not rely on SystemTime::now() (https://github.com/beac0n/ruroco/blob/b5210c1a6fd6b7179df7b042aa345df61014458a/src/common.rs#L9) but to automatically get the time from a ntp server.

This could be configurable on the client (--ntp argument) and on the server (ntp = ... config). Possible values could be default, none, <ip-address/host-of-ntp-server>.

Default could be a well known ntp server, or just "none" - I'm unsure of the best default setting, because on the one hand I would like the software to "just work" but on the other hand I don't want produce any additional network traffic, even if its just using ntp.