mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
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 <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
855a99cc21
commit
3ba7e961c4
@ -29,6 +29,7 @@ from plinth import app as app_module
|
|||||||
from plinth import cfg, menu
|
from plinth import cfg, menu
|
||||||
from plinth.errors import ActionError
|
from plinth.errors import ActionError
|
||||||
from plinth.modules import names
|
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.signals import domain_added, domain_removed, post_module_loading
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ def certificate_delete(domain):
|
|||||||
def on_domain_added(sender, domain_type='', name='', description='',
|
def on_domain_added(sender, domain_type='', name='', description='',
|
||||||
services=None, **kwargs):
|
services=None, **kwargs):
|
||||||
"""Obtain a certificate for the new domain"""
|
"""Obtain a certificate for the new domain"""
|
||||||
if domain_type == 'domain-type-tor':
|
if not DomainType.get(domain_type).can_have_certificate:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check if a cert if already available
|
# 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):
|
def on_domain_removed(sender, domain_type, name='', **kwargs):
|
||||||
"""Revoke Let's Encrypt certificate for the removed domain"""
|
"""Revoke Let's Encrypt certificate for the removed domain"""
|
||||||
|
if not DomainType.get(domain_type).can_have_certificate:
|
||||||
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Revoking certs during tests or empty names isn't expected to succeed
|
# Revoking certs during tests or empty names isn't expected to succeed
|
||||||
if sender != 'test' and name:
|
if sender != 'test' and name:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user