From a48bf522650c5dee0db503344d8c30a384111985 Mon Sep 17 00:00:00 2001 From: James Kasten Date: Mon, 20 Aug 2012 21:29:01 -0400 Subject: [PATCH] Fixed a few redirect errors from ec2 client/ca testing --- trustify/client/client.py | 4 ++-- trustify/client/configurator.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/trustify/client/client.py b/trustify/client/client.py index 8abef18ce..d2e8b72ed 100644 --- a/trustify/client/client.py +++ b/trustify/client/client.py @@ -393,8 +393,8 @@ def authenticate(): dialog.Dialog().msgbox("\nCongratulations! You have successfully enabled " + gen_https_names(dn) + "!", width=70) if by_default(): for ssl_vh in vhost: - success, redirect_file = redirect_all_ssl(ssl_vh) - output("Redirect: " + redirect_file + " - " + success) + success, redirect_file = config.redirect_all_ssl(ssl_vh) + output("\nRedirect vhost: " + redirect_file + " - " + str(success)) else: print "Congratulations! You have successfully enabled " + gen_https_names(dn) + "!" diff --git a/trustify/client/configurator.py b/trustify/client/configurator.py index f40e2528e..5db86ebac 100644 --- a/trustify/client/configurator.py +++ b/trustify/client/configurator.py @@ -446,7 +446,7 @@ class Configurator(object): return self.create_redirect_vhost(ssl_vhost) else: # Check if redirection already exists - exists, code = self.existing_redirect(vhost) + exists, code = self.existing_redirect(general_v) if exists: if code == 0: print "Redirect already added" @@ -473,8 +473,8 @@ class Configurator(object): -1 is also returned in case of no redirection/rewrite directives """ - rewrite_path = find_directive("RewriteRule", None, vhost.path) - redirect_path = find_directive("Redirect", None, vhost.path) + rewrite_path = self.find_directive("RewriteRule", None, vhost.path) + redirect_path = self.find_directive("Redirect", None, vhost.path) if redirect_path: # "Existing Redirect directive for virtualhost" @@ -518,15 +518,17 @@ class Configurator(object): redirect_addrs = redirect_addrs + ssl_a_vhttp # get servernames and serveraliases + serveralias = "" + servername = "" size_n = len(ssl_vhost.names) if size_n > 0: - servername = ssl_vhost.names[0] + servername = "ServerName " + ssl_vhost.names[0] if size_n > 1: serveralias = " ".join(ssl_vhost.names[1:size_n]) - + serveralias = "ServerAlias " + serveralias redirect_file = " \n\ -ServerName " + servername + "\n\ -ServerAlias " + serveralias + " \n\ +" + servername + "\n\ +" + serveralias + " \n\ ServerSignature Off \n\ \n\ RewriteEngine On \n\ @@ -555,6 +557,7 @@ LogLevel warn \n\ Function needs to be throughly tested and perhaps improved Will not do well with malformed configurations Consider changing this into a dict check + TODO: make default search for *:80 also... """ for vh in self.vhosts: found = 0 @@ -753,7 +756,6 @@ def main(): print v.addrs for name in v.names: print name - v. for m in config.find_directive("Listen", "443"): print "Directive Path:", m, "Value:", config.aug.get(m)