mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Extend Sub CA replication test
Test more scenarios like replication replica -> master. Verify that master and replica have all expected certs with correct trust flags and all keys. See: https://pagure.io/freeipa/issue/7590 See: https://pagure.io/freeipa/issue/7589 Fixes: https://pagure.io/freeipa/issue/7611 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
@@ -205,6 +205,17 @@ def verify_kdc_cert_validity(kdc_cert, ca_certs, realm):
|
||||
raise ValueError("invalid for realm %s" % realm)
|
||||
|
||||
|
||||
CERT_RE = re.compile(
|
||||
r'^(?P<nick>.+?)\s+(?P<flags>\w*,\w*,\w*)\s*$'
|
||||
)
|
||||
KEY_RE = re.compile(
|
||||
r'^<\s*(?P<slot>\d+)>'
|
||||
r'\s+(?P<algo>\w+)'
|
||||
r'\s+(?P<keyid>[0-9a-z]+)'
|
||||
r'\s+(?P<nick>.*?)\s*$'
|
||||
)
|
||||
|
||||
|
||||
class NSSDatabase(object):
|
||||
"""A general-purpose wrapper around a NSS cert database
|
||||
|
||||
@@ -465,10 +476,10 @@ class NSSDatabase(object):
|
||||
# FIXME, this relies on NSS never changing the formatting of certutil
|
||||
certlist = []
|
||||
for cert in certs:
|
||||
match = re.match(r'^(.+?)\s+(\w*,\w*,\w*)\s*$', cert)
|
||||
match = CERT_RE.match(cert)
|
||||
if match:
|
||||
nickname = match.group(1)
|
||||
trust_flags = parse_trust_flags(match.group(2))
|
||||
nickname = match.group('nick')
|
||||
trust_flags = parse_trust_flags(match.group('flags'))
|
||||
certlist.append((nickname, trust_flags))
|
||||
|
||||
return tuple(certlist)
|
||||
@@ -481,10 +492,14 @@ class NSSDatabase(object):
|
||||
return ()
|
||||
keylist = []
|
||||
for line in result.output.splitlines():
|
||||
mo = re.match(r'^<\s*(\d+)>\s+(\w+)\s+([0-9a-z]+)\s+(.*)$', line)
|
||||
mo = KEY_RE.match(line)
|
||||
if mo is not None:
|
||||
slot, algo, keyid, nick = mo.groups()
|
||||
keylist.append((int(slot), algo, keyid, nick.strip()))
|
||||
keylist.append((
|
||||
int(mo.group('slot')),
|
||||
mo.group('algo'),
|
||||
mo.group('keyid'),
|
||||
mo.group('nick'),
|
||||
))
|
||||
return tuple(keylist)
|
||||
|
||||
def find_server_certs(self):
|
||||
|
||||
Reference in New Issue
Block a user