def test_expiring_certs(self): """Test that image-create will not raise exception for expiring certificates. (Bug 17768096)""" tmp_dir = tempfile.mkdtemp(dir=self.test_root) # Retrive the correct CA and use it to generate a new cert. test_ca = self.get_pub_ta("test") test_cs = "cs1_{0}".format(test_ca) # Add a certificate to the length 2 chain that is going to # expire in 27 days. cg = certgenerator.CertGenerator(base_dir=tmp_dir) cg.make_cs_cert(test_cs, test_ca, ca_path=self.path_to_certs, expiring=True, https=True) self.ac.start() self.image_create() # Set https-based publisher with expiring cert. self.seed_ta_dir("ta7") self.pkg("image-create -f --user -k {key} -c {cert} " "-p test={url} {path}/image".format( url=self.acurl1, cert=os.path.join(cg.cs_dir, "{0}_cert.pem".format(test_cs)), key=os.path.join(cg.keys_dir, "{0}_key.pem".format(test_cs)), path=tmp_dir))
import pkg.pkgsubprocess as subprocess import shutil import sys sys.path.append("../../") import certgenerator output_dir = "./produced" if __name__ == "__main__": # Remove any existing output from previous runs of this program. if os.path.isdir(output_dir): shutil.rmtree(output_dir) os.mkdir(output_dir) cg = certgenerator.CertGenerator(base_dir=output_dir) # Make a length 7 chain. cg.make_trust_anchor("ta1") cg.make_ca_cert("ch1_ta1", "ta1", ext="v3_ca_lp4") cg.make_ca_cert("ch2_ta1", "ch1_ta1", parent_loc="chain_certs", ext="v3_ca_lp3") cg.make_ca_cert("ch3_ta1", "ch2_ta1", parent_loc="chain_certs", ext="v3_ca_lp2") cg.make_ca_cert("ch4_ta1", "ch3_ta1", parent_loc="chain_certs",