From c7a7e01d89c04fd7bf04b0be380c88b694fce8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 8 Mar 2016 16:57:21 +0100 Subject: [PATCH] [fix] Use http to retrieve public IPv6 due to Let's Encrypt restriction --- src/yunohost/domain.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/yunohost/domain.py b/src/yunohost/domain.py index 9535b01c..d63b2341 100644 --- a/src/yunohost/domain.py +++ b/src/yunohost/domain.py @@ -292,12 +292,15 @@ def domain_dns_conf(domain, ttl=None): def get_public_ip(protocol=4): """Retrieve the public IP address from ip.yunohost.org""" - if protocol not in [4, 6]: + if protocol == 4: + url = 'https://ip.yunohost.org' + elif protocol == 6: + # FIXME: Let's Encrypt does not support IPv6 host only yet + url = 'http://ipv6.yunohost.org' + else: raise ValueError("invalid protocol version") try: - return urlopen("https://ip{protocol}.yunohost.org".format( - protocol=('' if protocol == 4 else 'v6') - )).read().strip() + return urlopen(url).read().strip() except IOError: logger.debug('cannot retrieve public IPv%d' % protocol, exc_info=1) raise MoulinetteError(errno.ENETUNREACH,