2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-05-12 17:34:17 +00:00

Add ca-only policy

This policy forces CA validation every time.

This also checks things like date validity.
This commit is contained in:
Jarrod Johnson
2026-05-05 14:39:42 -04:00
parent 7bc76b62e6
commit dcb6aeca65
+3 -2
View File
@@ -306,7 +306,7 @@ class TLSCertVerifier(object):
self.cfm.set_node_attributes(
{self.node: {self.fieldname: fingerprint}})
return True
elif cert_matches(storedprint, certificate):
elif cert_matches(storedprint, certificate) and newpolicy != 'ca-only':
return True
fingerprint = get_fingerprint(certificate, 'sha256')
# No pinned certificate match, try to validate by CA if possible
@@ -320,7 +320,8 @@ class TLSCertVerifier(object):
{self.node: {self.fieldname: fingerprint}})
return True
except Exception:
pass
if newpolicy == 'ca-only':
raise
raise cexc.PubkeyInvalid(
'Mismatched certificate detected', certificate, fingerprint,
self.fieldname, 'mismatch')