From ec5f99406879baffca3e99844617c36d293c106a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 10 Sep 2020 17:13:39 -0700 Subject: [PATCH] pagekite: Don't announce unconfigured kite as a valid domain Closes: #1891. As soon as the app is installed, the default configuration has NAME.pagekite.me. This is incorrectly announced as a valid domain to the system. Avoid this behavior by never announcing this default configured kite name. Tests: - Install Pagekite. Observe that the default kite name is not announced as a domain (confirmed in Name Services). With the patch, it will. - Change the domain to anything other than default. It is announced. LE tries to obtain cert. Name Services list the domain. - Change the domain back to default kite name. It is not announced. Old domain is removed. - Start FreedomBox with Pagekite configured with default domain. It is not announced. - Start FreedomBox with Pagekite configured with non-default domain. It is announced. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/pagekite/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plinth/modules/pagekite/utils.py b/plinth/modules/pagekite/utils.py index d2a7d4572..7c3cf266d 100644 --- a/plinth/modules/pagekite/utils.py +++ b/plinth/modules/pagekite/utils.py @@ -20,6 +20,9 @@ KITE_SECRET = '@kitesecret' # Augeas base path for Pagekite configuration files CONF_PATH = '/files/etc/pagekite.d' +# Kite name used by default in config. Should be treated as unconfigured. +UNCONFIGURED_KITE = 'NAME.pagekite.me' + # Parameters that get stored in configuration service_on entries SERVICE_PARAMS = [ 'protocol', 'kitename', 'backend_host', 'backend_port', 'secret' @@ -178,7 +181,7 @@ def update_names_module(is_enabled=None): service for service, value in config['predefined_services'].items() if value ] - if config['kite_name']: + if config['kite_name'] and config['kite_name'] != UNCONFIGURED_KITE: domain_added.send_robust(sender='pagekite', domain_type='domain-type-pagekite', name=config['kite_name'],