mirror of
https://github.com/certbot/certbot.git
synced 2026-08-04 20:32:33 +02:00
alter redirect_verification to raise only when an exact Letsencrypt redirction rewrite rule is encountered
This commit is contained in:
@@ -878,7 +878,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||||||
"redirection")
|
"redirection")
|
||||||
self._create_redirect_vhost(ssl_vhost)
|
self._create_redirect_vhost(ssl_vhost)
|
||||||
else:
|
else:
|
||||||
# Check if redirection already exists
|
# Check if LetsEncrypt redirection already exists
|
||||||
self._verify_no_redirects(general_vh)
|
self._verify_no_redirects(general_vh)
|
||||||
|
|
||||||
# Add directives to server
|
# Add directives to server
|
||||||
@@ -914,14 +914,9 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||||||
"RewriteRule", None, start=vhost.path)
|
"RewriteRule", None, start=vhost.path)
|
||||||
|
|
||||||
if rewrite_path:
|
if rewrite_path:
|
||||||
# "No existing redirection for virtualhost"
|
if map(self.aug.get, rewrite_path) in [
|
||||||
if len(rewrite_path) != len(constants.REWRITE_HTTPS_ARGS):
|
constants.REWRITE_HTTPS_ARGS,
|
||||||
raise errors.PluginError("Unknown Existing RewriteRule")
|
constants.REWRITE_HTTPS_ARGS_WITH_END]:
|
||||||
for match, arg in itertools.izip(
|
|
||||||
rewrite_path, constants.REWRITE_HTTPS_ARGS):
|
|
||||||
if self.aug.get(match) != arg:
|
|
||||||
raise errors.PluginError("Unknown Existing RewriteRule")
|
|
||||||
|
|
||||||
raise errors.PluginEnhancementAlreadyPresent(
|
raise errors.PluginEnhancementAlreadyPresent(
|
||||||
"Let's Encrypt has already enabled redirection")
|
"Let's Encrypt has already enabled redirection")
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,12 @@ AUGEAS_LENS_DIR = pkg_resources.resource_filename(
|
|||||||
|
|
||||||
REWRITE_HTTPS_ARGS = [
|
REWRITE_HTTPS_ARGS = [
|
||||||
"^", "https://%{SERVER_NAME}%{REQUEST_URI}", "[L,QSA,R=permanent]"]
|
"^", "https://%{SERVER_NAME}%{REQUEST_URI}", "[L,QSA,R=permanent]"]
|
||||||
"""Apache rewrite rule arguments used for redirections to https vhost"""
|
"""Apache version<2.3.9 rewrite rule arguments used for redirections to https vhost"""
|
||||||
|
|
||||||
|
REWRITE_HTTPS_ARGS_WITH_END = [
|
||||||
|
"^", "https://%{SERVER_NAME}%{REQUEST_URI}", "[L,QSA,R=permanent]"]
|
||||||
|
"""Apache version >= 2.3.9 rewrite rule arguments used for redirections to
|
||||||
|
https vhost"""
|
||||||
|
|
||||||
HSTS_ARGS = ["always", "set", "Strict-Transport-Security",
|
HSTS_ARGS = ["always", "set", "Strict-Transport-Security",
|
||||||
"\"max-age=31536000; includeSubDomains\""]
|
"\"max-age=31536000; includeSubDomains\""]
|
||||||
|
|||||||
Reference in New Issue
Block a user