Solved wildcard redirect bug

This commit is contained in:
2025-04-29 03:28:29 +02:00
parent 9a71ad7af9
commit c950862b80
4 changed files with 21 additions and 114 deletions

View File

@@ -37,3 +37,15 @@ class CertUtils:
if 'cert.pem' in files:
cert_files.append(os.path.join(root, 'cert.pem'))
return cert_files
@staticmethod
def matches(domain, san):
"""Check if the SAN entry matches the domain according to wildcard rules."""
if san.startswith('*.'):
base = san[2:]
# Check if domain is direct subdomain (one label only)
if domain.count('.') == base.count('.') + 1 and domain.endswith('.' + base):
return True
return False
else:
return domain == san