diff --git a/actions/tor b/actions/tor index a8ae6c510..bfdcd1c16 100755 --- a/actions/tor +++ b/actions/tor @@ -65,7 +65,7 @@ def parse_arguments(): def subcommand_setup(arguments): """Setup Tor configuration after installing it.""" - if arguments.old_version and arguments.old_version <= 3: + if arguments.old_version and arguments.old_version <= 4: _upgrade_orport_value() return @@ -148,7 +148,8 @@ def _upgrade_orport_value(): aug = augeas_load() if _is_relay_enabled(aug): - aug.set(TOR_CONFIG + '/ORPort', '[::]:9001') + aug.set(TOR_CONFIG + '/ORPort[1]', '9001') + aug.set(TOR_CONFIG + '/ORPort[2]', '[::]:9001') aug.save() @@ -241,7 +242,7 @@ def _get_upstream_bridges(aug): def _is_relay_enabled(aug): """Return whether a relay is enabled.""" - orport = aug.get(TOR_CONFIG + '/ORPort') + orport = aug.get(TOR_CONFIG + '/ORPort[1]') return bool(orport) and orport != '0' @@ -390,7 +391,8 @@ 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[1]', '9001') + aug.set(TOR_CONFIG + '/ORPort[2]', '[::]:9001') elif relay == 'disable': aug.remove(TOR_CONFIG + '/ORPort') diff --git a/plinth/modules/tor/__init__.py b/plinth/modules/tor/__init__.py index 6c55029f2..f074526f1 100644 --- a/plinth/modules/tor/__init__.py +++ b/plinth/modules/tor/__init__.py @@ -14,13 +14,13 @@ from plinth.daemon import Daemon, diagnose_netcat, diagnose_port_listening from plinth.modules.apache.components import diagnose_url from plinth.modules.firewall.components import Firewall from plinth.modules.names.components import DomainType -from plinth.signals import domain_added, domain_removed from plinth.modules.users.components import UsersAndGroups +from plinth.signals import domain_added, domain_removed from . import utils from .manifest import backup, clients # noqa, pylint: disable=unused-import -version = 4 +version = 5 depends = ['names']