# Chrony

Parses the chrony config file

Author: Pat Riehecky rieh.nosp@m.ecky@fnal.nosp@m..gov

Summary

Chrony | Parses the chrony config file
Reference | This lens tries to keep as close as possible to chrony config syntax
License | This file is licenced under the LGPL v2+, like the rest of Augeas.
Lens Usage | To be documented
Configuration files | This lens applies to /etc/chrony.conf
Import provided expressions |
empty |
eol |
space |
email_addr |
word |
integer |
decimal |
ip |
path |
Create required expressions |
number |
address_re |
comment | from 4.2.1 of the upstream doc Chrony comments start with: !
no_space | No spaces or comment characters
cmd_options | Server/Peer/Pool options with values
cmd_flags | Server/Peer/Pool options without values
ntp_source | Server/Peer/Pool key names
allowdeny_types | Key names for access configuration
hwtimestamp_options | HW timestamping options with values
hwtimestamp_flags | HW timestamping options without values
local_options | local options with values
local_flags | local options without values
ratelimit_options | Rate limiting options with values
refclock_options | refclock options with values
refclock_flags | refclock options without values
flags | Options without values
log_flags | log has a specific options list
simple_keys | Options with single values
Make some sub-lenses for use in later lenses |
host_flags |
host_options |
log_flag_list |
store_address |
Lenses for parsing out sections |
all_flags | options without any arguments
kv | options with only one arg can be directly mapped to key = value
Options with multiple values | Each of these gets their own parsing block
host_list | Find all NTP sources and their flags/options
allowdeny | allow/deny/cmdallow/cmddeny has a specific syntax
log_list | log has a specific options list
bcast | broadcast has specific syntax
fdrift | fallbackdrift has specific syntax
hwtimestamp | hwtimestamp has specific syntax
istepslew | initstepslew has specific syntax
local | local has specific syntax
email | mailonchange has specific syntax
makestep | makestep has specific syntax
maxchange | maxchange has specific syntax
ratelimit | ratelimit/cmdratelimit has specific syntax
refclock | refclock has specific syntax
smoothtime | smoothtime has specific syntax
tempcomp | tempcomp has specific syntax
Final lense summary |
settings | All supported chrony settings
lns | The crony lens
filter | The files parsed by default

### Reference

This lens tries to keep as close as possible to chrony config syntax

See http://chrony.tuxfamily.org/manual.html#Configuration-file

### License

This file is licenced under the LGPL v2+, like the rest of Augeas.

### Lens Usage

To be documented

### Configuration files

This lens applies to /etc/chrony.conf

See filter.

### Import provided expressions

### empty

> let empty = Util.empty

### eol

> let eol = Util.eol

### space

> let space = Sep.space

### email_addr

> let email_addr = Rx.email_addr

### word

> let word = Rx.word

### integer

> let integer = Rx.relinteger

### decimal

> let decimal = Rx.reldecimal

### ip

> let ip = Rx.ip

### path

> let path = Rx.fspath

### Create required expressions

### number

> let number = integer | decimal | decimal . /[eE]/ . integer

### address_re

> let address_re = Rx.ip | Rx.hostname

### comment

