2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-08 00:04:38 +00:00

check for wildcard character in domain if not exists prepend it

This commit is contained in:
Saurabh 2018-06-29 14:24:15 +05:30
parent b81904b8c8
commit 9f150c4c35

View File

@ -119,12 +119,22 @@ def renew_certs():
def setup_wildcard_ssl(domain, email, bench_path):
get_certbot()
def _get_domain_name(domain):
if domain.split('.')[0] != '*':
domain = '*.{0}'.foramt(domain)
return domain
domain = _get_domain_name(domain)
return
if not get_config(bench_path).get("dns_multitenant"):
print("You cannot setup SSL without DNS Multitenancy")
return
get_certbot()
email_param = ''
if email:
email_param = '--email {0}'.format(email)
@ -132,7 +142,7 @@ def setup_wildcard_ssl(domain, email, bench_path):
try:
exec_cmd("{path} certonly --manual --preferred-challenges=dns {email_param} \
--server https://acme-v02.api.letsencrypt.org/directory \
--agree-tos -d *.{domain}".format(path=get_certbot_path(), domain=domain,
--agree-tos -d {domain}".format(path=get_certbot_path(), domain=domain,
email_param=email_param))
except CommandFailedError: