mirror of
https://github.com/certbot/certbot.git
synced 2026-01-26 07:41:33 +03:00
letsencrypt_nginx: respect IConfig.dvsni_port (partially fixes #479).
This commit is contained in:
@@ -288,7 +288,7 @@ class NginxConfigurator(common.Plugin):
|
||||
|
||||
"""
|
||||
snakeoil_cert, snakeoil_key = self._get_snakeoil_paths()
|
||||
ssl_block = [['listen', '443 ssl'],
|
||||
ssl_block = [['listen', '{0} ssl'.format(self.config.dvsni_port)],
|
||||
['ssl_certificate', snakeoil_cert],
|
||||
['ssl_certificate_key', snakeoil_key],
|
||||
['include', self.parser.loc["ssl_options"]]]
|
||||
@@ -296,7 +296,7 @@ class NginxConfigurator(common.Plugin):
|
||||
vhost.filep, vhost.names, ssl_block)
|
||||
vhost.ssl = True
|
||||
vhost.raw.extend(ssl_block)
|
||||
vhost.addrs.add(obj.Addr('', '443', True, False))
|
||||
vhost.addrs.add(obj.Addr('', str(self.config.dvsni_port), True, False))
|
||||
|
||||
def get_all_certs_keys(self):
|
||||
"""Find all existing keys, certs from configuration.
|
||||
|
||||
@@ -47,7 +47,8 @@ class NginxDvsni(common.Dvsni):
|
||||
self.configurator.save()
|
||||
|
||||
addresses = []
|
||||
default_addr = "443 default_server ssl"
|
||||
default_addr = "{0} default_server ssl".format(
|
||||
self.configurator.config.dvsni_port)
|
||||
|
||||
for achall in self.achalls:
|
||||
vhost = self.configurator.choose_vhost(achall.domain)
|
||||
|
||||
@@ -57,7 +57,7 @@ class NginxConfiguratorTest(util.NginxTest):
|
||||
filep = self.config.parser.abs_path('sites-enabled/example.com')
|
||||
self.config.parser.add_server_directives(
|
||||
filep, set(['.example.com', 'example.*']),
|
||||
[['listen', '443 ssl']])
|
||||
[['listen', '5001 ssl']])
|
||||
self.config.save()
|
||||
|
||||
# pylint: disable=protected-access
|
||||
@@ -66,7 +66,7 @@ class NginxConfiguratorTest(util.NginxTest):
|
||||
['listen', '127.0.0.1'],
|
||||
['server_name', '.example.com'],
|
||||
['server_name', 'example.*'],
|
||||
['listen', '443 ssl']]]],
|
||||
['listen', '5001 ssl']]]],
|
||||
parsed[0])
|
||||
|
||||
def test_choose_vhost(self):
|
||||
@@ -100,7 +100,7 @@ class NginxConfiguratorTest(util.NginxTest):
|
||||
nginx_conf = self.config.parser.abs_path('nginx.conf')
|
||||
example_conf = self.config.parser.abs_path('sites-enabled/example.com')
|
||||
|
||||
# Get the default 443 vhost
|
||||
# Get the default SSL vhost
|
||||
self.config.deploy_cert(
|
||||
"www.example.com",
|
||||
"example/cert.pem", "example/key.pem")
|
||||
@@ -116,7 +116,7 @@ class NginxConfiguratorTest(util.NginxTest):
|
||||
['listen', '127.0.0.1'],
|
||||
['server_name', '.example.com'],
|
||||
['server_name', 'example.*'],
|
||||
['listen', '443 ssl'],
|
||||
['listen', '5001 ssl'],
|
||||
['ssl_certificate', 'example/cert.pem'],
|
||||
['ssl_certificate_key', 'example/key.pem'],
|
||||
['include',
|
||||
@@ -131,7 +131,7 @@ class NginxConfiguratorTest(util.NginxTest):
|
||||
[['location', '/'],
|
||||
[['root', 'html'],
|
||||
['index', 'index.html index.htm']]],
|
||||
['listen', '443 ssl'],
|
||||
['listen', '5001 ssl'],
|
||||
['ssl_certificate', '/etc/nginx/cert.pem'],
|
||||
['ssl_certificate_key', '/etc/nginx/key.pem'],
|
||||
['include',
|
||||
@@ -142,7 +142,7 @@ class NginxConfiguratorTest(util.NginxTest):
|
||||
nginx_conf = self.config.parser.abs_path('nginx.conf')
|
||||
example_conf = self.config.parser.abs_path('sites-enabled/example.com')
|
||||
|
||||
# Get the default 443 vhost
|
||||
# Get the default SSL vhost
|
||||
self.config.deploy_cert(
|
||||
"www.example.com",
|
||||
"example/cert.pem", "example/key.pem")
|
||||
|
||||
@@ -53,6 +53,7 @@ def get_nginx_configurator(
|
||||
backup_dir=backups,
|
||||
temp_checkpoint_dir=os.path.join(work_dir, "temp_checkpoints"),
|
||||
in_progress_dir=os.path.join(backups, "IN_PROGRESS"),
|
||||
dvsni_port=5001,
|
||||
),
|
||||
name="nginx",
|
||||
version=version)
|
||||
|
||||
Reference in New Issue
Block a user