def test_deploy_cert_newssl(self): self.config = util.get_apache_configurator( self.config_path, self.vhost_path, self.config_dir, self.work_dir, version=(2, 4, 16)) self.config.parser.modules.add("ssl_module") self.config.parser.modules.add("mod_ssl.c") # Get the default 443 vhost self.config.assoc["random.demo"] = self.vh_truth[1] self.config = self.mock_deploy_cert(self.config) self.config.deploy_cert( "random.demo", "example/cert.pem", "example/key.pem", "example/cert_chain.pem", "example/fullchain.pem") self.config.save() # Verify ssl_module was enabled. self.assertTrue(self.vh_truth[1].enabled) self.assertTrue("ssl_module" in self.config.parser.modules) loc_cert = self.config.parser.find_dir( "sslcertificatefile", "example/fullchain.pem", self.vh_truth[1].path) loc_key = self.config.parser.find_dir( "sslcertificateKeyfile", "example/key.pem", self.vh_truth[1].path) # Verify one directive was found in the correct file self.assertEqual(len(loc_cert), 1) self.assertEqual(configurator.get_file_path(loc_cert[0]), self.vh_truth[1].filep) self.assertEqual(len(loc_key), 1) self.assertEqual(configurator.get_file_path(loc_key[0]), self.vh_truth[1].filep)
def test_deploy_cert_newssl(self): self.config = util.get_apache_configurator( self.config_path, self.config_dir, self.work_dir, version=(2, 4, 16)) self.config.parser.modules.add("ssl_module") self.config.parser.modules.add("mod_ssl.c") # Get the default 443 vhost self.config.assoc["random.demo"] = self.vh_truth[1] self.config.deploy_cert( "random.demo", "example/cert.pem", "example/key.pem", "example/cert_chain.pem", "example/fullchain.pem") self.config.save() # Verify ssl_module was enabled. self.assertTrue(self.vh_truth[1].enabled) self.assertTrue("ssl_module" in self.config.parser.modules) loc_cert = self.config.parser.find_dir( "sslcertificatefile", "example/fullchain.pem", self.vh_truth[1].path) loc_key = self.config.parser.find_dir( "sslcertificateKeyfile", "example/key.pem", self.vh_truth[1].path) # Verify one directive was found in the correct file self.assertEqual(len(loc_cert), 1) self.assertEqual(configurator.get_file_path(loc_cert[0]), self.vh_truth[1].filep) self.assertEqual(len(loc_key), 1) self.assertEqual(configurator.get_file_path(loc_key[0]), self.vh_truth[1].filep)
def setUp(self): # pylint: disable=arguments-differ super(TwoVhost80Test, self).setUp() self.config = util.get_apache_configurator( self.config_path, self.vhost_path, self.config_dir, self.work_dir) self.config = self.mock_deploy_cert(self.config) self.vh_truth = util.get_vh_truth( self.temp_dir, "debian_apache_2_4/two_vhost_80")
def setUp(self): # pylint: disable=arguments-differ super(TwoVhost80Test, self).setUp() self.config = util.get_apache_configurator( self.config_path, self.config_dir, self.work_dir) self.vh_truth = util.get_vh_truth( self.temp_dir, "debian_apache_2_4/two_vhost_80")
def setUp(self): # pylint: disable=arguments-differ super(AugeasConfiguratorTest, self).setUp() self.config = util.get_apache_configurator( self.config_path, self.config_dir, self.work_dir) self.vh_truth = util.get_vh_truth( self.temp_dir, "debian_apache_2_4/two_vhost_80")
def setUp(self): super(TwoVhost80Test, self).setUp() with mock.patch("letsencrypt_apache.configurator.ApacheConfigurator." "mod_loaded") as mock_load: mock_load.return_value = True self.config = util.get_apache_configurator(self.config_path, self.config_dir, self.work_dir) self.vh_truth = util.get_vh_truth(self.temp_dir, "debian_apache_2_4/two_vhost_80")
def setUp(self): # pylint: disable=arguments-differ super(TlsSniPerformTest, self).setUp() config = util.get_apache_configurator( self.config_path, self.vhost_path, self.config_dir, self.work_dir) config.config.tls_sni_01_port = 443 from letsencrypt_apache import tls_sni_01 self.sni = tls_sni_01.ApacheTlsSni01(config)
def setUp(self): # pylint: disable=arguments-differ super(DvsniPerformTest, self).setUp() config = util.get_apache_configurator(self.config_path, self.config_dir, self.work_dir) config.config.dvsni_port = 443 from letsencrypt_apache import dvsni self.sni = dvsni.ApacheDvsni(config)
def setUp(self): # pylint: disable=arguments-differ super(TlsSniPerformTest, self).setUp() config = util.get_apache_configurator(self.config_path, self.config_dir, self.work_dir) config.config.tls_sni_01_port = 443 from letsencrypt_apache import tls_sni_01 self.sni = tls_sni_01.ApacheTlsSni01(config)
def setUp(self): # pylint: disable=arguments-differ super(MultipleVhostsTest, self).setUp() self.config = util.get_apache_configurator(self.config_path, self.vhost_path, self.config_dir, self.work_dir) self.config = self.mock_deploy_cert(self.config) self.vh_truth = util.get_vh_truth(self.temp_dir, "debian_apache_2_4/multiple_vhosts")
def setUp(self): super(DvsniPerformTest, self).setUp() with mock.patch("letsencrypt_apache.configurator.ApacheConfigurator." "mod_loaded") as mock_load: mock_load.return_value = True config = util.get_apache_configurator( self.config_path, self.config_dir, self.work_dir) from letsencrypt_apache import dvsni self.sni = dvsni.ApacheDvsni(config)
def setUp(self): super(TwoVhost80Test, self).setUp() with mock.patch("letsencrypt_apache.configurator." "mod_loaded") as mock_load: mock_load.return_value = True self.config = util.get_apache_configurator( self.config_path, self.config_dir, self.work_dir, self.ssl_options) self.vh_truth = util.get_vh_truth( self.temp_dir, "debian_apache_2_4/two_vhost_80")
def test_deploy_cert_old_apache_no_chain(self): self.config = util.get_apache_configurator( self.config_path, self.config_dir, self.work_dir, version=(2, 4, 7)) self.config.parser.modules.add("ssl_module") self.config.parser.modules.add("mod_ssl.c") # Get the default 443 vhost self.config.assoc["random.demo"] = self.vh_truth[1] self.assertRaises(errors.PluginError, lambda: self.config.deploy_cert( "random.demo", "example/cert.pem", "example/key.pem"))
def setUp(self): super(DvsniPerformTest, self).setUp() with mock.patch("letsencrypt_apache.configurator.ApacheConfigurator." "mod_loaded") as mock_load: mock_load.return_value = True config = util.get_apache_configurator(self.config_path, self.config_dir, self.work_dir) from letsencrypt_apache import dvsni self.sni = dvsni.ApacheDvsni(config)
def setUp(self): super(DvsniPerformTest, self).setUp() with mock.patch("letsencrypt_apache.configurator." "mod_loaded") as mock_load: mock_load.return_value = True config = util.get_apache_configurator( self.config_path, self.config_dir, self.work_dir, self.ssl_options) from letsencrypt_apache import dvsni self.sni = dvsni.ApacheDvsni(config) rsa256_file = pkg_resources.resource_filename( "acme.jose", "testdata/rsa256_key.pem") rsa256_pem = pkg_resources.resource_string( "acme.jose", "testdata/rsa256_key.pem") auth_key = le_util.Key(rsa256_file, rsa256_pem) self.achalls = [ achallenges.DVSNI( challb=acme_util.chall_to_challb( challenges.DVSNI( r="\x8c\x8a\xbf_-f\\cw\xee\xd6\xf8/\xa5\xe3\xfd\xeb9" "\xf1\xf5\xb9\xefVM\xc9w\xa4u\x9c\xe1\x87\xb4", nonce="7\xbc^\xb7]>\x00\xa1\x9bOcU\x84^Z\x18", ), "pending"), domain="encryption-example.demo", key=auth_key), achallenges.DVSNI( challb=acme_util.chall_to_challb( challenges.DVSNI( r="\xba\xa9\xda?<m\xaewmx\xea\xad\xadv\xf4\x02\xc9y\x80" "\xe2_X\t\xe7\xc7\xa4\t\xca\xf7&\x945", nonce="Y\xed\x01L\xac\x95\xf7pW\xb1\xd7\xa1\xb2\xc5" "\x96\xba", ), "pending"), domain="letsencrypt.demo", key=auth_key), ]