> let comment = Util.comment_generic /[ \t]*[!;#%][ \t]*/ "# "

from 4.2.1 of the upstream doc Chrony comments start with: ! ; # or % and must be on their own line

### no_space

> let no_space = /[^ \t\r\n!;#%]+/

No spaces or comment characters

### cmd_options

> let cmd_options = "asymmetry" | "key" | /maxdelay((dev)?ratio)?/ | /(min|max)poll/ | /(min|max)samples/ | "maxsources" | "mindelay" | "offset" | "polltarget" | "port" | "presend" | "version"

Server/Peer/Pool options with values

### cmd_flags

> let cmd_flags = "auto_offline"|"iburst"|"noselect"|"offline"|"prefer" |"require"|"trust"|"xleave"|"burst"

Server/Peer/Pool options without values

### ntp_source

> let ntp_source = "server"|"peer"|"pool"

Server/Peer/Pool key names

### allowdeny_types

> let allowdeny_types = "allow"|"deny"|"cmdallow"|"cmddeny"

Key names for access configuration

### hwtimestamp_options

> let hwtimestamp_options = "minpoll"|"precision"|"rxcomp"|"txcomp" |"rxfilter"

HW timestamping options with values

### hwtimestamp_flags

> let hwtimestamp_flags = "nocrossts"

HW timestamping options without values

### local_options

> let local_options = "stratum"|"distance"

local options with values

### local_flags

> let local_flags = "orphan"

local options without values

### ratelimit_options

> let ratelimit_options = "interval"|"burst"|"leak"

Rate limiting options with values

### refclock_options

> let refclock_options = "refid"|"lock"|"poll"|"dpoll"|"

refclock options with values

### refclock_flags

> let refclock_flags = "noselect"|"pps"|"prefer"|"require"|"tai"|"trust"

refclock options without values

### flags

> let flags = "dumponexit" | "generatecommandkey" | "lock_all" | "manual" | "noclientlog" | "rtconutc" | "rtcsync"

Options without values

### log_flags

> let log_flags = "measurements"|"rawmeasurements"|"refclocks"|"rtc" |"statistics"|"tempcomp"|"tracking"

log has a specific options list

### simple_keys

> let simple_keys = "acquisitionport" | "bindacqaddress" | "bindaddress" | "bindcmdaddress" | "clientloglimit" | "combinelimit" | "commandkey" | "cmdport" | "corrtimeratio" | "driftfile" | "dumpdir" | "hwclockfile" | "include" | "keyfile" | "leapsecmode" | "leapsectz" | "linux_freq_scale" | "linux_hz" | "logbanner" | "logchange" | "logdir" | "maxclockerror" | "maxdistance" | "maxdrift" | "maxjitter" | "maxsamples" | "maxslewrate" | "maxupdateskew" | "minsamples" | "minsources" | "ntpsigndsocket" | "pidfile" | "port" | "reselectdist" | "rtcautotrim" | "rtcdevice" | "rtcfile" | "sched_priority" | "stratumweight" | "user"

Options with single values

### Make some sub-lenses for use in later lenses

### host_flags

> let host_flags = [ space . key cmd_flags ]

### host_options

> let host_options = [ space . key cmd_options . space . store number ]

### log_flag_list

> let log_flag_list = [ space . key log_flags ]

### store_address

> let store_address = [ label "address" . store address_re ]

### Lenses for parsing out sections

### all_flags

> let all_flags = [ Util.indent . key flags . eol ]

options without any arguments

### kv

> let kv = [ Util.indent . key simple_keys . space . (store no_space) . eol ]

options with only one arg can be directly mapped to key = value

### Options with multiple values

Each of these gets their own parsing block

- server|peer|pool <address> <options>
- allow|deny|cmdallow|cmddeny [all] [<address[/subnet]>]
- log <options>
- broadcast <interval> <address> <optional port>
- fallbackdrift <min> <max>
- hwtimestamp <interface> <options>
- initstepslew <threshold> <addr> <optional extra addrs>
- local <options>
- mailonchange <emailaddress> <threshold>
- makestep <threshold> <limit>
- maxchange <threshold> <delay> <limit>
- ratelimit|cmdratelimit <options>
- refclock <driver> <parameter> <options>
- smoothtime <maxfreq> <maxwander> <options>
- tempcomp <sensorfile> <interval> (<t0> <k0> <k1> <k2> | <pointfile> )

### host_list

> let host_list = [ Util.indent . key ntp_source . space . store address_re . ( host_flags | host_options )* . eol ]

Find all NTP sources and their flags/options

### allowdeny

> let allowdeny = [ Util.indent . key allowdeny_types . [ space . key "all" ]? . ( space . store ( no_space - "all" ) )? . eol ]

allow/deny/cmdallow/cmddeny has a specific syntax

### log_list

> let log_list = [ Util.indent . key "log" . log_flag_list+ . eol ]

log has a specific options list

### bcast

> let bcast = [ Util.indent . key "broadcast" . space . [ label "interval" . store integer ] . space . store_address . ( space . [ label "port" . store integer ] )? . eol ]

broadcast has specific syntax

### fdrift

> let fdrift = [ Util.indent . key "fallbackdrift" . space . [ label "min" . store integer ] . space . [ label "max" . store integer ] . eol ]

fallbackdrift has specific syntax

### hwtimestamp

> let hwtimestamp = [ Util.indent . key "hwtimestamp" . space . [ label "interface" . store no_space ] . ( space . ( [ key hwtimestamp_flags ] | [ key hwtimestamp_options . space . store no_space ] ) )* . eol ]

hwtimestamp has specific syntax

### istepslew

> let istepslew = [ Util.indent . key "initstepslew" . space . [ label "threshold" . store number ] . ( space . store_address )+ . eol ]

initstepslew has specific syntax

### local

> let local = [ Util.indent . key "local" . ( space . ( [ key local_flags ] | [ key local_options . space . store no_space ] ) )* . eol ]

local has specific syntax

### email

> let email = [ Util.indent . key "mailonchange" . space . [ label "emailaddress" . store email_addr ] . space . [ label "threshold" . store number ] . eol ]

mailonchange has specific syntax

### makestep

> let makestep = [ Util.indent . key "makestep" . space . [ label "threshold" . store number ] . space . [ label "limit" . store integer ] . eol ]

makestep has specific syntax

### maxchange

> let maxchange = [ Util.indent . key "maxchange" . space . [ label "threshold" . store number ] . space . [ label "delay" . store integer ] . space . [ label "limit" . store integer ] . eol ]

maxchange has specific syntax

### ratelimit

> let ratelimit = [ Util.indent . key /(cmd)?ratelimit/ . [ space . key ratelimit_options . space . store no_space ]* . eol ]

ratelimit/cmdratelimit has specific syntax

### refclock

> let refclock = [ Util.indent . key "refclock" . space . [ label "driver" . store word ] . space . [ label "parameter" . store no_space ] . ( space . ( [ key refclock_flags ] | [ key refclock_options . space . store no_space ] ) )* . eol ]

refclock has specific syntax

### smoothtime

> let smoothtime = [ Util.indent . key "smoothtime" . space . [ label "maxfreq" . store number ] . space . [ label "maxwander" . store number ] . ( space . [ key "leaponly" ] )? . eol ]

smoothtime has specific syntax

### tempcomp

> let tempcomp = [ Util.indent . key "tempcomp" . space . [ label "sensorfile" . store path ] . space . [ label "interval" . store number ] . space . ( [ label "t0" . store number ] . space . [ label "k0" . store number ] . space . [ label "k1" . store number ] . space . [ label "k2" . store number ] | [ label "pointfile" . store path ] ) . eol ]

tempcomp has specific syntax

### Final lense summary

### settings

> let settings = host_list | allowdeny | log_list | bcast | fdrift | istepslew | local | email | makestep | maxchange | refclock | smoothtime | hwtimestamp | ratelimit | tempcomp | kv | all_flags

All supported chrony settings

### lns

> let lns = ( empty | comment | settings )*

The crony lens

### filter

The files parsed by default

> let empty = Util.empty

> let eol = Util.eol

> let space = Sep.space

> let email_addr = Rx.email_addr

> let word = Rx.word

> let integer = Rx.relinteger

> let decimal = Rx.reldecimal

> let ip = Rx.ip

> let path = Rx.fspath

> let number = integer | decimal | decimal . /[eE]/ . integer

> let address_re = Rx.ip | Rx.hostname

> let comment = Util.comment_generic /[ \t]*[!;#%][ \t]*/ "# "

from 4.2.1 of the upstream doc Chrony comments start with: !

> let no_space = /[^ \t\r\n!;#%]+/

No spaces or comment characters

> let cmd_options = "asymmetry" | "key" | /maxdelay((dev)?ratio)?/ | /(min|max)poll/ | /(min|max)samples/ | "maxsources" | "mindelay" | "offset" | "polltarget" | "port" | "presend" | "version"

Server/Peer/Pool options with values

> let cmd_flags = "auto_offline"|"iburst"|"noselect"|"offline"|"prefer" |"require"|"trust"|"xleave"|"burst"

Server/Peer/Pool options without values

> let ntp_source = "server"|"peer"|"pool"

Server/Peer/Pool key names

> let allowdeny_types = "allow"|"deny"|"cmdallow"|"cmddeny"

Key names for access configuration

> let hwtimestamp_options = "minpoll"|"precision"|"rxcomp"|"txcomp" |"rxfilter"

HW timestamping options with values

> let hwtimestamp_flags = "nocrossts"

HW timestamping options without values

> let local_options = "stratum"|"distance"

local options with values

> let local_flags = "orphan"

local options without values

> let ratelimit_options = "interval"|"burst"|"leak"

Rate limiting options with values

> let refclock_options = "refid"|"lock"|"poll"|"dpoll"|"

refclock options with values

> let refclock_flags = "noselect"|"pps"|"prefer"|"require"|"tai"|"trust"

refclock options without values

> let flags = "dumponexit" | "generatecommandkey" | "lock_all" | "manual" | "noclientlog" | "rtconutc" | "rtcsync"

Options without values

> let log_flags = "measurements"|"rawmeasurements"|"refclocks"|"rtc" |"statistics"|"tempcomp"|"tracking"

log has a specific options list

> let simple_keys = "acquisitionport" | "bindacqaddress" | "bindaddress" | "bindcmdaddress" | "clientloglimit" | "combinelimit" | "commandkey" | "cmdport" | "corrtimeratio" | "driftfile" | "dumpdir" | "hwclockfile" | "include" | "keyfile" | "leapsecmode" | "leapsectz" | "linux_freq_scale" | "linux_hz" | "logbanner" | "logchange" | "logdir" | "maxclockerror" | "maxdistance" | "maxdrift" | "maxjitter" | "maxsamples" | "maxslewrate" | "maxupdateskew" | "minsamples" | "minsources" | "ntpsigndsocket" | "pidfile" | "port" | "reselectdist" | "rtcautotrim" | "rtcdevice" | "rtcfile" | "sched_priority" | "stratumweight" | "user"

Options with single values

> let host_flags = [ space . key cmd_flags ]

> let host_options = [ space . key cmd_options . space . store number ]

> let log_flag_list = [ space . key log_flags ]

> let store_address = [ label "address" . store address_re ]

> let all_flags = [ Util.indent . key flags . eol ]

options without any arguments

> let kv = [ Util.indent . key simple_keys . space . (store no_space) . eol ]

options with only one arg can be directly mapped to key = value

> let host_list = [ Util.indent . key ntp_source . space . store address_re . ( host_flags | host_options )* . eol ]

Find all NTP sources and their flags/options

> let allowdeny = [ Util.indent . key allowdeny_types . [ space . key "all" ]? . ( space . store ( no_space - "all" ) )? . eol ]

allow/deny/cmdallow/cmddeny has a specific syntax

> let log_list = [ Util.indent . key "log" . log_flag_list+ . eol ]

log has a specific options list

> let bcast = [ Util.indent . key "broadcast" . space . [ label "interval" . store integer ] . space . store_address . ( space . [ label "port" . store integer ] )? . eol ]

broadcast has specific syntax

> let fdrift = [ Util.indent . key "fallbackdrift" . space . [ label "min" . store integer ] . space . [ label "max" . store integer ] . eol ]

fallbackdrift has specific syntax

> let hwtimestamp = [ Util.indent . key "hwtimestamp" . space . [ label "interface" . store no_space ] . ( space . ( [ key hwtimestamp_flags ] | [ key hwtimestamp_options . space . store no_space ] ) )* . eol ]

hwtimestamp has specific syntax

> let istepslew = [ Util.indent . key "initstepslew" . space . [ label "threshold" . store number ] . ( space . store_address )+ . eol ]

initstepslew has specific syntax

> let local = [ Util.indent . key "local" . ( space . ( [ key local_flags ] | [ key local_options . space . store no_space ] ) )* . eol ]

local has specific syntax

> let email = [ Util.indent . key "mailonchange" . space . [ label "emailaddress" . store email_addr ] . space . [ label "threshold" . store number ] . eol ]

mailonchange has specific syntax

> let makestep = [ Util.indent . key "makestep" . space . [ label "threshold" . store number ] . space . [ label "limit" . store integer ] . eol ]

makestep has specific syntax

> let maxchange = [ Util.indent . key "maxchange" . space . [ label "threshold" . store number ] . space . [ label "delay" . store integer ] . space . [ label "limit" . store integer ] . eol ]

maxchange has specific syntax

> let ratelimit = [ Util.indent . key /(cmd)?ratelimit/ . [ space . key ratelimit_options . space . store no_space ]* . eol ]

ratelimit/cmdratelimit has specific syntax

> let refclock = [ Util.indent . key "refclock" . space . [ label "driver" . store word ] . space . [ label "parameter" . store no_space ] . ( space . ( [ key refclock_flags ] | [ key refclock_options . space . store no_space ] ) )* . eol ]

refclock has specific syntax

> let smoothtime = [ Util.indent . key "smoothtime" . space . [ label "maxfreq" . store number ] . space . [ label "maxwander" . store number ] . ( space . [ key "leaponly" ] )? . eol ]

smoothtime has specific syntax

> let tempcomp = [ Util.indent . key "tempcomp" . space . [ label "sensorfile" . store path ] . space . [ label "interval" . store number ] . space . ( [ label "t0" . store number ] . space . [ label "k0" . store number ] . space . [ label "k1" . store number ] . space . [ label "k2" . store number ] | [ label "pointfile" . store path ] ) . eol ]

tempcomp has specific syntax

> let settings = host_list | allowdeny | log_list | bcast | fdrift | istepslew | local | email | makestep | maxchange | refclock | smoothtime | hwtimestamp | ratelimit | tempcomp | kv | all_flags

All supported chrony settings

> let lns = ( empty | comment | settings )*

The crony lens
The files parsed by default
Close