mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
shadowsocks: Enable backup/restore
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
5f15fdda45
commit
5ee0f71e62
@ -34,3 +34,12 @@ Scenario: Disable shadowsocks application
|
||||
When I disable the shadowsocks application
|
||||
Then the shadowsocks service should not be running
|
||||
|
||||
Scenario: Backup and restore shadowsocks
|
||||
Given the shadowsocks application is enabled
|
||||
When I configure shadowsocks with server beforebackup.example.com and password beforebackup123
|
||||
And I create a backup of the shadowsocks app data
|
||||
And I configure shadowsocks with server afterbackup.example.com and password afterbackup123
|
||||
And I export the shadowsocks app data backup
|
||||
And I restore the shadowsocks app data backup
|
||||
Then the shadowsocks service should be running
|
||||
And shadowsocks should be configured with server beforebackup.example.com and password beforebackup123
|
||||
|
||||
@ -96,7 +96,25 @@ def select_domain_name(browser, app_name, domain_name):
|
||||
|
||||
@given('the shadowsocks application is configured')
|
||||
def configure_shadowsocks(browser):
|
||||
application.configure_shadowsocks(browser)
|
||||
application.configure_shadowsocks(browser, 'some.shadow.tunnel',
|
||||
'fakepassword')
|
||||
|
||||
|
||||
@when(
|
||||
parsers.parse(
|
||||
'I configure shadowsocks with server {server:S} and password {password:w}'
|
||||
))
|
||||
def configure_shadowsocks_with_details(browser, server, password):
|
||||
application.configure_shadowsocks(browser, server, password)
|
||||
|
||||
|
||||
@then(
|
||||
parsers.parse(
|
||||
'shadowsocks should be configured with server {server:S} and password {password:w}'
|
||||
))
|
||||
def assert_shadowsocks_configuration(browser, server, password):
|
||||
assert (server,
|
||||
password) == application.shadowsocks_get_configuration(browser)
|
||||
|
||||
|
||||
@when(
|
||||
|
||||
@ -116,14 +116,22 @@ def select_domain_name(browser, app_name, domain_name):
|
||||
interface.submit(browser, form_class='form-configuration')
|
||||
|
||||
|
||||
def configure_shadowsocks(browser):
|
||||
"""Configure shadowsocks client with some fake server details"""
|
||||
def configure_shadowsocks(browser, server, password):
|
||||
"""Configure shadowsocks client with given server details."""
|
||||
browser.visit('{}/plinth/apps/shadowsocks/'.format(default_url))
|
||||
browser.find_by_id('id_server').fill('some.shadow.tunnel')
|
||||
browser.find_by_id('id_password').fill('fakepassword')
|
||||
browser.find_by_id('id_server').fill(server)
|
||||
browser.find_by_id('id_password').fill(password)
|
||||
interface.submit(browser, form_class='form-configuration')
|
||||
|
||||
|
||||
def shadowsocks_get_configuration(browser):
|
||||
"""Return the server and password currently configured in shadowsocks."""
|
||||
browser.visit('{}/plinth/apps/shadowsocks/'.format(default_url))
|
||||
server = browser.find_by_id('id_server').value
|
||||
password = browser.find_by_id('id_password').value
|
||||
return server, password
|
||||
|
||||
|
||||
def modify_max_file_size(browser, size):
|
||||
"""Change the maximum file size of coquelicot to the given value"""
|
||||
browser.visit('{}/plinth/apps/coquelicot/'.format(default_url))
|
||||
|
||||
@ -26,6 +26,8 @@ from plinth import action_utils, actions, cfg, frontpage
|
||||
from plinth.menu import main_menu
|
||||
from plinth.utils import format_lazy
|
||||
|
||||
from .manifest import backup
|
||||
|
||||
version = 1
|
||||
|
||||
name = _('Shadowsocks')
|
||||
|
||||
28
plinth/modules/shadowsocks/manifest.py
Normal file
28
plinth/modules/shadowsocks/manifest.py
Normal file
@ -0,0 +1,28 @@
|
||||
#
|
||||
# This file is part of FreedomBox.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
"""
|
||||
Application manifest for shadowsocks.
|
||||
"""
|
||||
|
||||
from plinth.modules.backups.api import validate as validate_backup
|
||||
|
||||
backup = validate_backup({
|
||||
'secrets': {
|
||||
'files': ['/etc/shadowsocks-libev/freedombox.json']
|
||||
},
|
||||
'services': ['shadowsocks-libev-local@freedombox']
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user