diff --git a/debian/control b/debian/control index 4ba7e337d..5840e9a03 100644 --- a/debian/control +++ b/debian/control @@ -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, diff --git a/plinth/modules/networks/forms.py b/plinth/modules/networks/forms.py index 5cac3ab4c..e3647d74e 100644 --- a/plinth/modules/networks/forms.py +++ b/plinth/modules/networks/forms.py @@ -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' + '
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.
'), + box_name=cfg.box_name + )), + ), + ( + 'port_forwarding', + Markup(format_lazy( + _('Forward Specific Traffic as needed by each ' + 'application' + '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.
'), + box_name=cfg.box_name + )) + ), + ( + 'not_configured', + Markup( + _('Router is currently unconfigured' + '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.
') + ) + ), + ], + required=True, + widget=forms.RadioSelect, + ) diff --git a/plinth/modules/networks/templates/router_configuration.html b/plinth/modules/networks/templates/router_configuration.html new file mode 100644 index 000000000..82afc3427 --- /dev/null +++ b/plinth/modules/networks/templates/router_configuration.html @@ -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+ {% blocktrans trimmed %} + Your Freedombox gets its internet connection from your router via Wi-Fi or Ethernet cable. + This is a typical home setup. + {% endblocktrans %} +
++ {% 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 %} +
++ {% 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 %} +
+ ++ {% blocktrans trimmed %} + You will need to login to your router's administration + console provided by the router. This may look like + http://192.168.168.0.1. + 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 %} +
+ + + +{% endblock %}