mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
tor: After enabling hidden service, wait for info
This commit is contained in:
parent
07130b6007
commit
1e67fcb61a
15
actions/tor
15
actions/tor
@ -229,6 +229,14 @@ def _enable_hs(restart=True):
|
|||||||
if is_enabled() and is_running():
|
if is_enabled() and is_running():
|
||||||
action_utils.service_restart('tor')
|
action_utils.service_restart('tor')
|
||||||
|
|
||||||
|
# wait until hidden service information is available
|
||||||
|
tries = 0
|
||||||
|
while get_hidden_service() in ('', 'error'):
|
||||||
|
tries += 1
|
||||||
|
if tries >= 12:
|
||||||
|
return
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
|
||||||
def _disable_hs(restart=True):
|
def _disable_hs(restart=True):
|
||||||
"""Disable Tor hidden service"""
|
"""Disable Tor hidden service"""
|
||||||
@ -326,8 +334,11 @@ def _update_ports():
|
|||||||
</service>
|
</service>
|
||||||
"""
|
"""
|
||||||
for name, number in ports.items():
|
for name, number in ports.items():
|
||||||
with open(SERVICE_FILE.format(name), 'w') as service_file:
|
try:
|
||||||
service_file.writelines(lines.format(name, number))
|
with open(SERVICE_FILE.format(name), 'w') as service_file:
|
||||||
|
service_file.writelines(lines.format(name, number))
|
||||||
|
except FileNotFoundError:
|
||||||
|
return
|
||||||
|
|
||||||
action_utils.service_restart('firewalld')
|
action_utils.service_restart('firewalld')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user