From 0802ade04eec84d7071e3052c3c05fc368741c7a Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Thu, 21 Jan 2016 15:59:30 -0800 Subject: [PATCH 1/3] fix apache 2.2 --- letsencrypt-apache/letsencrypt_apache/configurator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/letsencrypt-apache/letsencrypt_apache/configurator.py b/letsencrypt-apache/letsencrypt_apache/configurator.py index 8818923f4..546211696 100644 --- a/letsencrypt-apache/letsencrypt_apache/configurator.py +++ b/letsencrypt-apache/letsencrypt_apache/configurator.py @@ -557,8 +557,11 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): # search for NameVirtualHost directive for ip_addr # note ip_addr can be FQDN although Apache does not recommend it - return (self.version >= (2, 4) or - self.parser.find_dir("NameVirtualHost", str(target_addr))) + if (self.version >= (2,4)): + return True + else: + self.save("don't lose config changes", True) + return (self.parser.find_dir("NameVirtualHost", str(target_addr))) def add_name_vhost(self, addr): """Adds NameVirtualHost directive for given address. From b75b887a837add11055bfa0a0e18aadaa5ebb69f Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Fri, 22 Jan 2016 10:03:29 -0800 Subject: [PATCH 2/3] fixed linting issues --- letsencrypt-apache/letsencrypt_apache/configurator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/letsencrypt-apache/letsencrypt_apache/configurator.py b/letsencrypt-apache/letsencrypt_apache/configurator.py index 546211696..65e7a14a8 100644 --- a/letsencrypt-apache/letsencrypt_apache/configurator.py +++ b/letsencrypt-apache/letsencrypt_apache/configurator.py @@ -557,11 +557,11 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): # search for NameVirtualHost directive for ip_addr # note ip_addr can be FQDN although Apache does not recommend it - if (self.version >= (2,4)): + if self.version >= (2, 4): return True else: self.save("don't lose config changes", True) - return (self.parser.find_dir("NameVirtualHost", str(target_addr))) + return self.parser.find_dir("NameVirtualHost", str(target_addr)) def add_name_vhost(self, addr): """Adds NameVirtualHost directive for given address. From 5192fa36ab25fe7a5dbeb757b1d5308e20d7c754 Mon Sep 17 00:00:00 2001 From: Noah Swartz Date: Fri, 22 Jan 2016 11:47:49 -0800 Subject: [PATCH 3/3] move save command up to tls_sni --- letsencrypt-apache/letsencrypt_apache/configurator.py | 7 ++----- letsencrypt-apache/letsencrypt_apache/tls_sni_01.py | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/letsencrypt-apache/letsencrypt_apache/configurator.py b/letsencrypt-apache/letsencrypt_apache/configurator.py index 65e7a14a8..8818923f4 100644 --- a/letsencrypt-apache/letsencrypt_apache/configurator.py +++ b/letsencrypt-apache/letsencrypt_apache/configurator.py @@ -557,11 +557,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): # search for NameVirtualHost directive for ip_addr # note ip_addr can be FQDN although Apache does not recommend it - if self.version >= (2, 4): - return True - else: - self.save("don't lose config changes", True) - return self.parser.find_dir("NameVirtualHost", str(target_addr)) + return (self.version >= (2, 4) or + self.parser.find_dir("NameVirtualHost", str(target_addr))) def add_name_vhost(self, addr): """Adds NameVirtualHost directive for given address. diff --git a/letsencrypt-apache/letsencrypt_apache/tls_sni_01.py b/letsencrypt-apache/letsencrypt_apache/tls_sni_01.py index 971072311..cc1d749a0 100644 --- a/letsencrypt-apache/letsencrypt_apache/tls_sni_01.py +++ b/letsencrypt-apache/letsencrypt_apache/tls_sni_01.py @@ -76,6 +76,7 @@ class ApacheTlsSni01(common.TLSSNI01): # Setup the configuration addrs = self._mod_config() + self.configurator.save("Don't lose mod_config changes", True) self.configurator.make_addrs_sni_ready(addrs) # Save reversible changes