From 3ba7e961c4aa920619504350f46706d846f48f48 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 20 Aug 2019 09:24:42 -0700 Subject: [PATCH] letsencrypt: Don't try to obtain certificates for .local domains Replace the check for ignoring .onion domains with a check that ignore any domain type that can't have certificates. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/letsencrypt/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plinth/modules/letsencrypt/__init__.py b/plinth/modules/letsencrypt/__init__.py index c65d504ba..5fb061232 100644 --- a/plinth/modules/letsencrypt/__init__.py +++ b/plinth/modules/letsencrypt/__init__.py @@ -29,6 +29,7 @@ from plinth import app as app_module from plinth import cfg, menu from plinth.errors import ActionError from plinth.modules import names +from plinth.modules.names.components import DomainType from plinth.signals import domain_added, domain_removed, post_module_loading from plinth.utils import format_lazy @@ -151,7 +152,7 @@ def certificate_delete(domain): def on_domain_added(sender, domain_type='', name='', description='', services=None, **kwargs): """Obtain a certificate for the new domain""" - if domain_type == 'domain-type-tor': + if not DomainType.get(domain_type).can_have_certificate: return False # Check if a cert if already available @@ -173,6 +174,9 @@ def on_domain_added(sender, domain_type='', name='', description='', def on_domain_removed(sender, domain_type, name='', **kwargs): """Revoke Let's Encrypt certificate for the removed domain""" + if not DomainType.get(domain_type).can_have_certificate: + return False + try: # Revoking certs during tests or empty names isn't expected to succeed if sender != 'test' and name: