mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-03 10:50:20 +00:00
openvpn: yapf indentation
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
71cc0e1fb0
commit
1779ac8928
@ -16,7 +16,6 @@
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
"""
|
||||
Configuration helper for OpenVPN server.
|
||||
"""
|
||||
@ -92,8 +91,7 @@ CERTIFICATE_CONFIGURATION = {
|
||||
'KEY_NAME': 'FreedomBox'
|
||||
}
|
||||
|
||||
COMMON_ARGS = {'env': CERTIFICATE_CONFIGURATION,
|
||||
'cwd': KEYS_DIRECTORY}
|
||||
COMMON_ARGS = {'env': CERTIFICATE_CONFIGURATION, 'cwd': KEYS_DIRECTORY}
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
@ -155,10 +153,12 @@ def _create_server_config():
|
||||
|
||||
def _setup_firewall():
|
||||
"""Add TUN device to internal zone in firewalld."""
|
||||
subprocess.call(['firewall-cmd', '--zone', 'internal',
|
||||
'--add-interface', 'tun+'])
|
||||
subprocess.call(['firewall-cmd', '--permanent', '--zone', 'internal',
|
||||
'--add-interface', 'tun+'])
|
||||
subprocess.call(
|
||||
['firewall-cmd', '--zone', 'internal', '--add-interface', 'tun+'])
|
||||
subprocess.call([
|
||||
'firewall-cmd', '--permanent', '--zone', 'internal', '--add-interface',
|
||||
'tun+'
|
||||
])
|
||||
|
||||
|
||||
def _create_certificates():
|
||||
@ -171,8 +171,8 @@ def _create_certificates():
|
||||
subprocess.check_call(['/usr/share/easy-rsa/clean-all'], **COMMON_ARGS)
|
||||
subprocess.check_call(['/usr/share/easy-rsa/pkitool', '--initca'],
|
||||
**COMMON_ARGS)
|
||||
subprocess.check_call(['/usr/share/easy-rsa/pkitool', '--server',
|
||||
'server'], **COMMON_ARGS)
|
||||
subprocess.check_call(
|
||||
['/usr/share/easy-rsa/pkitool', '--server', 'server'], **COMMON_ARGS)
|
||||
subprocess.check_call(['/usr/share/easy-rsa/build-dh'], **COMMON_ARGS)
|
||||
|
||||
|
||||
@ -224,8 +224,8 @@ def _is_non_empty_file(filepath):
|
||||
|
||||
def load_augeas():
|
||||
"""Initialize Augeas."""
|
||||
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
||||
augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||
aug = augeas.Augeas(
|
||||
flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||
|
||||
# shell-script config file lens
|
||||
aug.set('/augeas/load/Simplevars/lens', 'Simplevars.lns')
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
"""
|
||||
Plinth module to configure OpenVPN server.
|
||||
"""
|
||||
@ -57,13 +56,14 @@ description = [
|
||||
def init():
|
||||
"""Initialize the OpenVPN module."""
|
||||
menu = main_menu.get('apps')
|
||||
menu.add_urlname(name, 'glyphicon-lock', 'openvpn:index', short_description)
|
||||
menu.add_urlname(name, 'glyphicon-lock', 'openvpn:index',
|
||||
short_description)
|
||||
|
||||
global service
|
||||
setup_helper = globals()['setup_helper']
|
||||
if setup_helper.get_state() != 'needs-setup':
|
||||
service = service_module.Service(
|
||||
managed_services[0], name, ports=['openvpn'], is_external=True)
|
||||
service = service_module.Service(managed_services[0], name,
|
||||
ports=['openvpn'], is_external=True)
|
||||
|
||||
if service.is_enabled() and is_setup():
|
||||
add_shortcut()
|
||||
@ -75,9 +75,9 @@ def setup(helper, old_version=None):
|
||||
helper.call('post', actions.superuser_run, 'openvpn', ['upgrade'])
|
||||
global service
|
||||
if service is None:
|
||||
service = service_module.Service(
|
||||
managed_services[0], name, ports=['openvpn'], is_external=True,
|
||||
enable=enable, disable=disable)
|
||||
service = service_module.Service(managed_services[0], name,
|
||||
ports=['openvpn'], is_external=True,
|
||||
enable=enable, disable=disable)
|
||||
|
||||
|
||||
def add_shortcut():
|
||||
@ -86,11 +86,10 @@ def add_shortcut():
|
||||
format_lazy(_('<a class="btn btn-primary btn-sm" href="{link}">'
|
||||
'Download Profile</a>'),
|
||||
link=reverse_lazy('openvpn:profile'))
|
||||
frontpage.add_shortcut('openvpn', name,
|
||||
short_description=short_description,
|
||||
details=description + [download_profile],
|
||||
configure_url=reverse_lazy('openvpn:index'),
|
||||
login_required=True)
|
||||
frontpage.add_shortcut(
|
||||
'openvpn', name, short_description=short_description,
|
||||
details=description + [download_profile],
|
||||
configure_url=reverse_lazy('openvpn:index'), login_required=True)
|
||||
|
||||
|
||||
def is_setup():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user