mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 08:03:10 +02:00
Fix ipv6only detection (#5648)
* Fix ipv6only detection * move str() to inside ipv6_info * add regression test * Update to choose_vhosts
This commit is contained in:
@@ -311,6 +311,9 @@ class NginxConfigurator(common.Installer):
|
|||||||
configuration, and existence of ipv6only directive for specified port
|
configuration, and existence of ipv6only directive for specified port
|
||||||
:rtype: tuple of type (bool, bool)
|
:rtype: tuple of type (bool, bool)
|
||||||
"""
|
"""
|
||||||
|
# port should be a string, but it's easy to mess up, so let's
|
||||||
|
# make sure it is one
|
||||||
|
port = str(port)
|
||||||
vhosts = self.parser.get_vhosts()
|
vhosts = self.parser.get_vhosts()
|
||||||
ipv6_active = False
|
ipv6_active = False
|
||||||
ipv6only_present = False
|
ipv6only_present = False
|
||||||
|
|||||||
@@ -181,6 +181,18 @@ class NginxConfiguratorTest(util.NginxTest):
|
|||||||
# Port 443 has ipv6only=on because of ipv6ssl.com vhost
|
# Port 443 has ipv6only=on because of ipv6ssl.com vhost
|
||||||
self.assertEquals((True, True), self.config.ipv6_info("443"))
|
self.assertEquals((True, True), self.config.ipv6_info("443"))
|
||||||
|
|
||||||
|
def test_ipv6only_detection(self):
|
||||||
|
self.config.version = (1, 3, 1)
|
||||||
|
|
||||||
|
self.config.deploy_cert(
|
||||||
|
"ipv6.com",
|
||||||
|
"example/cert.pem",
|
||||||
|
"example/key.pem",
|
||||||
|
"example/chain.pem",
|
||||||
|
"example/fullchain.pem")
|
||||||
|
|
||||||
|
for addr in self.config.choose_vhosts("ipv6.com")[0].addrs:
|
||||||
|
self.assertFalse(addr.ipv6only)
|
||||||
|
|
||||||
def test_more_info(self):
|
def test_more_info(self):
|
||||||
self.assertTrue('nginx.conf' in self.config.more_info())
|
self.assertTrue('nginx.conf' in self.config.more_info())
|
||||||
|
|||||||
+2
@@ -1,5 +1,7 @@
|
|||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
listen [::]:443 ssl ipv6only=on;
|
listen [::]:443 ssl ipv6only=on;
|
||||||
|
listen 5001 ssl;
|
||||||
|
listen [::]:5001 ssl ipv6only=on;
|
||||||
server_name ipv6ssl.com;
|
server_name ipv6ssl.com;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user