Handle lineages that were upgraded from staging -> production

This commit is contained in:
Peter Eckersley
2015-12-12 12:44:24 -08:00
parent 3b4d95a5da
commit 723d9fe048
+16 -7
View File
@@ -396,13 +396,22 @@ def _avoid_invalidating_lineage(config, lineage, original_server):
def _is_staging(srv): def _is_staging(srv):
return srv == constants.STAGING_URI or "staging" in srv return srv == constants.STAGING_URI or "staging" in srv
if _is_staging(config.server) and not _is_staging(original_server): # Some lineages may have begun with --staging, but then had production certs
if not config.break_my_certs: # added to them
names = ", ".join(lineage.names()) latest_cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
raise errors.Error( open(lineage.cert).read())
"You've asked to renew/replace a valid certificiate with " # all our test certs are from happy hacker fake CA, though maybe one day
"a test certificate (domains: {0}). We will not do that " # we should test more methodically
"unless you use the --break-my-certs flag!".format(names)) now_valid = not ("fake" in repr(latest_cert.get_issuer()).lower())
if _is_staging(config.server):
if not _is_staging(original_server) or now_valid:
if not config.break_my_certs:
names = ", ".join(lineage.names())
raise errors.Error(
"You've asked to renew/replace a seemingly valid certificiate with "
"a test certificate (domains: {0}). We will not do that "
"unless you use the --break-my-certs flag!".format(names))
def set_configurator(previously, now): def set_configurator(previously, now):
""" """