mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
tor: Run tor-instance-create during setup
This commit is contained in:
parent
49106fe8ee
commit
fdac901181
@ -29,6 +29,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from plinth import action_utils
|
from plinth import action_utils
|
||||||
from plinth.modules.tor.utils import get_real_apt_uri_path, iter_apt_uris, \
|
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'
|
SERVICE_FILE = '/etc/firewalld/services/tor-{0}.xml'
|
||||||
TOR_CONFIG = '/files/etc/tor/instances/plinth/torrc'
|
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'
|
TOR_AUTH_COOKIE = '/var/run/tor/control.authcookie'
|
||||||
|
|
||||||
|
|
||||||
@ -68,6 +69,9 @@ def parse_arguments():
|
|||||||
|
|
||||||
def subcommand_setup(_):
|
def subcommand_setup(_):
|
||||||
"""Setup Tor configuration after installing it."""
|
"""Setup Tor configuration after installing it."""
|
||||||
|
|
||||||
|
subprocess.run(['tor-instance-create', 'plinth'])
|
||||||
|
|
||||||
aug = augeas_load()
|
aug = augeas_load()
|
||||||
|
|
||||||
aug.set(TOR_CONFIG + '/#comment[last() + 1]',
|
aug.set(TOR_CONFIG + '/#comment[last() + 1]',
|
||||||
@ -399,7 +403,7 @@ def augeas_load():
|
|||||||
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
||||||
augeas.Augeas.NO_MODL_AUTOLOAD)
|
augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||||
aug.set('/augeas/load/Tor/lens', 'Tor.lns')
|
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()
|
aug.load()
|
||||||
return aug
|
return aug
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ def is_running():
|
|||||||
|
|
||||||
def get_status():
|
def get_status():
|
||||||
"""Return current Tor status."""
|
"""Return current Tor status."""
|
||||||
output = actions.superuser_run('tor@plinth', ['get-status'])
|
output = actions.superuser_run('tor', ['get-status'])
|
||||||
status = json.loads(output)
|
status = json.loads(output)
|
||||||
|
|
||||||
hs_info = status['hidden_service']
|
hs_info = status['hidden_service']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user