mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
diagnostics: Use new component based API for all diagnostic tests
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
1f14c42af5
commit
2ebb565c92
@ -14,21 +14,6 @@ are loaded. The ``init()`` call order guarantees that other applications that
|
|||||||
this application depends on will be initialized before this application is
|
this application depends on will be initialized before this application is
|
||||||
initialized.
|
initialized.
|
||||||
|
|
||||||
<app-module>.diagnose()
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Optional. Called when the user invokes system-wide diagnostics by visiting
|
|
||||||
**System -> Diagnositcs**. This method must return an array of diagnostic
|
|
||||||
results. Each diagnostic result must be a two-tuple with first element as a
|
|
||||||
string that is shown to the user as name of the test and second element is the
|
|
||||||
result of the test. It must be one of ``passed``, ``failed``, ``error``. Example
|
|
||||||
return value:
|
|
||||||
|
|
||||||
.. code-block:: python3
|
|
||||||
|
|
||||||
[('Check http://localhost/app is reachable', 'passed'),
|
|
||||||
('Check configuration is sane', 'passed')]
|
|
||||||
|
|
||||||
<app-module>.depends
|
<app-module>.depends
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
@ -102,57 +102,38 @@ daemons should be stopped during the backup process. In ``__init__.py``, add:
|
|||||||
Creating diagnostics
|
Creating diagnostics
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
When the app does not work as expected, the user should known what is happening
|
When the app does not work as expected, the user should know what is happening
|
||||||
with the app. The FreedomBox framework provides an API for running and showing
|
with the app. FreedomBox framework provides an API for running and showing
|
||||||
diagnostics results. The app has to implement a method for actually running the
|
diagnostics results. Most of the common diagnostic tests are implemented by the
|
||||||
diagnostics and return the results as a list. FreedomBox then takes care of
|
framework as part of the components used by an app. FreedomBox takes care of
|
||||||
calling the diagnostics method and displaying the list in a formatted manner.
|
calling the diagnostics method and displaying the list in a formatted manner.
|
||||||
|
|
||||||
To implement the diagnostics, a method called ``diagnose()`` has to be available
|
To implement additional diagnostic tests on top of those provided by the
|
||||||
as ``<app-module>.diagnose()``. It must return a list in which each item is the
|
framework, the method :meth:`plinth.app.App.diagnose` has to be overridden or in
|
||||||
result of a test performed. The item itself is a two-tuple containing the
|
a component that belongs to the app, the method
|
||||||
display name of the test followed by the result as ``passed``, ``failed`` or
|
:meth:`plinth.app.Component.diagnose` has to be overridden. The methods must
|
||||||
``error``.
|
return a list in which each item is the result of a test performed. The item
|
||||||
|
itself is a two-tuple containing the display name of the test followed by the
|
||||||
|
result as ``passed``, ``failed`` or ``error``.
|
||||||
|
|
||||||
.. code-block:: python3
|
.. code-block:: python3
|
||||||
|
|
||||||
def diagnose():
|
class TransmissionAppView(views.AppView):
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(action_utils.diagnose_url_on_all(
|
|
||||||
'https://{host}/transmission', extra_options=['--no-check-certificate']))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
Now that we have implemented diagnostics, we also need to show a diagnostics
|
|
||||||
button in the App's page. Adding an attribute to the
|
|
||||||
:class:`~plinth.views.AppView` will take care of this.
|
|
||||||
|
|
||||||
.. code-block:: python3
|
|
||||||
|
|
||||||
class TransmissionView(views.AppView):
|
|
||||||
...
|
...
|
||||||
diagnostics_module_name = 'transmission'
|
def diagnose():
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
|
||||||
There are several helpers available to implement some of the common diagnostic
|
results.append(['Example test', 'passed'])
|
||||||
tests. For our application we wish to implement a test to check whether the
|
|
||||||
``/transmission`` URL is accessible. Since this is a commonly performed test,
|
return results
|
||||||
there is a helper method available and we have used it in the above code. The
|
|
||||||
``{host}`` tag replaced with various IP addresses, hostnames and domain names by
|
|
||||||
the helper to produce different kinds of URLs and they are all tested. Results
|
|
||||||
for all tests are returned which we then pass on to the framework.
|
|
||||||
|
|
||||||
The user can trigger the diagnostics test by going to **System -> Diagnostics**
|
The user can trigger the diagnostics test by going to **System -> Diagnostics**
|
||||||
page. This runs diagnostics for all the applications. Users can also run
|
page. This runs diagnostics for all the applications. Users can also run
|
||||||
diagnostics specifically for this app from the app's page. A diagnostics button
|
diagnostics specifically for this app from the app's page. A diagnostics menu
|
||||||
is shown by the `app.html` template automatically when
|
item is shown by the :class:`plinth.views.AppView` and `app.html` template
|
||||||
``diagnostics_module_name`` attribute is set in the app's ``AppView`` derived
|
automatically when ``diagnose()`` method is overridden in the app or a
|
||||||
from :obj:`plinth.views.AppView`.
|
component.
|
||||||
|
|
||||||
.. code-block:: django
|
|
||||||
|
|
||||||
{% include "diagnostics_button.html" with module="ttrss" enabled=True %}
|
|
||||||
|
|
||||||
Logging
|
Logging
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import re
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, menu
|
from plinth import cfg, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -102,7 +102,11 @@ class BindApp(app_module.App):
|
|||||||
is_external=False)
|
is_external=False)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-bind', managed_services[0])
|
daemon = Daemon(
|
||||||
|
'daemon-bind', managed_services[0], listen_ports=[(53, 'tcp6'),
|
||||||
|
(53, 'udp6'),
|
||||||
|
(53, 'tcp4'),
|
||||||
|
(53, 'udp4')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -129,18 +133,6 @@ def force_upgrade(helper, _packages):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(53, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(53, 'udp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(53, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(53, 'udp4'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def get_config():
|
def get_config():
|
||||||
"""Get current configuration"""
|
"""Get current configuration"""
|
||||||
data = [line.strip() for line in open(CONFIG_FILE, 'r')]
|
data = [line.strip() for line in open(CONFIG_FILE, 'r')]
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FreedomBox app to configure Cockpit.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -93,7 +93,8 @@ class CockpitApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-cockpit', 'cockpit-freedombox')
|
webserver = Webserver('webserver-cockpit', 'cockpit-freedombox',
|
||||||
|
urls=['https://{host}/_cockpit/'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-cockpit', managed_services[0])
|
daemon = Daemon('daemon-cockpit', managed_services[0])
|
||||||
@ -122,17 +123,6 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/_cockpit/',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def on_domain_added(sender, domain_type, name, description='', services=None,
|
def on_domain_added(sender, domain_type, name, description='', services=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""Handle addition of a new domain."""
|
"""Handle addition of a new domain."""
|
||||||
|
|||||||
@ -20,7 +20,7 @@ Plinth module to configure coquelicot.
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -79,7 +79,8 @@ class CoquelicotApp(app_module.App):
|
|||||||
ports=['http', 'https'], is_external=True)
|
ports=['http', 'https'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-coquelicot', 'coquelicot-freedombox')
|
webserver = Webserver('webserver-coquelicot', 'coquelicot-freedombox',
|
||||||
|
urls=['https://{host}/coquelicot'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-coquelicot', managed_services[0])
|
daemon = Daemon('daemon-coquelicot', managed_services[0])
|
||||||
@ -107,14 +108,3 @@ def get_current_max_file_size():
|
|||||||
"""Get the current value of maximum file size."""
|
"""Get the current value of maximum file size."""
|
||||||
size = actions.superuser_run('coquelicot', ['get-max-file-size'])
|
size = actions.superuser_run('coquelicot', ['get-max-file-size'])
|
||||||
return int(size.strip())
|
return int(size.strip())
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/coquelicot',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -63,6 +63,12 @@ class DateTimeApp(app_module.App):
|
|||||||
daemon = Daemon('daemon-datetime', managed_services[0])
|
daemon = Daemon('daemon-datetime', managed_services[0])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
results.append(_diagnose_time_synchronized())
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the date/time module."""
|
"""Initialize the date/time module."""
|
||||||
@ -77,14 +83,6 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
results.append(_diagnose_time_synchronized())
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def _diagnose_time_synchronized():
|
def _diagnose_time_synchronized():
|
||||||
"""Check whether time is synchronized to NTP server."""
|
"""Check whether time is synchronized to NTP server."""
|
||||||
result = 'failed'
|
result = 'failed'
|
||||||
|
|||||||
@ -20,7 +20,7 @@ FreedomBox app to configure a Deluge web client.
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -82,10 +82,12 @@ class DelugeApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-deluge', 'deluge-plinth')
|
webserver = Webserver('webserver-deluge', 'deluge-plinth',
|
||||||
|
urls=['https://{host}/deluge'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-deluge', managed_services[0])
|
daemon = Daemon('daemon-deluge', managed_services[0],
|
||||||
|
listen_ports=[(8112, 'tcp4')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -105,15 +107,3 @@ def setup(helper, old_version=None):
|
|||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', actions.superuser_run, 'deluge', ['setup'])
|
helper.call('post', actions.superuser_run, 'deluge', ['setup'])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(8112, 'tcp4'))
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/deluge',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -55,20 +55,19 @@ class DiagnosticsApp(app_module.App):
|
|||||||
'diagnostics:index', parent_url_name='system')
|
'diagnostics:index', parent_url_name='system')
|
||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
results.append(action_utils.diagnose_port_listening(8000, 'tcp4'))
|
||||||
|
results.extend(
|
||||||
|
action_utils.diagnose_url_on_all('http://{host}/plinth/',
|
||||||
|
check_certificate=False))
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the module"""
|
"""Initialize the module"""
|
||||||
global app
|
global app
|
||||||
app = DiagnosticsApp()
|
app = DiagnosticsApp()
|
||||||
app.set_enabled(True)
|
app.set_enabled(True)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
results.append(action_utils.diagnose_port_listening(8000, 'tcp4'))
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('http://{host}/plinth/',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ FreedomBox app for running diagnostics.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ from django.template.response import TemplateResponse
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
from plinth import module_loader
|
from plinth.app import App
|
||||||
from plinth.modules import diagnostics
|
from plinth.modules import diagnostics
|
||||||
|
|
||||||
logger = logging.Logger(__name__)
|
logger = logging.Logger(__name__)
|
||||||
@ -53,23 +54,18 @@ def index(request):
|
|||||||
|
|
||||||
|
|
||||||
@require_POST
|
@require_POST
|
||||||
def module(request, module_name):
|
def diagnose_app(request, app_id):
|
||||||
"""Return diagnostics for a particular module."""
|
"""Return diagnostics for a particular app."""
|
||||||
try:
|
try:
|
||||||
module = module_loader.loaded_modules[module_name]
|
app = App.get(app_id)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise Http404('Module does not exist or not loaded')
|
raise Http404('App does not exist')
|
||||||
|
|
||||||
results = []
|
return TemplateResponse(request, 'diagnostics_app.html', {
|
||||||
if hasattr(module, 'diagnose'):
|
'title': _('Diagnostic Test'),
|
||||||
results = module.diagnose()
|
'app_id': app_id,
|
||||||
|
'results': app.diagnose()
|
||||||
return TemplateResponse(
|
})
|
||||||
request, 'diagnostics_module.html', {
|
|
||||||
'title': _('Diagnostic Test'),
|
|
||||||
'module_name': module_name,
|
|
||||||
'results': results
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def _start_task():
|
def _start_task():
|
||||||
@ -99,29 +95,28 @@ def run_on_all_enabled_modules():
|
|||||||
"""Run diagnostics on all the enabled modules and store the result."""
|
"""Run diagnostics on all the enabled modules and store the result."""
|
||||||
global current_results
|
global current_results
|
||||||
current_results = {
|
current_results = {
|
||||||
'modules': [],
|
'apps': [],
|
||||||
'results': collections.OrderedDict(),
|
'results': collections.OrderedDict(),
|
||||||
'progress_percentage': 0
|
'progress_percentage': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
modules = []
|
apps = []
|
||||||
for module_name, module in module_loader.loaded_modules.items():
|
for app in App.list():
|
||||||
if not hasattr(module, 'diagnose'):
|
# XXX: Implement more cleanly.
|
||||||
continue
|
# Don't run diagnostics on apps have not been setup yet.
|
||||||
|
# However, run on apps that need an upgrade.
|
||||||
# Don't run setup on modules have not been setup yet.
|
module = importlib.import_module(app.__class__.__module__)
|
||||||
# However, run on modules that need an upgrade.
|
|
||||||
if module.setup_helper.get_state() == 'needs-setup':
|
if module.setup_helper.get_state() == 'needs-setup':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not module.app.is_enabled():
|
if not app.is_enabled():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
modules.append((module_name, module))
|
apps.append((app.app_id, app))
|
||||||
current_results['results'][module_name] = None
|
current_results['results'][app.app_id] = None
|
||||||
|
|
||||||
current_results['modules'] = modules
|
current_results['apps'] = apps
|
||||||
for current_index, (module_name, module) in enumerate(modules):
|
for current_index, (app_id, app) in enumerate(apps):
|
||||||
current_results['results'][module_name] = module.diagnose()
|
current_results['results'][app_id] = app.diagnose()
|
||||||
current_results['progress_percentage'] = \
|
current_results['progress_percentage'] = \
|
||||||
int((current_index + 1) * 100 / len(modules))
|
int((current_index + 1) * 100 / len(apps))
|
||||||
|
|||||||
@ -63,11 +63,11 @@
|
|||||||
{{ results.error }}
|
{{ results.error }}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% for module, module_results in results.results.items %}
|
{% for app_id, app_results in results.results.items %}
|
||||||
<h4>{% blocktrans %}Module: {{ module }}{% endblocktrans %}</h4>
|
<h4>{% blocktrans %}App: {{ app_id }}{% endblocktrans %}</h4>
|
||||||
|
|
||||||
{% if module_results %}
|
{% if app_results %}
|
||||||
{% include "diagnostics_results.html" with results=module_results %}
|
{% include "diagnostics_results.html" with results=app_results %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p><span class="fa fa-hourglass-o"></span></p>
|
<p><span class="fa fa-hourglass-o"></span></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
<h2>{% trans "Diagnostic Results" %}</h2>
|
<h2>{% trans "Diagnostic Results" %}</h2>
|
||||||
|
|
||||||
<h3>{% blocktrans %}Module: {{ module_name }}{% endblocktrans %}</h3>
|
<h3>{% blocktrans %}App: {{ app_id }}{% endblocktrans %}</h3>
|
||||||
|
|
||||||
{% if results %}
|
{% if results %}
|
||||||
{% include "diagnostics_results.html" with results=results %}
|
{% include "diagnostics_results.html" with results=results %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>{% trans "This module does not support diagnostics" %}</p>
|
<p>{% trans "This app does not support diagnostics" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -20,7 +20,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
<form class="form form-diagnostics-button" method="post"
|
<form class="form form-diagnostics-button" method="post"
|
||||||
action="{% url 'diagnostics:module' module %}">
|
action="{% url 'diagnostics:app' app_id %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
{% if enabled %}
|
{% if enabled %}
|
||||||
|
|||||||
@ -24,6 +24,6 @@ from . import diagnostics as views
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^sys/diagnostics/$', views.index, name='index'),
|
url(r'^sys/diagnostics/$', views.index, name='index'),
|
||||||
url(r'^sys/diagnostics/(?P<module_name>[1-9a-z\-]+)/$', views.module,
|
url(r'^sys/diagnostics/(?P<app_id>[1-9a-z\-]+)/$', views.diagnose_app,
|
||||||
name='module'),
|
name='app'),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -105,6 +105,23 @@ class DiasporaApp(app_module.App):
|
|||||||
daemon = Daemon('daemon-diaspora', managed_services[0])
|
daemon = Daemon('daemon-diaspora', managed_services[0])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_url('http://diaspora.localhost', kind='4',
|
||||||
|
check_certificate=False))
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_url('http://diaspora.localhost', kind='6',
|
||||||
|
check_certificate=False))
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_url(
|
||||||
|
'http://diaspora.{}'.format(get_configured_domain_name()),
|
||||||
|
kind='4', check_certificate=False))
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
class Shortcut(frontpage.Shortcut):
|
class Shortcut(frontpage.Shortcut):
|
||||||
"""Frontpage shortcut to use configured domain name for URL."""
|
"""Frontpage shortcut to use configured domain name for URL."""
|
||||||
@ -155,24 +172,6 @@ def disable_user_registrations():
|
|||||||
actions.superuser_run('diaspora', ['disable-user-registrations'])
|
actions.superuser_run('diaspora', ['disable-user-registrations'])
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_url('http://diaspora.localhost', kind='4',
|
|
||||||
check_certificate=False))
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_url('http://diaspora.localhost', kind='6',
|
|
||||||
check_certificate=False))
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_url(
|
|
||||||
'http://diaspora.{}'.format(get_configured_domain_name()),
|
|
||||||
kind='4', check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def generate_apache_configuration(conf_file, domain_name):
|
def generate_apache_configuration(conf_file, domain_name):
|
||||||
"""Generate Diaspora's apache configuration with the given domain name"""
|
"""Generate Diaspora's apache configuration with the given domain name"""
|
||||||
open(conf_file, 'w').close()
|
open(conf_file, 'w').close()
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import pathlib
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -108,7 +108,8 @@ class EjabberdApp(app_module.App):
|
|||||||
'xmpp-bosh'], is_external=True)
|
'xmpp-bosh'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-ejabberd', 'jwchat-plinth')
|
webserver = Webserver('webserver-ejabberd', 'jwchat-plinth',
|
||||||
|
urls=['http://{host}/bosh/'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
letsencrypt = LetsEncrypt(
|
letsencrypt = LetsEncrypt(
|
||||||
@ -120,7 +121,10 @@ class EjabberdApp(app_module.App):
|
|||||||
managing_app='ejabberd')
|
managing_app='ejabberd')
|
||||||
self.add(letsencrypt)
|
self.add(letsencrypt)
|
||||||
|
|
||||||
daemon = Daemon('daemon-ejabberd', managed_services[0])
|
daemon = Daemon(
|
||||||
|
'daemon-ejabberd', managed_services[0],
|
||||||
|
listen_ports=[(5222, 'tcp4'), (5222, 'tcp6'), (5269, 'tcp4'),
|
||||||
|
(5269, 'tcp6'), (5443, 'tcp4'), (5443, 'tcp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -214,18 +218,3 @@ def on_domain_added(sender, domain_type, name, description='', services=None,
|
|||||||
if name not in conf['domains']:
|
if name not in conf['domains']:
|
||||||
actions.superuser_run('ejabberd', ['add-domain', '--domainname', name])
|
actions.superuser_run('ejabberd', ['add-domain', '--domainname', name])
|
||||||
app.get_component('letsencrypt-ejabberd').setup_certificates()
|
app.get_component('letsencrypt-ejabberd').setup_certificates()
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(5222, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5222, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5269, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5269, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5443, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5443, 'tcp6'))
|
|
||||||
results.extend(action_utils.diagnose_url_on_all('http://{host}/bosh/'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import os
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.errors import ActionError
|
from plinth.errors import ActionError
|
||||||
@ -32,7 +32,8 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
|
|
||||||
from .forms import is_repo_url
|
from .forms import is_repo_url
|
||||||
from .manifest import GIT_REPO_PATH, backup, clients # noqa, pylint: disable=unused-import
|
from .manifest import (GIT_REPO_PATH, # noqa, pylint: disable=unused-import
|
||||||
|
backup, clients)
|
||||||
|
|
||||||
clients = clients
|
clients = clients
|
||||||
|
|
||||||
@ -89,7 +90,8 @@ class GitwebApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-gitweb', 'gitweb-freedombox')
|
webserver = Webserver('webserver-gitweb', 'gitweb-freedombox',
|
||||||
|
urls=['https://{host}/gitweb/'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
self.auth_webserver = GitwebWebserverAuth('webserver-gitweb-auth',
|
self.auth_webserver = GitwebWebserverAuth('webserver-gitweb-auth',
|
||||||
@ -191,16 +193,6 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/gitweb/',
|
|
||||||
check_certificate=False))
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def restore_post(packet):
|
def restore_post(packet):
|
||||||
"""Update access after restoration of backups."""
|
"""Update access after restoration of backups."""
|
||||||
app.update_service_access()
|
app.update_service_access()
|
||||||
|
|||||||
@ -20,7 +20,7 @@ FreedomBox app to configure I2P.
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -105,10 +105,12 @@ class I2PApp(app_module.App):
|
|||||||
is_external=False)
|
is_external=False)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-i2p', 'i2p-freedombox')
|
webserver = Webserver('webserver-i2p', 'i2p-freedombox',
|
||||||
|
urls=['https://{host}/i2p/'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-i2p', managed_services[0])
|
daemon = Daemon('daemon-i2p', managed_services[0],
|
||||||
|
listen_ports=[(7657, 'tcp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -152,15 +154,3 @@ def setup(helper, old_version=None):
|
|||||||
'--value', '0.0.0.0'
|
'--value', '0.0.0.0'
|
||||||
])
|
])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(7657, 'tcp6'))
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/i2p/',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FreedomBox app to configure ikiwiki.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.modules.apache.components import Webserver
|
from plinth.modules.apache.components import Webserver
|
||||||
@ -85,7 +85,8 @@ class IkiwikiApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-ikiwiki', 'ikiwiki-plinth')
|
webserver = Webserver('webserver-ikiwiki', 'ikiwiki-plinth',
|
||||||
|
urls=['https://{host}/ikiwiki'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
def add_shortcut(self, site, title):
|
def add_shortcut(self, site, title):
|
||||||
@ -129,14 +130,3 @@ def setup(helper, old_version=None):
|
|||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', actions.superuser_run, 'ikiwiki', ['setup'])
|
helper.call('post', actions.superuser_run, 'ikiwiki', ['setup'])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/ikiwiki',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FreedomBox app for infinoted.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -85,7 +85,8 @@ class InfinotedApp(app_module.App):
|
|||||||
ports=['infinoted-plinth'], is_external=True)
|
ports=['infinoted-plinth'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-infinoted', managed_services[0])
|
daemon = Daemon('daemon-infinoted', managed_services[0],
|
||||||
|
listen_ports=[(6523, 'tcp4'), (6523, 'tcp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -114,13 +115,3 @@ def setup(helper, old_version=None):
|
|||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', actions.superuser_run, 'infinoted', ['setup'])
|
helper.call('post', actions.superuser_run, 'infinoted', ['setup'])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(6523, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(6523, 'tcp6'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -85,6 +85,17 @@ class LetsEncryptApp(app_module.App):
|
|||||||
parent_url_name='system')
|
parent_url_name='system')
|
||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
|
||||||
|
for domain in names.components.DomainName.list():
|
||||||
|
if domain.domain_type.can_have_certificate:
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_url('https://' + domain.name))
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the module."""
|
"""Initialize the module."""
|
||||||
@ -106,17 +117,6 @@ def setup(helper, old_version=None):
|
|||||||
['setup', '--old-version', str(old_version)])
|
['setup', '--old-version', str(old_version)])
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
for domain in names.components.DomainName.list():
|
|
||||||
if domain.domain_type.can_have_certificate:
|
|
||||||
results.append(action_utils.diagnose_url('https://' + domain.name))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def certificate_obtain(domain):
|
def certificate_obtain(domain):
|
||||||
"""Obtain a certificate for a domain and notify handlers."""
|
"""Obtain a certificate for a domain and notify handlers."""
|
||||||
actions.superuser_run('letsencrypt', ['obtain', '--domain', domain])
|
actions.superuser_run('letsencrypt', ['obtain', '--domain', domain])
|
||||||
|
|||||||
@ -26,7 +26,7 @@ from django.urls import reverse_lazy
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from ruamel.yaml.util import load_yaml_guess_indent
|
from ruamel.yaml.util import load_yaml_guess_indent
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -104,7 +104,8 @@ class MatrixSynapseApp(app_module.App):
|
|||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-matrixsynapse',
|
webserver = Webserver('webserver-matrixsynapse',
|
||||||
'matrix-synapse-plinth')
|
'matrix-synapse-plinth',
|
||||||
|
urls=['https://{host}/_matrix/client/versions'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
letsencrypt = LetsEncrypt(
|
letsencrypt = LetsEncrypt(
|
||||||
@ -116,7 +117,8 @@ class MatrixSynapseApp(app_module.App):
|
|||||||
managing_app='matrixsynapse')
|
managing_app='matrixsynapse')
|
||||||
self.add(letsencrypt)
|
self.add(letsencrypt)
|
||||||
|
|
||||||
daemon = Daemon('daemon-matrixsynapse', managed_services[0])
|
daemon = Daemon('daemon-matrixsynapse', managed_services[0],
|
||||||
|
listen_ports=[(8008, 'tcp4'), (8448, 'tcp4')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -152,19 +154,6 @@ def is_setup():
|
|||||||
return os.path.exists(SERVER_NAME_PATH)
|
return os.path.exists(SERVER_NAME_PATH)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(8008, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(8448, 'tcp4'))
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all(
|
|
||||||
'https://{host}/_matrix/client/versions', check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def get_domains():
|
def get_domains():
|
||||||
"""Return a list of domains this app is interested in."""
|
"""Return a list of domains this app is interested in."""
|
||||||
domain = get_configured_domain_name()
|
domain = get_configured_domain_name()
|
||||||
|
|||||||
@ -20,7 +20,7 @@ FreedomBox app to configure MediaWiki.
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -88,7 +88,8 @@ class MediaWikiApp(app_module.App):
|
|||||||
ports=['http', 'https'], is_external=True)
|
ports=['http', 'https'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-mediawiki', 'mediawiki')
|
webserver = Webserver('webserver-mediawiki', 'mediawiki',
|
||||||
|
urls=['https://{host}/mediawiki'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
webserver = Webserver('webserver-mediawiki-freedombox',
|
webserver = Webserver('webserver-mediawiki-freedombox',
|
||||||
@ -125,16 +126,6 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/mediawiki',
|
|
||||||
check_certificate=False))
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def is_public_registration_enabled():
|
def is_public_registration_enabled():
|
||||||
"""Return whether public registration is enabled."""
|
"""Return whether public registration is enabled."""
|
||||||
output = actions.superuser_run('mediawiki',
|
output = actions.superuser_run('mediawiki',
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import augeas
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils
|
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -101,7 +100,8 @@ class MinetestApp(app_module.App):
|
|||||||
ports=['minetest-plinth'], is_external=True)
|
ports=['minetest-plinth'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-minetest', managed_services[0])
|
daemon = Daemon('daemon-minetest', managed_services[0],
|
||||||
|
listen_ports=[(30000, 'udp4')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -121,15 +121,6 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(30000, 'udp4'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def load_augeas():
|
def load_augeas():
|
||||||
"""Initialize Augeas."""
|
"""Initialize Augeas."""
|
||||||
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
||||||
|
|||||||
@ -19,14 +19,12 @@ FreedomBox app to configure minidlna.
|
|||||||
"""
|
"""
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import actions
|
|
||||||
import plinth.app as app_module
|
import plinth.app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import actions, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
from plinth.modules.apache.components import Webserver
|
from plinth.modules.apache.components import Webserver
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
from plinth.action_utils import diagnose_url
|
|
||||||
|
|
||||||
from .manifest import backup, clients # noqa
|
from .manifest import backup, clients # noqa
|
||||||
|
|
||||||
@ -77,7 +75,8 @@ class MiniDLNAApp(app_module.App):
|
|||||||
)
|
)
|
||||||
firewall = Firewall('firewall-minidlna', name, ports=['minidlna'],
|
firewall = Firewall('firewall-minidlna', name, ports=['minidlna'],
|
||||||
is_external=False)
|
is_external=False)
|
||||||
webserver = Webserver('webserver-minidlna', 'minidlna-freedombox')
|
webserver = Webserver('webserver-minidlna', 'minidlna-freedombox',
|
||||||
|
urls=['http://localhost:8200/'])
|
||||||
shortcut = frontpage.Shortcut(
|
shortcut = frontpage.Shortcut(
|
||||||
'shortcut-minidlna',
|
'shortcut-minidlna',
|
||||||
name,
|
name,
|
||||||
@ -113,11 +112,3 @@ def setup(helper, old_version=None):
|
|||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', actions.superuser_run, 'minidlna', ['setup'])
|
helper.call('post', actions.superuser_run, 'minidlna', ['setup'])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Check if the http page listening on 8200 is accessible"""
|
|
||||||
results = []
|
|
||||||
results.append(diagnose_url('http://localhost:8200/'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ FreedomBox app for mldonkey.
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -91,10 +91,12 @@ class MLDonkeyApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-mldonkey', 'mldonkey-freedombox')
|
webserver = Webserver('webserver-mldonkey', 'mldonkey-freedombox',
|
||||||
|
urls=['https://{host}/mldonkey/'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-mldonkey', managed_services[0])
|
daemon = Daemon('daemon-mldonkey', managed_services[0],
|
||||||
|
listen_ports=[(4080, 'tcp4')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -114,15 +116,3 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('pre', actions.superuser_run, 'mldonkey', ['pre-install'])
|
helper.call('pre', actions.superuser_run, 'mldonkey', ['pre-install'])
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(4080, 'tcp4'))
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/mldonkey/',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -21,7 +21,6 @@ FreedomBox app to configure Mumble server.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils
|
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -85,7 +84,10 @@ class MumbleApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-mumble', managed_services[0])
|
daemon = Daemon(
|
||||||
|
'daemon-mumble', managed_services[0],
|
||||||
|
listen_ports=[(64738, 'tcp4'), (64738, 'tcp6'), (64738, 'udp4'),
|
||||||
|
(64738, 'udp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -103,15 +105,3 @@ def setup(helper, old_version=None):
|
|||||||
"""Install and configure the module."""
|
"""Install and configure the module."""
|
||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(64738, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(64738, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(64738, 'udp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(64738, 'udp6'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -61,6 +61,24 @@ class NetworksApp(app_module.App):
|
|||||||
'networks:index', parent_url_name='system')
|
'networks:index', parent_url_name='system')
|
||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
|
||||||
|
interfaces = _get_shared_interfaces()
|
||||||
|
addresses = _get_interface_addresses(interfaces)
|
||||||
|
|
||||||
|
for address in addresses:
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_port_listening(53, 'tcp', address))
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_port_listening(53, 'udp', address))
|
||||||
|
|
||||||
|
results.append(_diagnose_dnssec('4'))
|
||||||
|
results.append(_diagnose_dnssec('6'))
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the Networks module."""
|
"""Initialize the Networks module."""
|
||||||
@ -76,25 +94,6 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
interfaces = _get_shared_interfaces()
|
|
||||||
addresses = _get_interface_addresses(interfaces)
|
|
||||||
|
|
||||||
for address in addresses:
|
|
||||||
results.append(action_utils.diagnose_port_listening(
|
|
||||||
53, 'tcp', address))
|
|
||||||
results.append(action_utils.diagnose_port_listening(
|
|
||||||
53, 'udp', address))
|
|
||||||
|
|
||||||
results.append(_diagnose_dnssec('4'))
|
|
||||||
results.append(_diagnose_dnssec('6'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def _get_shared_interfaces():
|
def _get_shared_interfaces():
|
||||||
"""Get active network interfaces in shared mode."""
|
"""Get active network interfaces in shared mode."""
|
||||||
shared_interfaces = []
|
shared_interfaces = []
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FreedomBox app to configure OpenVPN server.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -89,7 +89,8 @@ class OpenVPNApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-openvpn', managed_services[0])
|
daemon = Daemon('daemon-openvpn', managed_services[0],
|
||||||
|
listen_ports=[(1194, 'udp4')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -115,8 +116,3 @@ def setup(helper, old_version=None):
|
|||||||
def is_setup():
|
def is_setup():
|
||||||
"""Return whether the service is running."""
|
"""Return whether the service is running."""
|
||||||
return actions.superuser_run('openvpn', ['is-setup']).strip() == 'true'
|
return actions.superuser_run('openvpn', ['is-setup']).strip() == 'true'
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
return [action_utils.diagnose_port_listening(1194, 'udp4')]
|
|
||||||
|
|||||||
@ -90,9 +90,17 @@ class PrivoxyApp(app_module.App):
|
|||||||
is_external=False)
|
is_external=False)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-privoxy', managed_services[0])
|
daemon = Daemon('daemon-privoxy', managed_services[0],
|
||||||
|
listen_ports=[(8118, 'tcp4'), (8118, 'tcp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
results.append(action_utils.diagnose_url('https://www.debian.org'))
|
||||||
|
results.extend(diagnose_url_with_proxy())
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the module."""
|
"""Initialize the module."""
|
||||||
@ -120,18 +128,6 @@ class PrivoxyAppView(AppView):
|
|||||||
icon_filename = icon_filename
|
icon_filename = icon_filename
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(8118, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(8118, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_url('https://www.debian.org'))
|
|
||||||
results.extend(diagnose_url_with_proxy())
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def diagnose_url_with_proxy():
|
def diagnose_url_with_proxy():
|
||||||
"""Run a diagnostic on a URL with a proxy."""
|
"""Run a diagnostic on a URL with a proxy."""
|
||||||
url = 'https://debian.org/' # Gives a simple redirect to www.
|
url = 'https://debian.org/' # Gives a simple redirect to www.
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import pathlib
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -108,7 +108,8 @@ class QuasselApp(app_module.App):
|
|||||||
managing_app='quassel')
|
managing_app='quassel')
|
||||||
self.add(letsencrypt)
|
self.add(letsencrypt)
|
||||||
|
|
||||||
daemon = Daemon('daemon-quassel', managed_services[0])
|
daemon = Daemon('daemon-quassel', managed_services[0],
|
||||||
|
listen_ports=[(4242, 'tcp4'), (4242, 'tcp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -129,16 +130,6 @@ def setup(helper, old_version=None):
|
|||||||
app.get_component('letsencrypt-quassel').setup_certificates()
|
app.get_component('letsencrypt-quassel').setup_certificates()
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(4242, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(4242, 'tcp6'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def get_available_domains():
|
def get_available_domains():
|
||||||
"""Return an iterator with all domains able to have a certificate."""
|
"""Return an iterator with all domains able to have a certificate."""
|
||||||
return (domain.name for domain in names.components.DomainName.list()
|
return (domain.name for domain in names.components.DomainName.list()
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import augeas
|
|||||||
from apt.cache import Cache
|
from apt.cache import Cache
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -98,7 +98,8 @@ class RadicaleApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = RadicaleWebserver('webserver-radicale', None)
|
webserver = RadicaleWebserver('webserver-radicale', None,
|
||||||
|
urls=['https://{host}/radicale'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
uwsgi = RadicaleUwsgi('uwsgi-radicale', 'radicale')
|
uwsgi = RadicaleUwsgi('uwsgi-radicale', 'radicale')
|
||||||
@ -271,14 +272,3 @@ def get_rights_value():
|
|||||||
value = 'owner_only'
|
value = 'owner_only'
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/radicale',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FreedomBox app for repro.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -98,7 +98,13 @@ class ReproApp(app_module.App):
|
|||||||
webserver = Webserver('webserver-repro', 'repro-plinth')
|
webserver = Webserver('webserver-repro', 'repro-plinth')
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-repro', managed_services[0])
|
daemon = Daemon(
|
||||||
|
'daemon-repro', managed_services[0], listen_ports=[(5060, 'udp4'),
|
||||||
|
(5060, 'udp6'),
|
||||||
|
(5060, 'tcp4'),
|
||||||
|
(5060, 'tcp6'),
|
||||||
|
(5061, 'tcp4'),
|
||||||
|
(5061, 'tcp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -127,17 +133,3 @@ def setup(helper, old_version=None):
|
|||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', actions.superuser_run, 'repro', ['setup'])
|
helper.call('post', actions.superuser_run, 'repro', ['setup'])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(5060, 'udp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5060, 'udp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5060, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5060, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5061, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(5061, 'tcp6'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ FreedomBox app to configure Roundcube.
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.modules.apache.components import Webserver
|
from plinth.modules.apache.components import Webserver
|
||||||
@ -88,7 +88,8 @@ class RoundcubeApp(app_module.App):
|
|||||||
ports=['http', 'https'], is_external=True)
|
ports=['http', 'https'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-roundcube', 'roundcube')
|
webserver = Webserver('webserver-roundcube', 'roundcube',
|
||||||
|
urls=['https://{host}/roundcube'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
|
|
||||||
@ -108,14 +109,3 @@ def setup(helper, old_version=None):
|
|||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', actions.superuser_run, 'roundcube', ['setup'])
|
helper.call('post', actions.superuser_run, 'roundcube', ['setup'])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/roundcube',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -27,12 +27,12 @@ import socket
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
from plinth.modules.users import register_group
|
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
|
from plinth.modules.users import register_group
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
@ -94,10 +94,16 @@ class SambaApp(app_module.App):
|
|||||||
firewall = Firewall('firewall-samba', name, ports=['samba'])
|
firewall = Firewall('firewall-samba', name, ports=['samba'])
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-samba', managed_services[0])
|
daemon = Daemon(
|
||||||
|
'daemon-samba', managed_services[0], listen_ports=[(139, 'tcp4'),
|
||||||
|
(139, 'tcp6'),
|
||||||
|
(445, 'tcp4'),
|
||||||
|
(445, 'tcp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
daemon_nmbd = Daemon('daemon-samba-nmbd', managed_services[1])
|
daemon_nmbd = Daemon('daemon-samba-nmbd', managed_services[1],
|
||||||
|
listen_ports=[(137, 'udp4'), (138, 'udp4')])
|
||||||
|
|
||||||
self.add(daemon_nmbd)
|
self.add(daemon_nmbd)
|
||||||
|
|
||||||
|
|
||||||
@ -119,20 +125,6 @@ def setup(helper, old_version=None):
|
|||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(137, 'udp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(138, 'udp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(139, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(139, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(445, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(445, 'tcp6'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def add_share(mount_point, share_type, filesystem):
|
def add_share(mount_point, share_type, filesystem):
|
||||||
"""Add a share."""
|
"""Add a share."""
|
||||||
command = [
|
command = [
|
||||||
|
|||||||
@ -22,14 +22,15 @@ import os
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.modules.apache.components import Uwsgi, Webserver
|
from plinth.modules.apache.components import Uwsgi, Webserver
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
|
|
||||||
from .manifest import PUBLIC_ACCESS_SETTING_FILE, backup, clients # noqa, pylint: disable=unused-import
|
from .manifest import (PUBLIC_ACCESS_SETTING_FILE, # noqa, pylint: disable=unused-import
|
||||||
|
backup, clients)
|
||||||
|
|
||||||
clients = clients
|
clients = clients
|
||||||
|
|
||||||
@ -80,7 +81,8 @@ class SearxApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-searx', 'searx-freedombox')
|
webserver = Webserver('webserver-searx', 'searx-freedombox',
|
||||||
|
urls=['https://{host}/searx/'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
webserver = SearxWebserverAuth('webserver-searx-auth',
|
webserver = SearxWebserverAuth('webserver-searx-auth',
|
||||||
@ -142,17 +144,6 @@ def is_public_access_enabled():
|
|||||||
return os.path.exists(PUBLIC_ACCESS_SETTING_FILE)
|
return os.path.exists(PUBLIC_ACCESS_SETTING_FILE)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/searx/',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def enable_public_access():
|
def enable_public_access():
|
||||||
"""Allow Searx app to be accessed by anyone with access."""
|
"""Allow Searx app to be accessed by anyone with access."""
|
||||||
actions.superuser_run('searx', ['enable-public-access'])
|
actions.superuser_run('searx', ['enable-public-access'])
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FreedomBox app to configure Shadowsocks.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -86,7 +86,8 @@ class ShadowsocksApp(app_module.App):
|
|||||||
is_external=False)
|
is_external=False)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-shadowsocks', managed_services[0])
|
daemon = Daemon('daemon-shadowsocks', managed_services[0],
|
||||||
|
listen_ports=[(1080, 'tcp4'), (1080, 'tcp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -105,13 +106,3 @@ def setup(helper, old_version=None):
|
|||||||
helper.install(managed_packages)
|
helper.install(managed_packages)
|
||||||
helper.call('post', actions.superuser_run, 'shadowsocks', ['setup'])
|
helper.call('post', actions.superuser_run, 'shadowsocks', ['setup'])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(1080, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(1080, 'tcp6'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ FreedomBox app to configure Syncthing.
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -95,7 +95,8 @@ class SyncthingApp(app_module.App):
|
|||||||
ports=['syncthing'], is_external=True)
|
ports=['syncthing'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-syncthing', 'syncthing-plinth')
|
webserver = Webserver('webserver-syncthing', 'syncthing-plinth',
|
||||||
|
urls=['https://{host}/syncthing/'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-syncthing', managed_services[0])
|
daemon = Daemon('daemon-syncthing', managed_services[0])
|
||||||
@ -122,14 +123,3 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
if old_version == 1 and app.is_enabled():
|
if old_version == 1 and app.is_enabled():
|
||||||
app.get_component('firewall-syncthing-ports').enable()
|
app.get_component('firewall-syncthing-ports').enable()
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/syncthing/',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -92,6 +92,20 @@ class TahoeApp(app_module.App):
|
|||||||
daemon = Daemon('daemon-tahoe', managed_services[0])
|
daemon = Daemon('daemon-tahoe', managed_services[0])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
results.extend([
|
||||||
|
action_utils.diagnose_url('http://localhost:5678', kind='4',
|
||||||
|
check_certificate=False),
|
||||||
|
action_utils.diagnose_url('http://localhost:5678', kind='6',
|
||||||
|
check_certificate=False),
|
||||||
|
action_utils.diagnose_url(
|
||||||
|
'http://{}:5678'.format(get_configured_domain_name()),
|
||||||
|
kind='4', check_certificate=False)
|
||||||
|
])
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
class Shortcut(frontpage.Shortcut):
|
class Shortcut(frontpage.Shortcut):
|
||||||
"""Frontpage shortcut to use configured domain name for URL."""
|
"""Frontpage shortcut to use configured domain name for URL."""
|
||||||
@ -157,19 +171,6 @@ def post_setup(configured_domain_name):
|
|||||||
app.enable()
|
app.enable()
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
return [
|
|
||||||
action_utils.diagnose_url('http://localhost:5678', kind='4',
|
|
||||||
check_certificate=False),
|
|
||||||
action_utils.diagnose_url('http://localhost:5678', kind='6',
|
|
||||||
check_certificate=False),
|
|
||||||
action_utils.diagnose_url(
|
|
||||||
'http://{}:5678'.format(get_configured_domain_name()), kind='4',
|
|
||||||
check_certificate=False)
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def add_introducer(introducer):
|
def add_introducer(introducer):
|
||||||
"""Add an introducer to the storage node's list of introducers.
|
"""Add an introducer to the storage node's list of introducers.
|
||||||
Param introducer must be a tuple of (pet_name, furl)
|
Param introducer must be a tuple of (pet_name, furl)
|
||||||
|
|||||||
@ -92,9 +92,65 @@ class TorApp(app_module.App):
|
|||||||
'tor-obfs4'], is_external=True)
|
'tor-obfs4'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
daemon = Daemon('daemon-tor', managed_services[0], strict_check=True)
|
daemon = Daemon(
|
||||||
|
'daemon-tor', managed_services[0], strict_check=True,
|
||||||
|
listen_ports=[(9050, 'tcp4'), (9050, 'tcp6'), (9040, 'tcp4'),
|
||||||
|
(9040, 'tcp6'), (9053, 'udp4'), (9053, 'udp6')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
|
||||||
|
results.extend(_diagnose_control_port())
|
||||||
|
|
||||||
|
output = actions.superuser_run('tor', ['get-status'])
|
||||||
|
ports = json.loads(output)['ports']
|
||||||
|
|
||||||
|
results.append([
|
||||||
|
_('Tor relay port available'),
|
||||||
|
'passed' if 'orport' in ports else 'failed'
|
||||||
|
])
|
||||||
|
if 'orport' in ports:
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_port_listening(int(ports['orport']),
|
||||||
|
'tcp4'))
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_port_listening(int(ports['orport']),
|
||||||
|
'tcp6'))
|
||||||
|
|
||||||
|
results.append([
|
||||||
|
_('Obfs3 transport registered'),
|
||||||
|
'passed' if 'obfs3' in ports else 'failed'
|
||||||
|
])
|
||||||
|
if 'obfs3' in ports:
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_port_listening(int(ports['obfs3']),
|
||||||
|
'tcp4'))
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_port_listening(int(ports['obfs3']),
|
||||||
|
'tcp6'))
|
||||||
|
|
||||||
|
results.append([
|
||||||
|
_('Obfs4 transport registered'),
|
||||||
|
'passed' if 'obfs4' in ports else 'failed'
|
||||||
|
])
|
||||||
|
if 'obfs4' in ports:
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_port_listening(int(ports['obfs4']),
|
||||||
|
'tcp4'))
|
||||||
|
results.append(
|
||||||
|
action_utils.diagnose_port_listening(int(ports['obfs4']),
|
||||||
|
'tcp6'))
|
||||||
|
|
||||||
|
results.append(_diagnose_url_via_tor('http://www.debian.org', '4'))
|
||||||
|
results.append(_diagnose_url_via_tor('http://www.debian.org', '6'))
|
||||||
|
|
||||||
|
results.append(_diagnose_tor_use('https://check.torproject.org', '4'))
|
||||||
|
results.append(_diagnose_tor_use('https://check.torproject.org', '6'))
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the module."""
|
"""Initialize the module."""
|
||||||
@ -148,60 +204,6 @@ def update_hidden_service_domain(status=None):
|
|||||||
name=status['hs_hostname'], services=services)
|
name=status['hs_hostname'], services=services)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
results.append(action_utils.diagnose_port_listening(9050, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(9050, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(9040, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(9040, 'tcp6'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(9053, 'udp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(9053, 'udp6'))
|
|
||||||
|
|
||||||
results.extend(_diagnose_control_port())
|
|
||||||
|
|
||||||
output = actions.superuser_run('tor', ['get-status'])
|
|
||||||
ports = json.loads(output)['ports']
|
|
||||||
|
|
||||||
results.append([
|
|
||||||
_('Tor relay port available'),
|
|
||||||
'passed' if 'orport' in ports else 'failed'
|
|
||||||
])
|
|
||||||
if 'orport' in ports:
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_port_listening(int(ports['orport']), 'tcp4'))
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_port_listening(int(ports['orport']), 'tcp6'))
|
|
||||||
|
|
||||||
results.append([
|
|
||||||
_('Obfs3 transport registered'),
|
|
||||||
'passed' if 'obfs3' in ports else 'failed'
|
|
||||||
])
|
|
||||||
if 'obfs3' in ports:
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_port_listening(int(ports['obfs3']), 'tcp4'))
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_port_listening(int(ports['obfs3']), 'tcp6'))
|
|
||||||
|
|
||||||
results.append([
|
|
||||||
_('Obfs4 transport registered'),
|
|
||||||
'passed' if 'obfs4' in ports else 'failed'
|
|
||||||
])
|
|
||||||
if 'obfs4' in ports:
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_port_listening(int(ports['obfs4']), 'tcp4'))
|
|
||||||
results.append(
|
|
||||||
action_utils.diagnose_port_listening(int(ports['obfs4']), 'tcp6'))
|
|
||||||
|
|
||||||
results.append(_diagnose_url_via_tor('http://www.debian.org', '4'))
|
|
||||||
results.append(_diagnose_url_via_tor('http://www.debian.org', '6'))
|
|
||||||
|
|
||||||
results.append(_diagnose_tor_use('https://check.torproject.org', '4'))
|
|
||||||
results.append(_diagnose_tor_use('https://check.torproject.org', '6'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def _diagnose_control_port():
|
def _diagnose_control_port():
|
||||||
"""Diagnose whether Tor control port is open on 127.0.0.1 only."""
|
"""Diagnose whether Tor control port is open on 127.0.0.1 only."""
|
||||||
results = []
|
results = []
|
||||||
|
|||||||
@ -22,13 +22,13 @@ import json
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
from plinth.modules.apache.components import Webserver
|
from plinth.modules.apache.components import Webserver
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.modules.users import register_group, add_user_to_share_group
|
from plinth.modules.users import add_user_to_share_group, register_group
|
||||||
|
|
||||||
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
@ -74,20 +74,23 @@ class TransmissionApp(app_module.App):
|
|||||||
parent_url_name='apps')
|
parent_url_name='apps')
|
||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
shortcut = frontpage.Shortcut(
|
shortcut = frontpage.Shortcut('shortcut-transmission', name,
|
||||||
'shortcut-transmission', name, short_description=short_description,
|
short_description=short_description,
|
||||||
icon=icon_filename, url='/transmission', clients=clients,
|
icon=icon_filename, url='/transmission',
|
||||||
login_required=True, allowed_groups=[group[0]])
|
clients=clients, login_required=True,
|
||||||
|
allowed_groups=[group[0]])
|
||||||
self.add(shortcut)
|
self.add(shortcut)
|
||||||
|
|
||||||
firewall = Firewall('firewall-transmission', name,
|
firewall = Firewall('firewall-transmission', name,
|
||||||
ports=['http', 'https'], is_external=True)
|
ports=['http', 'https'], is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-transmission', 'transmission-plinth')
|
webserver = Webserver('webserver-transmission', 'transmission-plinth',
|
||||||
|
urls=['https://{host}/transmission'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-transmission', managed_services[0])
|
daemon = Daemon('daemon-transmission', managed_services[0],
|
||||||
|
listen_ports=[(9091, 'tcp4')])
|
||||||
self.add(daemon)
|
self.add(daemon)
|
||||||
|
|
||||||
|
|
||||||
@ -115,15 +118,3 @@ def setup(helper, old_version=None):
|
|||||||
input=json.dumps(new_configuration).encode())
|
input=json.dumps(new_configuration).encode())
|
||||||
add_user_to_share_group(reserved_usernames[0], managed_services[0])
|
add_user_to_share_group(reserved_usernames[0], managed_services[0])
|
||||||
helper.call('post', app.enable)
|
helper.call('post', app.enable)
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(9091, 'tcp4'))
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/transmission',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FreedomBox app to configure Tiny Tiny RSS.
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, frontpage, menu
|
from plinth import cfg, frontpage, menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
@ -92,7 +92,8 @@ class TTRSSApp(app_module.App):
|
|||||||
is_external=True)
|
is_external=True)
|
||||||
self.add(firewall)
|
self.add(firewall)
|
||||||
|
|
||||||
webserver = Webserver('webserver-ttrss', 'tt-rss-plinth')
|
webserver = Webserver('webserver-ttrss', 'tt-rss-plinth',
|
||||||
|
urls=['https://{host}/tt-rss'])
|
||||||
self.add(webserver)
|
self.add(webserver)
|
||||||
|
|
||||||
daemon = Daemon('daemon-ttrss', managed_services[0])
|
daemon = Daemon('daemon-ttrss', managed_services[0])
|
||||||
@ -138,17 +139,6 @@ def force_upgrade(helper, packages):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.extend(
|
|
||||||
action_utils.diagnose_url_on_all('https://{host}/tt-rss',
|
|
||||||
check_certificate=False))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def backup_pre(packet):
|
def backup_pre(packet):
|
||||||
"""Save database contents."""
|
"""Save database contents."""
|
||||||
actions.superuser_run('ttrss', ['dump-database'])
|
actions.superuser_run('ttrss', ['dump-database'])
|
||||||
|
|||||||
@ -23,9 +23,10 @@ import subprocess
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, menu
|
from plinth import cfg, menu
|
||||||
|
from plinth.daemon import Daemon
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
version = 3
|
version = 3
|
||||||
@ -37,6 +38,8 @@ managed_packages = [
|
|||||||
'nslcd', 'samba-common-bin', 'slapd', 'tdb-tools'
|
'nslcd', 'samba-common-bin', 'slapd', 'tdb-tools'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
managed_services = ['slapd']
|
||||||
|
|
||||||
first_boot_steps = [
|
first_boot_steps = [
|
||||||
{
|
{
|
||||||
'id': 'users_firstboot',
|
'id': 'users_firstboot',
|
||||||
@ -79,6 +82,20 @@ class UsersApp(app_module.App):
|
|||||||
'users:index', parent_url_name='system')
|
'users:index', parent_url_name='system')
|
||||||
self.add(menu_item)
|
self.add(menu_item)
|
||||||
|
|
||||||
|
daemon = Daemon('daemon-users', managed_services[0],
|
||||||
|
listen_ports=[(389, 'tcp4'), (389, 'tcp6')])
|
||||||
|
self.add(daemon)
|
||||||
|
|
||||||
|
def diagnose(self):
|
||||||
|
"""Run diagnostics and return the results."""
|
||||||
|
results = super().diagnose()
|
||||||
|
|
||||||
|
results.append(_diagnose_ldap_entry('dc=thisbox'))
|
||||||
|
results.append(_diagnose_ldap_entry('ou=people'))
|
||||||
|
results.append(_diagnose_ldap_entry('ou=groups'))
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the user module."""
|
"""Initialize the user module."""
|
||||||
@ -96,20 +113,6 @@ def setup(helper, old_version=None):
|
|||||||
create_group('freedombox-share')
|
create_group('freedombox-share')
|
||||||
|
|
||||||
|
|
||||||
def diagnose():
|
|
||||||
"""Run diagnostics and return the results."""
|
|
||||||
results = []
|
|
||||||
|
|
||||||
results.append(action_utils.diagnose_port_listening(389, 'tcp4'))
|
|
||||||
results.append(action_utils.diagnose_port_listening(389, 'tcp6'))
|
|
||||||
|
|
||||||
results.append(_diagnose_ldap_entry('dc=thisbox'))
|
|
||||||
results.append(_diagnose_ldap_entry('ou=people'))
|
|
||||||
results.append(_diagnose_ldap_entry('ou=groups'))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def _diagnose_ldap_entry(search_item):
|
def _diagnose_ldap_entry(search_item):
|
||||||
"""Diagnose that an LDAP entry exists."""
|
"""Diagnose that an LDAP entry exists."""
|
||||||
result = 'failed'
|
result = 'failed'
|
||||||
|
|||||||
@ -61,7 +61,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li>
|
<li>
|
||||||
{% include "diagnostics_button.html" with module=diagnostics_module_name enabled=is_enabled %}
|
{% include "diagnostics_button.html" with app_id=diagnostics_module_name enabled=is_enabled %}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user