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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-09-10 17:13:39 -07:00 committed by James Valleroy
parent e9559b2d0d
commit ec5f994068
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -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'],