From 5875a80ad0321e892aa7662c80c9cb8660c082fb Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 15 May 2015 12:42:50 +0200 Subject: Print base16 of root hash instead of base64. --- tools/check-sth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/check-sth.py b/tools/check-sth.py index da52575..507c447 100755 --- a/tools/check-sth.py +++ b/tools/check-sth.py @@ -9,6 +9,7 @@ import argparse import json import errno import shutil +import base64 from datetime import datetime, timedelta, tzinfo from certtools import get_sth @@ -68,13 +69,12 @@ class UTC(tzinfo): def check_age(sth): now = datetime.now(UTC()) sth_time = datetime.fromtimestamp(sth['timestamp'] / 1000, UTC()) + roothash = base64.b16encode(base64.decodestring(sth['sha256_root_hash'])) if now > sth_time + timedelta(0, 6 * 3600): - print "CRITICAL: %s is older than 6h: %s UTC" % \ - (sth['sha256_root_hash'], sth_time) + print "CRITICAL: %s is older than 6h: %s UTC" % (roothash, sth_time) sys.exit(NAGIOS_CRIT) if now > sth_time + timedelta(0, 2 * 3600): - print "WARNING: %s is older than 2h: %s UTC" % \ - (sth['sha256_root_hash'], sth_time) + print "WARNING: %s is older than 2h: %s UTC" % (roothash, sth_time) sys.exit(NAGIOS_WARN) def check_treesize(cur, prev): -- cgit v1.1