mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
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:
parent
ca9047104a
commit
ebe6a0ed02
@ -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')
|
||||
|
||||
|
||||
@ -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']
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user