diff options
-rwxr-xr-x | ca/tests/yamltest.py | 20 | ||||
-rw-r--r-- | rpki/pubdb/models.py | 12 |
2 files changed, 24 insertions, 8 deletions
diff --git a/ca/tests/yamltest.py b/ca/tests/yamltest.py index 7b0c0c8d..d467384a 100755 --- a/ca/tests/yamltest.py +++ b/ca/tests/yamltest.py @@ -766,6 +766,23 @@ class allocation(object): print "Running GUI for %s: pid %d process %r" % (self.name, p.pid, p) return p + def extract_root_cert_and_tal(self): + """ + Use rpkic to extract the root certficate and TAL and place them + where we can use them to check the published result using rcynic. + """ + + print + self.run_rpkic("extract_root_tal", "--output", + os.path.join(test_dir, "root.tal")) + + root_cer = self.path("root.cer") + self.run_rpkic("extract_root_certificate", "--output", root_cer) + gski = rpki.x509.X509(DER_file = root_cer).gSKI() + fn = self.path("publication.rrdp", gski + ".cer") + print "Linking", root_cer + print "to ", fn + os.link(root_cer, fn) logger = logging.getLogger(__name__) @@ -910,7 +927,6 @@ try: else: for d in db: - print print "Configuring", d.name print @@ -962,6 +978,8 @@ try: d.dump_ghostbusters() d.dump_router_certificates() + db.root.extract_root_cert_and_tal() + if args.run_gui: print print 'GUI user "root", password "fnord"' diff --git a/rpki/pubdb/models.py b/rpki/pubdb/models.py index b923b3f7..21508bed 100644 --- a/rpki/pubdb/models.py +++ b/rpki/pubdb/models.py @@ -96,12 +96,6 @@ class Session(models.Model): uuid = models.CharField(unique = True, max_length=36) serial = models.BigIntegerField() - ## @var keep_these_files - # Filenames which should not be deleted during cleanup. - # Expected use is to allow us to store a root certificate - # in in the RRDP base directory. - - keep_these_files = set(["root.cer", "root.tal"]) def new_delta(self, expires): """ @@ -190,7 +184,11 @@ class Session(models.Model): Write current RRDP files to disk, clean up old files and directories. """ - current_filenames = self.keep_these_files.copy() + if os.path.isdir(rrdp_publication_base): + current_filenames = set(fn for fn in os.listdir(rrdp_publication_base) + if fn.endswith(".cer") or fn.endswith(".tal")) + else: + current_filenames = set() snapshot_hash = self.write_snapshot_file(rrdp_publication_base) current_filenames.add(self.snapshot_fn) |