예제 #1
0
 def _setup_certificates(self, backend):
     # Set up the SSL certificates.
     if backend.different("ssl-cert-path", "ssl-cert-contents", "ssl-key-contents"):
         config = backend.config
         utils.save_or_create_certificates(
             config["ssl-cert-path"], config.get("ssl-cert-contents"), config.get("ssl-key-contents")
         )
예제 #2
0
 def install(self, backend):
     utils.install_builtin_server()
     if backend.different("ssl-cert-path", "ssl-cert-contents", "ssl-key-contents"):
         config = backend.config
         utils.save_or_create_certificates(
             config["ssl-cert-path"], config.get("ssl-cert-contents"), config.get("ssl-key-contents")
         )
예제 #3
0
 def install(self, backend):
     utils.install_builtin_server()
     if backend.different(
             'ssl-cert-path', 'ssl-cert-contents', 'ssl-key-contents'):
         config = backend.config
         utils.save_or_create_certificates(
             config['ssl-cert-path'], config.get('ssl-cert-contents'),
             config.get('ssl-key-contents'))
예제 #4
0
 def test_pem_file(self):
     # Ensure the pem file is created concatenating the key and cert files.
     save_or_create_certificates(self.cert_path, "Certificate", "Key")
     pem_file = os.path.join(self.cert_path, JUJU_PEM)
     self.assertEqual("KeyCertificate", open(pem_file).read())
예제 #5
0
 def test_provided_certificates(self):
     # Ensure files are correctly saved if their contents are provided.
     save_or_create_certificates(self.cert_path, "mycert", "mykey")
     self.assertIn("mycert", open(self.cert_file).read())
     self.assertIn("mykey", open(self.key_file).read())
예제 #6
0
 def test_generation(self):
     # Ensure certificates are correctly generated.
     save_or_create_certificates(self.cert_path, "some ignored contents", None)
     self.assertIn("CERTIFICATE", open(self.cert_file).read())
     self.assertIn("PRIVATE KEY", open(self.key_file).read())
예제 #7
0
 def test_pem_file(self):
     # Ensure the pem file is created concatenating the key and cert files.
     save_or_create_certificates(self.cert_path, 'Certificate', 'Key')
     pem_file = os.path.join(self.cert_path, JUJU_PEM)
     self.assertEqual('KeyCertificate', open(pem_file).read())
예제 #8
0
 def test_provided_certificates(self):
     # Ensure files are correctly saved if their contents are provided.
     save_or_create_certificates(self.cert_path, 'mycert', 'mykey')
     self.assertIn('mycert', open(self.cert_file).read())
     self.assertIn('mykey', open(self.key_file).read())
예제 #9
0
 def test_generation(self):
     # Ensure certificates are correctly generated.
     save_or_create_certificates(
         self.cert_path, 'some ignored contents', None)
     self.assertIn('CERTIFICATE', open(self.cert_file).read())
     self.assertIn('PRIVATE KEY', open(self.key_file).read())