diff options
author | Linus Nordberg <linus@nordberg.se> | 2015-05-15 12:42:50 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2015-05-15 12:42:50 +0200 |
commit | 5875a80ad0321e892aa7662c80c9cb8660c082fb (patch) | |
tree | 6f60dbd2c1dfba71e652c952aa11062ab9ceb9df /tools/check-sth.py | |
parent | 0b59895ba9e22923a4b5eea2a314fe2d31b42b78 (diff) |
Print base16 of root hash instead of base64.
Diffstat (limited to 'tools/check-sth.py')
-rwxr-xr-x | tools/check-sth.py | 8 |
1 files 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): |