diff options
author | Rob Austein <sra@hactrn.net> | 2011-12-26 05:26:58 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2011-12-26 05:26:58 +0000 |
commit | ec05982af002fd02c50c977f8807ab6870b54118 (patch) | |
tree | 554d395cfe45158d9e3e8239ba7512149f598899 /rpkid | |
parent | 523a1f269dc1c19e3537fc0d1dc9b96a1e7fb8dc (diff) |
Checkpoint. Start debugging synchronization code.
svn path=/branches/tk100/; revision=4135
Diffstat (limited to 'rpkid')
-rw-r--r-- | rpkid/rpki/irdb/models.py | 4 | ||||
-rw-r--r-- | rpkid/rpki/rpkic.py | 34 |
2 files changed, 28 insertions, 10 deletions
diff --git a/rpkid/rpki/irdb/models.py b/rpkid/rpki/irdb/models.py index fad3b31a..7a72b4f6 100644 --- a/rpkid/rpki/irdb/models.py +++ b/rpkid/rpki/irdb/models.py @@ -336,8 +336,8 @@ class HostedCA(Certificate): def avow(self): self.certificate = self.issuer.certify( - subject_name = self.hosted_ca.getSubject(), - subject_key = self.hosted_ca.getPublicKey(), + subject_name = self.hosted.certificate.getSubject(), + subject_key = self.hosted.certificate.getPublicKey(), validity_interval = self.default_interval, is_ca = True, pathLenConstraint = 1) diff --git a/rpkid/rpki/rpkic.py b/rpkid/rpki/rpkic.py index 48749a15..a946ec65 100644 --- a/rpkid/rpki/rpkic.py +++ b/rpkid/rpki/rpkic.py @@ -809,6 +809,18 @@ class main(rpki.cli.Cmd): q.delete() + def do_synchronize(self, arg): + """ + Temporary testing hack (probably) to let me run .synchronize() + manually. + """ + + if arg: + raise BadCommandSyntax("Unexpected argument(s): %r" % arg) + + self.synchronize() + + def synchronize(self): """ Configure RPKI daemons with the data built up by the other @@ -897,7 +909,7 @@ class main(rpki.cli.Cmd): action = "create" if isinstance(self_pdu, rpki.left_right.report_error_elt) else "set", tag = "self", self_handle = ca.handle, - bpki_cert = self.cert.certificate, + bpki_cert = ca.certificate, crl_interval = self_crl_interval, regen_margin = self_regen_margin)) @@ -931,8 +943,11 @@ class main(rpki.cli.Cmd): # can finish setting up the BSC before anything tries to use it. if rpkid_query: + rpkid_query.append(rpki.left_right.bsc_elt.make_pdu(action = "list", tag = "bsc", self_handle = ca.handle)) rpkid_reply = call_rpkid(*rpkid_query) - bsc_pdus = dict((x.bsc_handle, x) for x in rpkid_reply if isinstance(x, rpki.left_right.bsc_elt)) + bsc_pdus = dict((x.bsc_handle, x) + for x in rpkid_reply + if isinstance(x, rpki.left_right.bsc_elt) and x.action == "list") bsc_pdu = bsc_pdus.pop(bsc_handle, None) for r in rpkid_reply: if isinstance(r, rpki.left_right.report_error_elt): @@ -946,7 +961,7 @@ class main(rpki.cli.Cmd): assert bsc_pdu.pkcs10_request is not None - bsc = rpki.irdb.BSC.get_or_certify( + bsc = rpki.irdb.BSC.objects.get_or_certify( issuer = ca, handle = bsc_handle, pkcs10 = bsc_pdu.pkcs10_request)[0] @@ -966,7 +981,7 @@ class main(rpki.cli.Cmd): # trees, but for the moment the easiest way forward is just to # enforce a 1:1 mapping between <parent/> and <repository/> objects - for repository in ca.repositories: + for repository in ca.repositories.all(): repository_pdu = repository_pdus.pop(repository.handle, None) @@ -991,7 +1006,7 @@ class main(rpki.cli.Cmd): # for an associated pair are the identical (that is: # parent.repository_handle == parent.parent_handle). - for parent in ca.parents: + for parent in ca.parents.all(): parent_pdu = parent_pdus.pop(parent.handle, None) @@ -1016,7 +1031,7 @@ class main(rpki.cli.Cmd): recipient_name = parent.parent_handle, bpki_cms_cert = parent.certificate)) - if ca.rootd: + try: parent_pdu = parent_pdus.pop(ca.handle, None) @@ -1041,6 +1056,9 @@ class main(rpki.cli.Cmd): recipient_name = ca.handle, bpki_cms_cert = ca.rootd.certificate)) + except rpki.irdb.Rootd.DoesNotExist: + pass + rpkid_query.extend(rpki.left_right.parent_elt.make_pdu( action = "destroy", self_handle = ca.handle, parent_handle = p) for p in parent_pdus) @@ -1048,7 +1066,7 @@ class main(rpki.cli.Cmd): # to construct and figuring out what certificate to use is their # problem, not ours. - for child in ca.children: + for child in ca.children.all(): child_pdu = child_pdus.pop(child.handle, None) @@ -1072,7 +1090,7 @@ class main(rpki.cli.Cmd): if self.run_pubd: - for client in self.server_ca.clients: + for client in self.server_ca.clients.all(): client_pdu = client_pdus.pop(client.handle, None) |