commit 4925e97: [Minor] Clickhouse: Add clock skew protection

Vsevolod Stakhov vsevolod at highsecure.ru
Fri May 3 17:42:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-05-03 18:36:19 +0100
URL: https://github.com/rspamd/rspamd/commit/4925e97c7de2560141703460fa62c5036bba680f (HEAD -> master)

[Minor] Clickhouse: Add clock skew protection

---
 src/plugins/lua/clickhouse.lua | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index 8351989e7..da8c736cc 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -576,6 +576,11 @@ local function clickhouse_collect(task)
 
   local scan_real,scan_virtual = task:get_scan_time()
   scan_real,scan_virtual = math.floor(scan_real * 1000), math.floor(scan_virtual * 1000)
+  if scan_real < 0 then
+    rspamd_logger.messagex(task, 'clock skew detected for message: %s ms real scan time (reset to 0), %s virtual scan time',
+        scan_real, scan_virtual)
+    scan_real = 0
+  end
 
   local row = {
     today(timestamp),


More information about the Commits mailing list