system: zero-fill the resulting hash to 8 characters

This is what certctl does and it was rightfully flagged as
"missing files" in the health audit, e.g.

/etc/ssl/blacklisted/80911ac.0 (wrong)

vs.

/etc/ssl/blacklisted/080911ac.0 (correct)
This commit is contained in:
Franco Fichtner 2023-12-21 08:23:25 +01:00
parent e44ad35ebe
commit add38843fb

View File

@ -76,7 +76,7 @@ def cmd_rehash():
continue
cert = get_cert(filename)
if cert:
nhash = hex(cert.subject_name_hash()).lstrip('0x')
nhash = hex(cert.subject_name_hash()).lstrip('0x').zfill(8)
if nhash not in targets[targetname]:
targets[targetname][nhash] = []
targets[targetname][nhash].append(filename)