tor: Listen on IPv6 for OrPort

- Fix regex for reading OrPort value from command port communication.

- Setup all new configurations for listening on IPv6 for OrPort.

- Upgrade existing configuration for listening on IPv6 for OrPort. Increment app
  version number force run setup again.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-11-12 01:13:55 -08:00 committed by James Valleroy
parent ca9047104a
commit ebe6a0ed02
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 5 additions and 5 deletions

View File

@ -80,7 +80,7 @@ def parse_arguments():
def subcommand_setup(arguments):
"""Setup Tor configuration after installing it."""
if arguments.old_version and arguments.old_version <= 2:
if arguments.old_version and arguments.old_version <= 3:
_upgrade_orport_value()
return
@ -163,7 +163,7 @@ def _upgrade_orport_value():
aug = augeas_load()
if _is_relay_enabled(aug):
aug.set(TOR_CONFIG + '/ORPort', '9001')
aug.set(TOR_CONFIG + '/ORPort', '[::]:9001')
aug.save()
@ -304,7 +304,7 @@ QUIT
tor_socket.close()
line = response.split(b'\r\n')[1].decode()
matches = re.match(r'.*="[^:]+:(\d+)"', line)
matches = re.match(r'.*=".+:(\d+)"', line)
return matches.group(1)
@ -405,7 +405,7 @@ def _enable_relay(relay=None, bridge=None, aug=None):
use_upstream_bridges = _are_upstream_bridges_enabled(aug)
if relay == 'enable' and not use_upstream_bridges:
aug.set(TOR_CONFIG + '/ORPort', '9001')
aug.set(TOR_CONFIG + '/ORPort', '[::]:9001')
elif relay == 'disable':
aug.remove(TOR_CONFIG + '/ORPort')

View File

@ -33,7 +33,7 @@ from plinth.signals import domain_added, domain_removed
from . import utils
from .manifest import backup, clients # noqa, pylint: disable=unused-import
version = 3
version = 4
depends = ['names']