From 2199d81f1e2beba9d46993dc9d70b6e3b7f8d4e0 Mon Sep 17 00:00:00 2001 From: gauthiier Date: Wed, 28 Nov 2018 09:54:47 +0100 Subject: [PATCH] vhost --- vhost-apache2/vhost.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vhost-apache2/vhost.py b/vhost-apache2/vhost.py index cb2a552..0aa1b25 100755 --- a/vhost-apache2/vhost.py +++ b/vhost-apache2/vhost.py @@ -70,10 +70,10 @@ def vhost_add(domain): if re.match(re_domain, domain) is None: print("Invalid domain name: " + domain + " -> pass") - www = os.path.join(html_dir_path + domain) + www = os.path.join(html_dir_path, domain) os.makedirs(www, exist_ok=True) - logs = os.path.join(logs_dir_path + domain) + logs = os.path.join(logs_dir_path, domain) os.makedirs(logs, exist_ok=True) # debug: this file might not be here @@ -90,6 +90,12 @@ def vhost_add(domain): with open(vhost_file, 'w+') as vhost_file_fp: vhost_file_fp.write(vhost) + # check is ssl cert exists + cert = os.path.join('/etc/letsencrypt/live', domain) + if not os.path.exists(cert): + print("SSL certificates do not exist for domain - " + domain) + print("Please make sure to place them in " + cert + "to allow secure https") + def vhost_remove(domain): print(" removing domain — " + domain)