GithubHelp home page GithubHelp logo

set-system-time's Introduction

Signal K

signal-k-logo-tagline

Signal K is a modern and open data format for marine use. Built on standard web technologies including JSON, WebSockets and HTTP, Signal K provides a method for sharing information in a way that is friendly to WiFi, cellphones, tablets and the Internet. A format available to everyone, where anyone can contribute, Signal K is the first truly open data format for the marine industry and is set to revolutionize how we consume and interact with data on boats.

https://signalk.org

set-system-time's People

Contributors

fredericguilbault avatar humppafreak avatar tkurki avatar vokkim avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

set-system-time's Issues

Check if sudo is password less.

Hi, Im running signalk on a user with is not a sudoer.
In order to set the date I need to allow signalk to use sudo paswordless.
So I added a passwordless access to the command date.

signalk ALL=(ALL) NOPASSWD: /bin/date

But is seem like signalk need a wild card access (ALL) to sudo in order to check if it have permission to set date. Witch give a LOT of power to signalk and any plugins installed.

I would be quite more secure to allow signalk to only access the date command.

set-system-time ignores chrony

chrony installed and working OK synchronizing time at boot in Debian bullseye.

set-system-time plugin enabled:

imatge

even though chrony is present and working the plugin is setting time:

imatge

sources:

pi@openplotter:~ $ chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^- 192.92.6.30                   1   6   377    61    +62ms[  +62ms] +/-  196ms
^* ntp61.kashra-server.com       2   6   377    66  +7419us[+6273us] +/-   54ms
^- ntp1.torix.ca                 1   6   377    62  +8854us[+8854us] +/-   78ms
^- ntp68.kashra-server.com       2   6     7    63  +4830us[+4830us] +/-   61ms

chrony log:

pi@openplotter:~ $ journalctl -b -u chrony
-- Journal begins at Mon 2022-07-18 20:04:04 CEST, ends at Sun 2023-03-12 14:40:52 CET. --
Feb 12 14:29:17 openplotter systemd[1]: Starting chrony, an NTP client/server...
Feb 12 14:29:18 openplotter chronyd[624]: chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGN>
Feb 12 14:29:18 openplotter chronyd[624]: Frequency 8.309 +/- 12.134 ppm read from /var/lib/chrony/chrony.drift
Feb 12 14:29:19 openplotter chronyd[624]: Using right/UTC timezone to obtain leap second data
Feb 12 14:29:19 openplotter chronyd[624]: Loaded seccomp filter
Feb 12 14:29:19 openplotter systemd[1]: Started chrony, an NTP client/server.
Feb 12 14:29:53 openplotter chronyd[624]: Selected source 91.236.251.13 (2.debian.pool.ntp.org)
Feb 12 14:29:53 openplotter chronyd[624]: System clock wrong by 20.297028 seconds
Feb 12 14:30:13 openplotter chronyd[624]: System clock was stepped by 20.297028 seconds
Feb 12 14:30:13 openplotter chronyd[624]: System clock TAI offset set to 37 seconds
Feb 12 14:31:19 openplotter chronyd[624]: System clock wrong by 1.699830 seconds
Feb 12 14:31:21 openplotter chronyd[624]: System clock was stepped by 1.699825 seconds
Feb 12 14:32:26 openplotter chronyd[624]: Can't synchronise: no majority
Feb 12 14:32:27 openplotter chronyd[624]: Selected source 51.89.85.70 (2.debian.pool.ntp.org)
Mar 12 14:33:29 openplotter chronyd[624]: Forward time jump detected!
Mar 12 14:33:29 openplotter chronyd[624]: Can't synchronise: no selectable sources
Mar 12 14:35:39 openplotter chronyd[624]: Selected source 51.89.85.70 (2.debian.pool.ntp.org)
Mar 12 14:35:39 openplotter chronyd[624]: System clock wrong by -2419198.880293 seconds
Mar 12 14:35:42 openplotter chronyd[624]: Selected source 206.108.0.131 (2.debian.pool.ntp.org)
Mar 12 14:36:43 openplotter chronyd[624]: Selected source 51.89.85.70 (2.debian.pool.ntp.org)
Mar 12 14:36:45 openplotter chronyd[624]: Source 91.236.251.13 replaced with 51.195.26.117 (2.debian.pool.ntp.org)

This has critical side effects as failing handshakes when updating repositories:

Err:5 https://deb.nodesource.com/node_16.x bullseye InRelease
  Certificate verification failed: The certificate is NOT trusted. The revocation or OCSP data are old and have been superseded.  Could not handshake: Error in the certificate verification. [IP: 212.230.237.170 443]

disabling set-system-time and restarting chrony everything works OK:

