]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
log more changes made by chronyc commands
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 1 Dec 2022 13:43:45 +0000 (14:43 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 1 Dec 2022 15:58:23 +0000 (16:58 +0100)
Log important changes from chronyc for auditing purposes.

Add log messages for:
- loaded symmetric keys and server NTS keys (logged also on start)
- modified maxupdateskew and makestep
- enabled/disabled local reference mode (logged also on start)
- reset time smoothing (logged also on clock steps)
- reset sources

keys.c
nts_ke_server.c
reference.c
smooth.c
sources.c

diff --git a/keys.c b/keys.c
index cc1131cfba4e48388ce4331813a374517c527f1b..11f8b761ce3ab0f62c7473cbed409be8f2583b09 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -255,6 +255,8 @@ KEY_Reload(void)
      more careful! */
   qsort(ARR_GetElements(keys), ARR_GetSize(keys), sizeof (Key), compare_keys_by_id);
 
+  LOG(LOGS_INFO, "Loaded %u symmetric keys", ARR_GetSize(keys));
+
   /* Check for duplicates */
   for (i = 1; i < ARR_GetSize(keys); i++) {
     if (get_key(i - 1)->id == get_key(i)->id)
index 95c6a3d602446d3d93d375a4f5ab0bb56739107a..6c60a5b34cba0d1d8e369308aecc85e7139d239a 100644 (file)
@@ -575,7 +575,7 @@ save_keys(void)
   return;
 
 error:
-  LOG(LOGS_ERR, "Could not %s server NTS keys", "save");
+  LOG(LOGS_ERR, "Could not %s %s", "save", "server NTS keys");
   fclose(f);
 
   if (!UTI_RemoveFile(dump_dir, DUMP_FILENAME, NULL))
@@ -649,10 +649,11 @@ load_keys(void)
 
   fclose(f);
 
+  LOG(LOGS_ERR, "Loaded %s", "server NTS keys");
   return 1;
 
 error:
-  LOG(LOGS_ERR, "Could not %s server NTS keys", "load");
+  LOG(LOGS_ERR, "Could not %s %s", "load", "server NTS keys");
   fclose(f);
 
   return 0;
index e6cc547752858c522b3c97f9297775c6cc0f46bb..97dfbe981f43a5956fa1f16582f167cc5af23344 100644 (file)
@@ -1329,6 +1329,7 @@ void
 REF_ModifyMaxupdateskew(double new_max_update_skew)
 {
   max_update_skew = new_max_update_skew * 1.0e-6;
+  LOG(LOGS_INFO, "New maxupdateskew %f ppm", new_max_update_skew);
 }
 
 /* ================================================== */
@@ -1338,6 +1339,7 @@ REF_ModifyMakestep(int limit, double threshold)
 {
   make_step_limit = limit;
   make_step_threshold = threshold;
+  LOG(LOGS_INFO, "New makestep %f %d", threshold, limit);
 }
 
 /* ================================================== */
@@ -1349,6 +1351,7 @@ REF_EnableLocal(int stratum, double distance, int orphan)
   local_stratum = CLAMP(1, stratum, NTP_MAX_STRATUM - 1);
   local_distance = distance;
   local_orphan = !!orphan;
+  LOG(LOGS_INFO, "%s local reference mode", "Enabled");
 }
 
 /* ================================================== */
@@ -1357,6 +1360,7 @@ void
 REF_DisableLocal(void)
 {
   enable_local_stratum = 0;
+  LOG(LOGS_INFO, "%s local reference mode", "Disabled");
 }
 
 /* ================================================== */
index 4c350e91c060fb301df85118c437827e55e10fd2..ee7094e82071d87719623b3904ae2735de699a73 100644 (file)
--- a/smooth.c
+++ b/smooth.c
@@ -302,7 +302,7 @@ SMT_Activate(struct timespec *now)
   if (!enabled || !locked)
     return;
 
-  LOG(LOGS_INFO, "Time smoothing activated%s", leap_only_mode ?
+  LOG(LOGS_INFO, "Activated %s%s", "time smoothing", leap_only_mode ?
       " (leap seconds only)" : "");
   locked = 0;
   last_update = *now;
@@ -322,6 +322,8 @@ SMT_Reset(struct timespec *now)
 
   for (i = 0; i < NUM_STAGES; i++)
     stages[i].wander = stages[i].length = 0.0;
+
+  LOG(LOGS_INFO, "Reset %s", "time smoothing");
 }
 
 void
index 2aee6f22d9a2d5ec3add3311917c667b4cf671d1..18b89c6d89bb17aabee4d816226c499b02b2910a 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -1546,6 +1546,8 @@ SRC_ResetSources(void)
 
   for (i = 0; i < n_sources; i++)
     SRC_ResetInstance(sources[i]);
+
+  LOG(LOGS_INFO, "Reset all sources");
 }
 
 /* ================================================== */