From fdac901181f895a2e3dd26dc4bc0d2f89ee2781d Mon Sep 17 00:00:00 2001 From: mridulnagpal Date: Tue, 13 Dec 2016 01:06:13 +0530 Subject: [PATCH] tor: Run tor-instance-create during setup --- actions/tor | 8 ++++++-- plinth/modules/tor/utils.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/actions/tor b/actions/tor index 02b6e84a7..5a8512938 100755 --- a/actions/tor +++ b/actions/tor @@ -29,6 +29,7 @@ import os import re import socket import time +import subprocess from plinth import action_utils from plinth.modules.tor.utils import get_real_apt_uri_path, iter_apt_uris, \ @@ -37,7 +38,7 @@ from plinth.modules.tor.utils import get_real_apt_uri_path, iter_apt_uris, \ SERVICE_FILE = '/etc/firewalld/services/tor-{0}.xml' TOR_CONFIG = '/files/etc/tor/instances/plinth/torrc' -TOR_STATE_FILE = '/var/lib/tor/state' +TOR_STATE_FILE = '/var/lib/tor-instances/plinth/state' TOR_AUTH_COOKIE = '/var/run/tor/control.authcookie' @@ -68,6 +69,9 @@ def parse_arguments(): def subcommand_setup(_): """Setup Tor configuration after installing it.""" + + subprocess.run(['tor-instance-create', 'plinth']) + aug = augeas_load() aug.set(TOR_CONFIG + '/#comment[last() + 1]', @@ -399,7 +403,7 @@ def augeas_load(): aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD) aug.set('/augeas/load/Tor/lens', 'Tor.lns') - aug.set('/augeas/load/Tor/incl[last() + 1]', '/etc/tor/torrc') + aug.set('/augeas/load/Tor/incl[last() + 1]', '/etc/tor/instances/plinth/torrc') aug.load() return aug diff --git a/plinth/modules/tor/utils.py b/plinth/modules/tor/utils.py index 73422769d..0c688d577 100644 --- a/plinth/modules/tor/utils.py +++ b/plinth/modules/tor/utils.py @@ -46,7 +46,7 @@ def is_running(): def get_status(): """Return current Tor status.""" - output = actions.superuser_run('tor@plinth', ['get-status']) + output = actions.superuser_run('tor', ['get-status']) status = json.loads(output) hs_info = status['hidden_service']