pi@openplotter:~ $ journalctl -b -u chrony
-- Journal begins at Sat 2023-02-11 13:24:33 CET, ends at Sun 2023-03-12 14:50:43 CET. --
Feb 12 14:29:17 openplotter systemd[1]: Starting chrony, an NTP client/server...
Feb 12 14:29:18 openplotter chronyd[624]: chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGN>
Feb 12 14:29:18 openplotter chronyd[624]: Frequency 8.309 +/- 12.134 ppm read from /var/lib/chrony/chrony.drift
Feb 12 14:29:19 openplotter chronyd[624]: Using right/UTC timezone to obtain leap second data
Feb 12 14:29:19 openplotter chronyd[624]: Loaded seccomp filter
Feb 12 14:29:19 openplotter systemd[1]: Started chrony, an NTP client/server.
Feb 12 14:29:53 openplotter chronyd[624]: Selected source 91.236.251.13 (2.debian.pool.ntp.org)
Feb 12 14:29:53 openplotter chronyd[624]: System clock wrong by 20.297028 seconds
Feb 12 14:30:13 openplotter chronyd[624]: System clock was stepped by 20.297028 seconds
Feb 12 14:30:13 openplotter chronyd[624]: System clock TAI offset set to 37 seconds
Feb 12 14:31:19 openplotter chronyd[624]: System clock wrong by 1.699830 seconds
Feb 12 14:31:21 openplotter chronyd[624]: System clock was stepped by 1.699825 seconds
Feb 12 14:32:26 openplotter chronyd[624]: Can't synchronise: no majority
Feb 12 14:32:27 openplotter chronyd[624]: Selected source 51.89.85.70 (2.debian.pool.ntp.org)
Mar 12 14:33:29 openplotter chronyd[624]: Forward time jump detected!
Mar 12 14:33:29 openplotter chronyd[624]: Can't synchronise: no selectable sources
Mar 12 14:35:39 openplotter chronyd[624]: Selected source 51.89.85.70 (2.debian.pool.ntp.org)
Mar 12 14:35:39 openplotter chronyd[624]: System clock wrong by -2419198.880293 seconds
Mar 12 14:35:42 openplotter chronyd[624]: Selected source 206.108.0.131 (2.debian.pool.ntp.org)
Mar 12 14:36:43 openplotter chronyd[624]: Selected source 51.89.85.70 (2.debian.pool.ntp.org)
Mar 12 14:36:45 openplotter chronyd[624]: Source 91.236.251.13 replaced with 51.195.26.117 (2.debian.pool.ntp.org)
Mar 12 14:50:43 openplotter chronyd[624]: chronyd exiting
Mar 12 14:50:43 openplotter systemd[1]: Stopping chrony, an NTP client/server...
Mar 12 14:50:43 openplotter systemd[1]: chrony.service: Succeeded.
Mar 12 14:50:43 openplotter systemd[1]: Stopped chrony, an NTP client/server.
Mar 12 14:50:43 openplotter systemd[1]: Starting chrony, an NTP client/server...
Mar 12 14:50:43 openplotter chronyd[7781]: chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIG>
Mar 12 14:50:43 openplotter chronyd[7781]: Frequency 20.494 +/- 35.339 ppm read from /var/lib/chrony/chrony.drift
Mar 12 14:50:43 openplotter chronyd[7781]: Using right/UTC timezone to obtain leap second data
Mar 12 14:50:43 openplotter chronyd[7781]: Loaded seccomp filter
Mar 12 14:50:43 openplotter systemd[1]: Started chrony, an NTP client/server.
Mar 12 14:50:48 openplotter chronyd[7781]: Selected source 162.159.200.123 (2.debian.pool.ntp.org)
Mar 12 14:50:48 openplotter chronyd[7781]: System clock wrong by -2419116.741169 seconds
Feb 12 14:52:12 openplotter chronyd[7781]: System clock was stepped by -2419116.741169 seconds
Feb 12 14:52:12 openplotter chronyd[7781]: System clock TAI offset set to 37 seconds
Feb 12 14:52:13 openplotter chronyd[7781]: Selected source 176.9.157.155 (2.debian.pool.ntp.org)

date: unrecognized option '--iso-8601'

I'm running signalk on a Victron Venus GX, which is a beaglebone board. I'm getting the follwing error in signalk:
@signalk/set-system-time:date: unrecognized option '--iso-8601' BusyBox v1.31.1 (2021-12-17 08:58:32 UTC) multi-call binary. Usage: date [OPTIONS] [+FMT] [TIME]

I assume this is due to a slightly different binary in this busybox install.

Option to use sk time only if there is no other sources available.

In a near future I would like to work on a pull-request witch would add a checkbox option prevent sk from setting the date if chrony have some valid time source.

The point is, sk time seem to be the loosest approch to set time on a *nix machine :

  1. ntp time: 0.050 to 0.100 seconds accuracy
  2. GPS PPS: 0.0001 to 1 seconds accuracy (depend A LOT on the receiver apparently )
  3. sk time : 1 to 2 seconds (if I understand it right).

But it's often the only time source available. So I want to use it as fallback option.

This would be the command that check chrony have valid time input from NTP or GPS PPS :

chronyc sources | cut -c2 | grep -ce '-\|*'

Would it fit in the set-system-time plugin ?

streambundle error

When this plugin is activated, it complains that streambundle is missing and node crashes. I see the require line is commented out.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.