diff --git a/trustify/client/client.py b/trustify/client/client.py index 48ee73345..9cec3a674 100644 --- a/trustify/client/client.py +++ b/trustify/client/client.py @@ -263,7 +263,6 @@ def authenticate(): print "Generating key:", key_file print "Creating CSR:", req_file - k=chocolatemessage() m=chocolatemessage() init(k) @@ -355,6 +354,14 @@ def authenticate(): #cert_chain_abspath = os.path.abspath(chain_file) for host in vhost: config.deploy_cert(host, os.path.abspath(cert_file), os.path.abspath(key_file), cert_chain_abspath) + # Enable any vhost that was issued to, but not enabled + if not config.is_site_enabled(host.file): + if curses: + shower.add("Enabling Site " + host.file) + else: + print "Enabling Site", host.file + config.enable_site(host.file) + sni_challenge.apache_restart(quiet=curses) elif r.failure.IsInitialized(): print "Server reported failure." diff --git a/trustify/client/configurator.py b/trustify/client/configurator.py index c15c2bdf2..3a14bca84 100644 --- a/trustify/client/configurator.py +++ b/trustify/client/configurator.py @@ -11,7 +11,8 @@ SERVER_ROOT = "/etc/apache2/" #TODO - Stop Augeas from loading up backup emacs files in sites-available class VH(object): - def __init__(self, vh_path, vh_addrs): + def __init__(self, filename_path, vh_path, vh_addrs): + self.file = filename_path self.path = vh_path self.addrs = vh_addrs self.names = [] @@ -164,7 +165,7 @@ class Configurator(object): args = self.aug.match(p + "/arg") for arg in args: addrs.append(self.aug.get(arg)) - vhs.append(VH(p, addrs)) + vhs.append(VH(self.get_file_path(p), p, addrs)) for host in vhs: self.__add_servernames(host) @@ -472,9 +473,9 @@ class Configurator(object): return vh return None - def get_file_path(self, vhost): + def get_file_path(self, vhost_path): # Strip off /files - avail_fp = vhost.path[6:] + avail_fp = vhost_path[6:] # This can be optimized... while True: find_if = avail_fp.find("/IfModule") @@ -598,7 +599,7 @@ class Configurator(object): def main(): config = Configurator() for v in config.vhosts: - print config.get_file_path(v) + print v.file print v.addrs for name in v.names: print name