diff --git a/functional_tests/features/tor.feature b/functional_tests/features/tor.feature index 84574fee7..fb8f840ec 100644 --- a/functional_tests/features/tor.feature +++ b/functional_tests/features/tor.feature @@ -52,6 +52,23 @@ Scenario: Set download software packages over tor When I enable download software packages over tor Then download software packages over tor should be enabled +# TODO: Test more thoroughly by checking same hidden service is restored and by +# actually connecting using Tor. +Scenario: Backup and restore tor + Given the tor application is enabled + And tor relay is enabled + And tor bridge relay is enabled + And tor hidden services are enabled + When I create a backup of the tor app data + And I disable tor relay + And I disable tor hidden services + And I export the tor app data backup + And I restore the tor app data backup + Then the tor service should be running + And tor relay should be enabled + And tor bridge relay should be enabled + And tor hidden services should be enabled + Scenario: Disable tor application Given the tor application is enabled When I disable the tor application diff --git a/plinth/modules/tor/__init__.py b/plinth/modules/tor/__init__.py index 90595987b..4c5ef248f 100644 --- a/plinth/modules/tor/__init__.py +++ b/plinth/modules/tor/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.names import SERVICES from plinth.signals import domain_added, domain_removed from . import utils -from .manifest import clients +from .manifest import backup, clients version = 2 diff --git a/plinth/modules/tor/manifest.py b/plinth/modules/tor/manifest.py index 4fc934500..6dbf5b181 100644 --- a/plinth/modules/tor/manifest.py +++ b/plinth/modules/tor/manifest.py @@ -18,6 +18,7 @@ from django.utils.translation import ugettext_lazy as _ from plinth.clients import store_url, validate +from plinth.modules.backups.api import validate as validate_backup _orbot_package_id = 'org.torproject.android' _tor_browser_download_url = \ @@ -54,3 +55,13 @@ clients = validate([{ 'url': store_url('f-droid', _orbot_package_id) }] }]) + +backup = validate_backup({ + 'config': { + 'directories': ['/etc/tor/'] + }, + 'secrets': { + 'directories': ['/var/lib/tor/', '/var/lib/tor-instances/'] + }, + 'services': ['tor@service'] +})