diff --git a/README.md b/README.md index 67e8b05..fef0a1c 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,12 @@ chrony will be configured to: > be reported using the clients command in chronyc. This option also effectively disables server support > for the NTP interleaved mode. +### Remote monitoring + +If you'd like to enable remote monitoring, you can pass the environment variable `ALLOW_REMOTE_MON` set to +`true` to the container. This will let you run `chronyc` commands from another host. + +You can use this to check the status of the NTP server without the need to run docker commands. ## Logging diff --git a/assets/startup.sh b/assets/startup.sh index caa38a1..2754b58 100755 --- a/assets/startup.sh +++ b/assets/startup.sh @@ -65,6 +65,17 @@ for N in $NTP_SERVERS; do fi done +# Remote access to the chrony server +if [ "${ALLOW_REMOTE_MON:-false}" = true ]; then + { + echo + echo "# allow remote monitoring" + echo "cmdallow all" + echo "bindcmdaddress 0.0.0.0" + echo "bindcmdaddress ::" + } >> ${CHRONY_CONF_FILE} +fi + # final bits for the config file { echo diff --git a/docker-compose.yml b/docker-compose.yml index dd16f18..532c797 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,3 +14,4 @@ services: # - TZ=America/Vancouver # - NOCLIENTLOG=true # - ENABLE_NTS=true +# - ALLOW_REMOTE_MON=true diff --git a/run.sh b/run.sh index 9dbd3eb..e8d5998 100755 --- a/run.sh +++ b/run.sh @@ -20,6 +20,7 @@ function start_container() { --env=ENABLE_NTS=${ENABLE_NTS} \ --env=NOCLIENTLOG=${NOCLIENTLOG} \ --env=LOG_LEVEL=${LOG_LEVEL} \ + --env=ALLOW_REMOTE_MON=${ALLOW_REMOTE_MON} \ --read-only=true \ --tmpfs=/etc/chrony:rw,mode=1750 \ --tmpfs=/run/chrony:rw,mode=1750 \ diff --git a/vars b/vars index 96a00c6..ae62833 100644 --- a/vars +++ b/vars @@ -26,3 +26,6 @@ LOG_LEVEL=0 # (optional) additional docker run options you may want DOCKER_OPTS="" + +# (optional) allow remote access to chronyd +ALLOW_REMOTE_MON=false