mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
Remove WAN stub
This commit is contained in:
parent
cb26256bb3
commit
faf9cb937e
@ -1,52 +0,0 @@
|
|||||||
{% extends "login_nav.html" %}
|
|
||||||
{% comment %}
|
|
||||||
#
|
|
||||||
# This file is part of Plinth.
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% load bootstrap %}
|
|
||||||
|
|
||||||
{% block main_block %}
|
|
||||||
|
|
||||||
{% if cfg.users.expert %}
|
|
||||||
|
|
||||||
{% include 'messages.html' %}
|
|
||||||
|
|
||||||
<p>For security reasons, neither WAN Administration nor WAN SSH is
|
|
||||||
available to the `admin` user account.</p>
|
|
||||||
|
|
||||||
<p>TODO: in expert mode, tell user they can ssh in to enable admin
|
|
||||||
from WAN, do their business, then disable it. It would be good to
|
|
||||||
enable the option and autodisable it when the ssh connection
|
|
||||||
dies.</p>
|
|
||||||
|
|
||||||
<form class="form" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
|
|
||||||
{{ form|bootstrap }}
|
|
||||||
|
|
||||||
<input type="submit" class="btn-primary" value="Submit"/>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
<p>This page is available only in expert mode.</p>
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
import cherrypy
|
|
||||||
from django import forms
|
|
||||||
from gettext import gettext as _
|
|
||||||
from modules.auth import require
|
|
||||||
from plugin_mount import PagePlugin
|
|
||||||
import cfg
|
|
||||||
import util
|
|
||||||
|
|
||||||
|
|
||||||
class WanForm(forms.Form): # pylint: disable-msg=W0232
|
|
||||||
"""Form to configure wan settings"""
|
|
||||||
|
|
||||||
wan_admin = forms.BooleanField(
|
|
||||||
label=_('Allow access to Plinth from WAN'),
|
|
||||||
required=False,
|
|
||||||
help_text=_('If you check this box, this front end will be reachable \
|
|
||||||
from the WAN. If your {{ box_name }} connects you to the internet, that \
|
|
||||||
means you\'ll be able to log in to the front end from the internet. This \
|
|
||||||
might be convenient, but it is also <strong>dangerous</strong>, since it can \
|
|
||||||
enable attackers to gain access to your {{ box_name }} from the outside \
|
|
||||||
world. All they\'ll need is your username and passphrase, which they might \
|
|
||||||
guess or they might simply try every posible combination of letters and \
|
|
||||||
numbers until they get in. If you enable the WAN administration option, you \
|
|
||||||
<strong>must</strong> use long and complex passphrases.').format(
|
|
||||||
box_name=cfg.box_name))
|
|
||||||
|
|
||||||
lan_ssh = forms.BooleanField(
|
|
||||||
label=_('Allow SSH access from LAN'),
|
|
||||||
required=False)
|
|
||||||
|
|
||||||
wan_ssh = forms.BooleanField(
|
|
||||||
label=_('Allow SSH access from WAN'),
|
|
||||||
required=False)
|
|
||||||
|
|
||||||
# XXX: Only present due to issue with submitting empty form
|
|
||||||
dummy = forms.CharField(label='Dummy', initial='dummy',
|
|
||||||
widget=forms.HiddenInput())
|
|
||||||
|
|
||||||
|
|
||||||
class Wan(PagePlugin):
|
|
||||||
order = 60
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
PagePlugin.__init__(self, *args, **kwargs)
|
|
||||||
self.register_page('sys.config.wan')
|
|
||||||
|
|
||||||
cfg.html_root.sys.config.menu.add_item(_('WAN'), 'icon-cog',
|
|
||||||
'/sys/config/wan', 20)
|
|
||||||
|
|
||||||
@cherrypy.expose
|
|
||||||
@require()
|
|
||||||
def index(self, **kwargs):
|
|
||||||
"""Serve the configuration form"""
|
|
||||||
status = self.get_status()
|
|
||||||
|
|
||||||
form = None
|
|
||||||
messages = []
|
|
||||||
|
|
||||||
if kwargs and cfg.users.expert():
|
|
||||||
form = WanForm(kwargs, prefix='wan')
|
|
||||||
# pylint: disable-msg=E1101
|
|
||||||
if form.is_valid():
|
|
||||||
self._apply_changes(form.cleaned_data, messages)
|
|
||||||
status = self.get_status()
|
|
||||||
form = WanForm(initial=status, prefix='wan')
|
|
||||||
else:
|
|
||||||
form = WanForm(initial=status, prefix='wan')
|
|
||||||
|
|
||||||
title = _('Accessing the {box_name}').format(box_name=cfg.box_name)
|
|
||||||
return util.render_template(template='wan', title=title, form=form,
|
|
||||||
messages=messages)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_status():
|
|
||||||
"""Return the current status"""
|
|
||||||
return util.filedict_con(cfg.store_file, 'sys')
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _apply_changes(new_status, messages):
|
|
||||||
"""Apply the changes after form submission"""
|
|
||||||
store = util.filedict_con(cfg.store_file, 'sys')
|
|
||||||
for field in ['wan_admin', 'wan_ssh', 'lan_ssh']:
|
|
||||||
store[field] = new_status[field]
|
|
||||||
|
|
||||||
messages.append(('success', _('Setting updated')))
|
|
||||||
@ -1 +0,0 @@
|
|||||||
installed/system/wan.py
|
|
||||||
Loading…
x
Reference in New Issue
Block a user