From 7920f586dfbb15a3099dfa03a0f18b39c32fc7ac Mon Sep 17 00:00:00 2001 From: Giovanni Pellerano Date: Tue, 1 Oct 2019 10:18:51 +0200 Subject: [PATCH] Fix autobind on IPv6 --- tor2web/t2w.py | 8 ++++++-- tor2web/utils/config.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tor2web/t2w.py b/tor2web/t2w.py index b72cd939..ee824142 100644 --- a/tor2web/t2w.py +++ b/tor2web/t2w.py @@ -1141,7 +1141,11 @@ def daemon_init(self): i_https = i_http = 0 - for ip in [ipv4, ipv6]: + ips = [ipv6] + if ipv6 != '::': + ipv.append(ipv4) + + for ip in ips: if ip is None: continue @@ -1350,7 +1354,7 @@ def umask(mask): print(("Tor2web Startup Failure: unexistent file (%s)" % config.ssl_cert)) exit(1) -if config.listen_ipv6 == "::" or config.listen_ipv4 == config.listen_ipv6: +if config.listen_ipv4 == "::" or config.listen_ipv4 == config.listen_ipv6: # fix for incorrect configurations ipv4 = None else: diff --git a/tor2web/utils/config.py b/tor2web/utils/config.py index 347125c4..e2bd77e4 100644 --- a/tor2web/utils/config.py +++ b/tor2web/utils/config.py @@ -66,8 +66,8 @@ def __init__(self): self.__dict__['processes'] = 1 self.__dict__['requests_per_process'] = 1000000 self.__dict__['transport'] = 'BOTH' - self.__dict__['listen_ipv4'] = '127.0.0.1' - self.__dict__['listen_ipv6'] = None + self.__dict__['listen_ipv4'] = '0.0.0.0' + self.__dict__['listen_ipv6'] = '::' self.__dict__['listen_port_http'] = 80 self.__dict__['listen_port_https'] = 443 self.__dict__['basehost'] = 'AUTO'