networks: form for configuring router

Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Nektarios Katakis 2020-01-10 12:00:44 +00:00 committed by James Valleroy
parent 9d653d87ec
commit f3d2654a13
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 135 additions and 0 deletions

2
debian/control vendored
View File

@ -31,6 +31,7 @@ Build-Depends:
python3-django-stronghold (>= 0.3.0),
python3-flake8,
python3-gi,
python3-markupsafe,
python3-paramiko,
python3-psutil,
python3-pytest,
@ -99,6 +100,7 @@ Depends:
python3-django-captcha,
python3-django-stronghold,
python3-gi,
python3-markupsafe,
python3-paramiko,
python3-psutil,
python3-requests,

View File

@ -18,6 +18,7 @@
from django import forms
from django.core import validators
from django.utils.translation import ugettext_lazy as _, ugettext_lazy
from markupsafe import Markup
from plinth import cfg
from plinth import network
@ -296,3 +297,60 @@ requires clients to have the password to connect.'),
'passphrase': self.cleaned_data['passphrase'],
}
return settings
class RouterConfigurationWizardForm(forms.Form):
"""
Form to suggest router configuration depending on wan
connectivity/specific setup. The choice will affect
future suggestions during the setup process and other apps.
"""
router_config = forms.ChoiceField(
initial='dmz',
label=_('Preferred router configuration'),
choices=[
(
'dmz',
Markup(format_lazy(
_('Use DMZ feature to forward all traffic'
'<p class="help-block">Most routers provide a '
'configuration setting called DMZ. This will allow the '
'router to forward all incoming traffic from the '
'internet to a single IP address such as the '
'{box_name}\'s address. First remember to configure a '
'static local IP address for your {box_name} in your '
'router\'s configuration.</p>'),
box_name=cfg.box_name
)),
),
(
'port_forwarding',
Markup(format_lazy(
_('Forward Specific Traffic as needed by each '
'application'
'<p class="help-block">You may alternatively choose to '
'forward only specific traffic to your {box_name}. '
'This is ideal if you have other servers like '
'{box_name} in your network or if your router does not '
'support DMZ feature. All applications that provide a '
'web interface need you to forward traffic from ports '
'80 and 443 to work. Each of the other applications '
'will suggest you which port(s) need to be forwarded '
'for that application to work.</p>'),
box_name=cfg.box_name
))
),
(
'not_configured',
Markup(
_('Router is currently unconfigured'
'<p class="help-block">Choose this if you have not '
'configured or are unable to configure the router '
'currently and wish to be reminded later. Some of '
'the other configuration steps may fail.</p>')
)
),
],
required=True,
widget=forms.RadioSelect,
)

View File

@ -0,0 +1,75 @@
{% extends "base.html" %}
{% comment %}
#
# 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/>.
#
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block content %}
<h1>{% trans "Setup FreedomBox Behind a Router" %}</h1>
<p>
{% blocktrans trimmed %}
Your Freedombox gets its internet connection from your router via Wi-Fi or Ethernet cable.
This is a typical home setup.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
With this setup, any device on the internet trying to reach your Freedombox will have to
go through your router. The router will need to be configured to forward all traffic
it receives so that Freedombox provides the services.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
If you don't have control over your router, choose not to configure it. To see options,
to overcome this limitation, choose 'no public address' option in Internet connection
type selection.
{% endblocktrans %}
</p>
<h2>{% trans "Choose How You Wish to Configure Your Router" %}</h2>
<p class='help-block'>
{% blocktrans trimmed %}
You will need to login to your router's administration
console provided by the router. This may look like
<a href="http://192.168.0.1/">http://192.168.168.0.1</a>.
The username and password is configured by you
when you first setup the router. For many routers, this
information is printed at the back of the router. If you
don't remember the credentials or the IP address of the
router, you may decide to reset it and set it up freshly.
Lookup your router model number and search online for the
router's manual. This will provide full instructions on
how to perform this task.
{% endblocktrans %}
</p>
<form class="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary"
value="{% trans "Submit" %}"/>
</form>
{% endblock %}