mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-25 08:43:36 +00:00
mumble: Add diagnostic for setup config changes
Tests: - Modify or remove the sslCert/sslKey lines in mumble-server.ini. The diagnostic is failed. After repair, the expected lines are restored, and the diagnostic is passed. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
2274711c19
commit
79999a9090
@ -7,10 +7,12 @@ import pathlib
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import gettext_noop
|
||||
|
||||
from plinth import app as app_module
|
||||
from plinth import frontpage, menu
|
||||
from plinth.daemon import Daemon
|
||||
from plinth.diagnostic_check import DiagnosticCheck, Result
|
||||
from plinth.modules import names
|
||||
from plinth.modules.backups.components import BackupRestore
|
||||
from plinth.modules.firewall.components import Firewall
|
||||
@ -113,6 +115,12 @@ class MumbleApp(app_module.App):
|
||||
privileged.setup()
|
||||
return True
|
||||
|
||||
def diagnose(self) -> list[DiagnosticCheck]:
|
||||
"""Run diagnostics and return the results."""
|
||||
results = super().diagnose()
|
||||
results.append(_diagnose_config())
|
||||
return results
|
||||
|
||||
|
||||
def get_available_domains():
|
||||
"""Return an iterator with all domains able to have a certificate."""
|
||||
@ -140,3 +148,10 @@ def get_domains():
|
||||
return [domain]
|
||||
|
||||
return []
|
||||
|
||||
|
||||
def _diagnose_config() -> DiagnosticCheck:
|
||||
"""Check that configuration changes made during setup are in place."""
|
||||
result = Result.PASSED if privileged.check_setup() else Result.FAILED
|
||||
return DiagnosticCheck('mumble-config',
|
||||
gettext_noop('Mumble server is configured'), result)
|
||||
|
||||
@ -25,6 +25,15 @@ def setup():
|
||||
aug.save()
|
||||
|
||||
|
||||
@privileged
|
||||
def check_setup() -> bool:
|
||||
"""Check that setup configuration is retained."""
|
||||
aug = _load_augeas()
|
||||
ssl_cert_matches = aug.get('.anon/sslCert') == DATA_DIR + '/fullchain.pem'
|
||||
ssl_key_matches = aug.get('.anon/sslKey') == DATA_DIR + '/privkey.pem'
|
||||
return ssl_cert_matches and ssl_key_matches
|
||||
|
||||
|
||||
@privileged
|
||||
def set_super_user_password(password: secret_str):
|
||||
"""Set the superuser password with murmurd command."""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user