From a62b7c752261d6378607d4cd9e842fddfefe365b Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa
- {% blocktrans trimmed %}
- Firewall daemon is not running. Please run it. Firewall comes
- enabled by default on {{ box_name }}. On any Debian based
- system (such as {{ box_name }}) you may run it using the
- command 'service firewalld start' or in case of a system with
- systemd 'systemctl start firewalld'.
- {% endblocktrans %}
-
-
- {% blocktrans trimmed %}
- The operation of the firewall is automatic. When you enable
- a service it is also permitted in the firewall and when you
- disable a service it is also disabled in the firewall.
- {% endblocktrans %}
-
-
+
+
{% blocktrans trimmed %}
- Advanced firewall operations such as opening custom ports are provided
- by the Cockpit app.
+ The operation of the firewall is automatic. When you enable
+ a service it is also permitted in the firewall and when you
+ disable a service it is also disabled in the firewall.
{% endblocktrans %}
- {% trans "Status" %}
- {% if firewall_status == 'not_running' %}
+
+
+
+ {% trans "Service/Port" %}
+ {% trans "Status" %}
+
-
-
-
- {% trans "Service/Port" %}
- {% trans "Status" %}
-
-
-
- {% for component in components|dictsort:"name" %}
- {% if component.ports %}
-
-
+ {% for component in components|dictsort:"name" %}
+ {% if component.ports %}
+
-
- {{ component.name }}
+
+
+ {% for port in component.ports_details %}
+
+
+ {{ component.name }}
+
+
+ {% if component.is_enabled %}
+
+ {% trans "Enabled" %}
+ {% else %}
+
+ {% trans "Disabled" %}
+ {% endif %}
+
+
+
- {% for port in component.ports_details %}
-
+ {{ port.name }}:
+ {% for port_number, protocol in port.details %}
+ {{ port_number }}/{{ protocol }}
+ {% endfor %}
-
- {% if component.is_enabled %}
+
+ {% if port.name in internal_enabled_ports and port.name in external_enabled_ports %}
- {% trans "Enabled" %}
- {% else %}
+ {% trans "Permitted" %}
+ {% elif port.name in internal_enabled_ports %}
- {% trans "Disabled" %}
+ {% trans "Permitted (internal only)" %}
+ {% elif port.name in external_enabled_ports %}
+
+ {% trans "Permitted (external only)" %}
+ {% else %}
+
+ {% trans "Blocked" %}
{% endif %}
-
- {% endfor %}
- {% endif %}
- {% endfor %}
-
-
- {{ port.name }}:
- {% for port_number, protocol in port.details %}
- {{ port_number }}/{{ protocol }}
- {% endfor %}
-
-
- {% if port.name in internal_enabled_ports and port.name in external_enabled_ports %}
-
- {% trans "Permitted" %}
- {% elif port.name in internal_enabled_ports %}
-
- {% trans "Permitted (internal only)" %}
- {% elif port.name in external_enabled_ports %}
-
- {% trans "Permitted (external only)" %}
- {% else %}
-
- {% trans "Blocked" %}
- {% endif %}
-
- {%trans "Advanced" %}
-
+ {% blocktrans trimmed %} + Advanced firewall operations such as opening custom ports are provided + by the Cockpit app. + {% endblocktrans %} +
{% endblock %} diff --git a/plinth/modules/firewall/views.py b/plinth/modules/firewall/views.py index c517a231a..69fc1d366 100644 --- a/plinth/modules/firewall/views.py +++ b/plinth/modules/firewall/views.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later -""" -FreedomBox app to configure a firewall. -""" +"""FreedomBox app to configure a firewall.""" from plinth import views from plinth.modules import firewall @@ -11,23 +9,16 @@ from . import components class FirewallAppView(views.AppView): """Serve firewall index page.""" + app_id = 'firewall' template_name = 'firewall.html' def get_context_data(self, *args, **kwargs): """Add additional context data for the template.""" context = super().get_context_data(*args, **kwargs) - - status = 'running' if firewall.get_enabled_status() else 'not_running' - context['firewall_status'] = status - - if status == 'running': - context['components'] = components.Firewall.list() - internal_enabled_ports = firewall.get_enabled_services( - zone='internal') - external_enabled_ports = firewall.get_enabled_services( - zone='external') - context['internal_enabled_ports'] = internal_enabled_ports - context['external_enabled_ports'] = external_enabled_ports - + context['components'] = components.Firewall.list() + internal_enabled_ports = firewall.get_enabled_services(zone='internal') + external_enabled_ports = firewall.get_enabled_services(zone='external') + context['internal_enabled_ports'] = internal_enabled_ports + context['external_enabled_ports'] = external_enabled_ports return context